如何从我的裸机手臂编译中排除 libc?
我正在尝试编译我的第一个针对 ARM Cortex-M0+ MCU 的裸机项目。我正在使用 gcc arm-none-eabi 进行编译。该系统当前由以下部分组成:
boot.s
——一个包含中断处理程序和中断处理程序的汇编文件。向量表。调用 SystemInit(),然后调用 __main()- 的 ac 文件
system.c
-- 包含芯片初始化代码SystemInit()
和__main()
main.c
-- ac 文件,用于闪烁一些 gpio 引脚cortexm0p.ld
-- 用于绝对定位代码和代码的链接器脚本入口点
c 文件使用以下标志进行编译:-mcpu=cortex-m0 -mthumb -nostartfiles -nostdlib -nodefaultlibs -ffreestand -lnosys
然后将目标文件与 arm-none-eabi-ld boot.o system.o main.o -T cortexm0p.ld -o shake.elf
链接在一起,
这会导致错误:arm-none-eabi-ld: 找不到 libc.a
为什么我的链接器命令要查找 libc? / 我需要改变什么才能让它停止?
I am trying to compile my first bare metal project targeting an arm cortex-M0+ MCU. I am compiling with gcc arm-none-eabi. The system currently consists of:
boot.s
-- an assembly file containing interrupt handlers & vector table. calls SystemInit() then __main()system.c
-- a c file containing chip initialization codeSystemInit()
and__main()
main.c
-- a c file which blinks some gpio pinscortexm0p.ld
-- a linker script for absolute positioning of code & entry point
The c files are compiled with the flags: -mcpu=cortex-m0 -mthumb -nostartfiles -nostdlib -nodefaultlibs -ffreestanding -lnosys
the object files are then linked together with arm-none-eabi-ld boot.o system.o main.o -T cortexm0p.ld -o blink.elf
This results in an error:arm-none-eabi-ld: cannot find libc.a
Why is my linker command looking for libc? / What do I need to change to make it stop?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,我的链接器脚本文件有一个显式的丢弃部分,不包括 libc、libgcc 和 libm。 ::捂脸::
in this case, my linker script file had an explicit discard section excluding libc, libgcc and libm. ::facepalm::