搜索
bottom↓
回复: 3

GCC下的编译错误

[复制链接]

出0入0汤圆

发表于 2012-2-15 13:26:47 | 显示全部楼层 |阅读模式
我是用slickedit+yagarto做编译环境的,
编译命令如下:
.C文件:arm-none-eabi-gcc -c -fdata-sections -ffunction-sections -fno-builtin -O0 -mcpu=cortex-m4 -march=armv7e-m -mthumb -g -ggdb -Wall %i %defd -o "%bd%n.o"  "%f"
.S文件:arm-none-eabi-gcc -x assembler-with-cpp -Wall -mcpu=cortex-m4 -mthumb -g -ggdb -o "%bd%n.o" "%f"
Link命令:arm-none-eabi-gcc -T"%rpLinker\stm32_flash.ld" -Xlinker --gc-sections -mcpu=cortex-m3 -mthumb -static -g -ggdb -o "%rpBin/%rn.elf" %f %libs
Include目录:
(原文件名:图像 1.png)

文件结构见附件。
点击此处下载 ourdev_718908B6MENS.txt(文件大小:5K) (原文件名:list.txt)

用的stm32f40x的BSP,没修改,编译newlib的时候报错:
newlib\libc.c: In function 'libc_system_init':
newlib\libc.c:18:2: warning: implicit declaration of function 'rt_console_init' [-Wimplicit-function-declaration]
newlib\libc.c:21:2: warning: implicit declaration of function 'open' [-Wimplicit-function-declaration]
newlib\libc.c:10:6: warning: variable 'fd' set but not used [-Wunused-but-set-variable]
math.c
newlib\math.c: In function 'ln':
newlib\math.c:240:1: warning: control reaches end of non-void function [-Wreturn-type]
syscalls.c
newlib\syscalls.c: In function '_close_r':
newlib\syscalls.c:11:2: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_lseek_r':
newlib\syscalls.c:83:2: warning: implicit declaration of function 'lseek' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_mkdir_r':
newlib\syscalls.c:92:2: warning: implicit declaration of function 'mkdir' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_open_r':
newlib\syscalls.c:101:2: warning: implicit declaration of function 'open' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_read_r':
newlib\syscalls.c:110:2: warning: implicit declaration of function 'read' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_rename_r':
newlib\syscalls.c:119:2: warning: implicit declaration of function 'rename' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_stat_r':
newlib\syscalls.c:135:2: warning: implicit declaration of function 'stat' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_unlink_r':
newlib\syscalls.c:152:2: warning: implicit declaration of function 'unlink' [-Wimplicit-function-declaration]
newlib\syscalls.c: In function '_write_r':
newlib\syscalls.c:169:2: warning: implicit declaration of function 'write' [-Wimplicit-function-declaration]

编译Finsh的时候有个warning:
Finsh\src\shell.c:279:4: warning: implicit declaration of function 'memcpy' [-Wimplicit-function-declaration]

我的编译参数上有什么问题吗?

如果不添加newlib部分,直接编译全部都可以过,但最后link的时候报错:
Debug\shell.o: In function `finsh_system_init':
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:484: undefined reference to `__fsymtab_start'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:484: undefined reference to `__fsymtab_start'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:484: undefined reference to `__fsymtab_end'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:484: undefined reference to `__fsymtab_end'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:485: undefined reference to `__vsymtab_start'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:485: undefined reference to `__vsymtab_start'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:485: undefined reference to `__vsymtab_end'
C:\Users\Administrator\Desktop\STM32F4_RTT/Finsh\src/shell.c:485: undefined reference to `__vsymtab_end'
Debug\startup.o: In function `rtthread_startup':
C:\Users\Administrator\Desktop\STM32F4_RTT/User\src/startup.c:88: undefined reference to `__bss_end'
C:\Users\Administrator\Desktop\STM32F4_RTT/User\src/startup.c:88: undefined reference to `__bss_end'

用的是ST官方库里带的linker文件,问题是出在这个文件上吗?
另外提个建议,GCC部分能不能用稍微通行点的IDE,eclipse+gnu arm plugin不是很好嘛,也不用写makefile啊。

出0入0汤圆

 楼主| 发表于 2012-2-15 18:27:14 | 显示全部楼层
我现在把-fno-builtin这个参数去掉了,newlib和minilibc也删掉了,这个是原来为了使用自己的printf函数加进去的,因为没看到f4的linker文件,用了f1的linker文件可以编译成功。
但是烧进去根本不跑,编译过程中那个memcpy函数还是报错,因为和工具链中的newlib自带的memcpy冲突了。

我是不是应该用RTT自带的newlib或者minilibc?如何保证工具链不调用自己的newlib而是用这两个其中的一个呢?

出0入0汤圆

发表于 2014-8-28 15:43:23 | 显示全部楼层
同样的问题

出0入0汤圆

发表于 2014-8-29 08:55:37 | 显示全部楼层
用SE+GCC,调试的问题如何解决?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-10 17:38

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表