c - 警告 : cannot find entry symbol Reset_Handler

标签 c linker

错误的完整摘要如下:

Info: Internal Builder is used for build
arm-atollic-eabi-gcc -o test.elf main.o stm32f4xx_it.o system_stm32f4xx.o -T../Debug_STM32F401VC_FLASH.ld -specs=nosys.specs -static -Wl,-cref,-u,Reset_Handler -Wl,-Map=test.map -Wl,--defsym=malloc_getpagesize_P=0x80 -Wl,--start-group -lc -lm -Wl,--end-group -specs=nano.specs 
c:/program files (x86)/atollic/truestudio for stm32 9.0.1/armtools/bin/../lib/gcc/arm-atollic-eabi/6.3.1/../../../../arm-atollic-eabi/bin/ld.exe: warning: cannot find entry symbol Reset_Handler; defaulting to 08000000
main.o: In function `main':
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:26: undefined reference to `TM_USART_Init'
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:29: undefined reference to `TM_USART_Puts'
C:\Users\Deepayan\Atollic\TrueSTUDIO\STM32_workspace_9.0\test\Debug/..\main.c:33: undefined reference to `TM_USART_Getc'

我们应该在哪里指定重置处理程序?谢谢。

最佳答案

处理程序在汇编器启动文件中定义,该文件由 STM32CubeIDE 或 STM32CubeMX 自动生成。该文件位于项目根目录下名为“Startup”的文件夹中。它以您的MCU命名,例如startup_stm32f303xe.s、startup_stm32l476rgtx等。

警告“找不到条目符号 Reset_Handler”意味着启动文件 1. 已损坏、2. 丢失或 3. 未包含在您的构建中。要修复情况 1 和 2,只需从 STM32CubeIDE 或 STM32CubeMX 重新生成代码即可。

案例3更有趣。代码生成时,STM32CubeIDE 和 STM32CubeMX 有时会将“Startup”文件夹标记为“从构建中排除”。更糟糕的是,该文件夹没有“排除”图标,因此没有明显的方法来注意到它。因此,您需要右键单击“Startup”文件夹,转到“C/C++ Build”并取消选中“从构建中排除资源”复选框。这个问题似乎是随机出现的,通常是从其他项目复制的项目。

关于c - 警告 : cannot find entry symbol Reset_Handler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51904050/

相关文章:

c - 如何在不阻塞的情况下捕获 unix 控制台应用程序中的单个击键?

c++ - 使用 comsupp.lib 的内部链接器错误

c++ - 链接失败,并带有对libboost_thread的 undefined reference

python - 在我自己的 C 模块中使用 python 模块的 C API

C malloc 和 free

c - 在 C 中使用链接数据结构时的双指针

c - 我无法让我的C程序输出到文件

c# - 正在分发 dll : What to do with . lib 文件吗?

c++ - LLVM 代码生成链接器错误

c - 为什么我的插入链表的代码在第三项上失败?