嘗試在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)
2025-3-10 22:59 上傳
點擊文件名下載附件
|