找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 969|回复: 1
打印 上一主题 下一主题
收起左侧

尝试在Ubuntu中使用gcc-arm-none-eabi和标准库开发stm32单片机,但是出错了

[复制链接]
跳转到指定楼层
楼主
ID:1143673 发表于 2025-3-10 22:59 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
尝试在Ubuntu中使用gcc-arm-none-eabi和标准库开发stm32单片机,但是报错了。使用的工具有gcc-arm-none-eabi,cmake,openocd。启动文件和链接脚本是在stm32f10x固件库里面随便找的,不知道是否是这里出了问题。在stm32f103c8t6最小系统板烧录了一个点亮pc13引脚的led的程序,烧录成功但是灯没亮,在gdb调试一直卡在0x20000004。我自己觉得还有一个可能是在编译时出了问题,因为在使用cmake时也报了一些错误,是文件找不到之类的,但是我后来加上了,然后也没有报错。
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x20000004 in completed ()
(gdb) n
Single stepping until exit from function completed.1,
which has no line number information.
halted: PC: 0x20000004
halted: PC: 0x20000004
halted: PC: 0x20000004
halted: PC: 0x20000004
halted: PC: 0x20000004
halted: PC: 0x20000004
halted: PC: 0x20000004
(gdb) load STM32Project.elf
Loading section .text, size 0x174 lma 0x8000000
Loading section .init_array, size 0x8 lma 0x8000174
Loading section .fini_array, size 0x4 lma 0x800017c
Loading section .data, size 0x4 lma 0x8000180
Start address 0x08000000, load size 388
Transfer rate: 1 KB/sec, 97 bytes/write.
(gdb) info registers pc
pc             0x8000000           0x8000000 <deregister_tm_clones>
(gdb) n
warning: Invalid state, unable to determine sp alias, assuming msp.
Single stepping until exit from function deregister_tm_clones,
which has no line number information.
halted: PC: 0x08000002
halted: PC: 0x08000004
halted: PC: 0x08000006
halted: PC: 0x0800000e
halted: PC: 0x20000004
0x20000004 in completed ()
编译成功后有警告
[ 96%] Building C object CMakeFiles/STM32Project.elf.dir/src/system_stm32f10x.c.o
[100%] Linking C executable STM32Project.elf
/home/cien/桌面/gcc-arm-tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol Reset_Handler; defaulting to 08000000
/home/cien/桌面/gcc-arm-tool/gcc-arm-none-eabi/bin/../lib/gcc/arm-none-eabi/14.2.1/../../../../arm-none-eabi/bin/ld: warning: STM32Project.elf has a LOAD segment with RWX permissions


工程压缩包附上了。希望有懂的人能够不吝赐教,我对这方面不太了解,感谢你们的回复与帮助。 led.7z (226.13 KB, 下载次数: 0)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:827243 发表于 2025-3-12 16:19 | 只看该作者
有linux版本stm32cubeide可以用,这个应该方便点。
wwwstcomcn/zh/development-tools/stm32cubeide.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

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