GCC:在ARM裸机软件中包含math.h函数(arm 您所在的位置:网站首页 mathh包含的函数 GCC:在ARM裸机软件中包含math.h函数(arm

GCC:在ARM裸机软件中包含math.h函数(arm

2024-03-23 08:19| 来源: 网络整理| 查看: 265

我正在开发一个STM32H753上的裸机独立软件。我既不使用libc也不使用crt。

以下是链接命令行:

arm-none-eabi-gcc -T"xxx.ld" -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -ffreestanding -nostdlib -nostartfiles --specs=nosys.specs -Wl,--start-group -lc -lm -Wl,--end-group -Wl,-Map=xxx.map -o xxx.elf

现在我需要包含数学库,因为我使用的是sqrt函数。我认为链接命令行就足够了,但是我得到了一个"sqrt undefined“错误。

我尝试将路径添加到libm.a:(也尝试了不使用-Wl)

arm-none-eabi-gcc -T"xxx.ld" -Wl,-L/opt/gcc-arm-none-eabi-10-2020-q4-major/arm-none-eabi/lib/ -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -ffreestanding -nostdlib -nostartfiles --specs=nosys.specs -Wl,--start-group -lc -lm -Wl,--end-group -Wl,-Map=build_uP1/base_gen_uP1.map -o build_uP1/base_gen_uP1.elf ,但我仍然得到相同的错误。

我不知道该选择什么选项来链接到正确的库



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有