。exit.c中:(文字+为0x18):未定义的参考`_exit“使用时,臂无 - EABI - 海合会 [英] exit.c:(.text+0x18): undefined reference to `_exit' when using arm-none-eabi-gcc
问题描述
我是新来的微控制器领域。我需要的端口被编译为AVR微控制器的程序编译为ARM微控制器程序的IDE。我刚刚从更换AVR编译器在ARM和添加为告诉某人一些选项。
以下是命令:
I'm new to the field of microcontrollers. I need to port an IDE which is compiling programs for AVR microcontrollers to compile programs for ARM microcontrollers. I have just replaced the compiler from AVR to ARM and added some options as told by someone. The following is the command:
\ARM-GCC\bin\arm-none-eabi-gcc -O0 -ffunction-sections -Wall -std=gnu99 -mfloat-abi=soft
-Wa,-adhlns="$@.lst" -fmessage-length=0 -mcpu=cortex-m0 -mthumb -g3 -gdwarf-2 -Wl,
--gc-sections -o <Dir_name>\Build_Files\Blink_arm.cpp.elf <Dir_name>\Build_Files\Blink_arm.cpp.o <Dir_name>\Build_Files\core.a
-L<Dir_name>\Build_Files -lm
当我执行它,我得到follwing错误:
When I execute it I get the follwing error:
tools/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.6.2\libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text+0x18): undefined reference to `_exit'
collect2: ld returned 1 exit status
我可以得到什么这是错误一些帮助,我怎么能解决这个问题。而且我不知道在命令行中的选项指定。
May I get some help on what is this error and how can I solve it. And also I don't know what those options in the command line specify.
推荐答案
这发生编译与
一体机/架构文件无 - EABI - 海合会臂当加载它在ARM目标机器。最有可能你是不是利用半主机的,要重新定位。
This happens when compiling a file with arm-none-eabi-gcc
in one machine/architecture to load it in an ARM target machine. Most probably you are not making use of semihosting, you want to retarget.
ARM®编译器工具链4.1版显示:
ARM® Compiler toolchain Version 4.1 indicates:
半主机是使在ARM目标code运行进行沟通的机制,
使用运行调试器的主机上的输入/输出设备。
Semihosting is a mechanism that enables code running on an ARM target to communicate and use the Input/Output facilities on a host computer that is running a debugger.
从工具链的readme.txt文件(文件夹下的 ... / GCC-臂无 - EABI-VERSION /共享/ DOC / GCC-臂无 - EABI
):
From the toolchain's readme.txt (under folder .../gcc-arm-none-eabi-VERSION/share/doc/gcc-arm-none-eabi
):
**非半主机/重定向
** non-semihosting/retarget
如果您使用的是重新定位,链接,如:
$臂无 - EABI - 海合会--specs = nosys.specs $(OTHER_LINK_OPTIONS)
If you are using retarget, linking like: $ arm-none-eabi-gcc --specs=nosys.specs $(OTHER_LINK_OPTIONS)
对于我来说 - 规格= nosys.specs
已经足够;)
For me --specs=nosys.specs
was enough ;)
这篇关于。exit.c中:(文字+为0x18):未定义的参考`_exit“使用时,臂无 - EABI - 海合会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!