欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ARM学习笔记-静态库的生成与调用

程序员文章站 2022-06-04 09:03:00
...

仅用于记录开发过程中遇到的一些问题,方便日后参考。

      编译好A15的静态库然后在工程中调用,出现问题:

makefile:149: recipe for target 'rtos_template_app_am572x_a15.out' failed
c:/ti/gcc-arm-none-eabi-6-2017-q1-update/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: error: rtos_template_app_am572x_a15.out uses VFP register arguments, E:/WorkSpace/ccs_v7/sl_am5728_a15_test/Debug\libsl_am5728_a15_test.a(test.o) does not

      应该是编译静态库时的配置和工程配置(-mfpu)不一致的问题,在网上搜了下,e2e里有个连接:https://community.arm.com/tools/b/blog/posts/arm-cortex-a-processors-and-gcc-command-lines

         根据提示,统一了参数-mfpu=neon-vfpv4之后还是出现上述问题,后来在仔细看了下上述链接,官方建议的编译配置如下:

        -mcpu=cortex-a15 -mfpu=neon-vfpv4 -mfloat-abi=hard

        然而在ccs中,新建工程时只会根据选择的核来指定第一个参数,后两个参数都为空,所以需要根据官网的建议设置好后两个参数。最终,静态库工程的配置和app工程的配置如下:

        -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfloat-abi=hard -mfpu=neon-vfpv4

        搞定!

        附官网对于-mfloat-abi三种配置的说明:

  • -mfloat-abi=soft -- ignore all FPU and NEON instructions, use only the core register set and emulate all floating-point operations using library calls.
  • -mfloat-abi=softfp -- use the same calling conventions as -float-abi=soft, but use floating-point and NEON instructions as appropriate. This option is binary compatible with -mfloat-abi=soft and can be used to improve the performance of code that has to conform to a soft-float environment but where it is known that the relevant hardware instructions will be available.
  • -mfloat-abi=hard -- use the floating-point and NEON instructions as appropriate and also change the ABI calling conventions in order to generate more efficient function calls; floating-point and vector types can now be passed between functions in the extension registers which not only saves a significant amount of copying but also means that fewer calls need to pass arguments on the stack.

 

 

相关标签: ARM