標(biāo)題: 嘗試在Ubuntu中使用gcc-arm-none-eabi和標(biāo)準(zhǔn)庫(kù)開發(fā)stm32單片機(jī),但是出錯(cuò)了 [打印本頁(yè)]

作者: cien_s    時(shí)間: 2025-3-10 22:59
標(biāo)題: 嘗試在Ubuntu中使用gcc-arm-none-eabi和標(biāo)準(zhǔn)庫(kù)開發(fā)stm32單片機(jī),但是出錯(cuò)了
嘗試在Ubuntu中使用gcc-arm-none-eabi和標(biāo)準(zhǔn)庫(kù)開發(fā)stm32單片機(jī),但是報(bào)錯(cuò)了。使用的工具有gcc-arm-none-eabi,cmake,openocd。啟動(dòng)文件和鏈接腳本是在stm32f10x固件庫(kù)里面隨便找的,不知道是否是這里出了問(wèn)題。在stm32f103c8t6最小系統(tǒng)板燒錄了一個(gè)點(diǎn)亮pc13引腳的led的程序,燒錄成功但是燈沒(méi)亮,在gdb調(diào)試一直卡在0x20000004。我自己覺(jué)得還有一個(gè)可能是在編譯時(shí)出了問(wèn)題,因?yàn)樵谑褂胏make時(shí)也報(bào)了一些錯(cuò)誤,是文件找不到之類的,但是我后來(lái)加上了,然后也沒(méi)有報(bào)錯(cuò)。
(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


工程壓縮包附上了。希望有懂的人能夠不吝賜教,我對(duì)這方面不太了解,感謝你們的回復(fù)與幫助。 led.7z (226.13 KB, 下載次數(shù): 0)



作者: daemondong    時(shí)間: 2025-3-12 16:19
有l(wèi)inux版本stm32cubeide可以用,這個(gè)應(yīng)該方便點(diǎn)。
wwwstcomcn/zh/development-tools/stm32cubeide.html





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1