一、遇到的问题
问题一
问题:使用OpenOCD里面的stlink烧录方式烧录时,出现烧录失败没反应的问题
配置
终端结尾输出
Open On-Chip Debugger 0.12.0-rc2-g7a1adfbec (2022-11-06-10:08)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.099104
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'program'
** OpenOCD init failed **
解决方法:修改stm32f1x.cfg 文件中的一行代码
1、找到文件位置
C:\Users\Administrator\.eide\tools\openocd_7a1adfbec_mingw32\share\openocd\scripts\target\stm32f1x.cfg
上面的 Administrator 要更换成 自己的用户名
2、打开文件,找到关键语句
3、修改语句内容
找到这个语句,将0x1ba01477 修改成 0x2ba01477 即可,保存关闭重新编译烧录就好了。
问题二
问题:烧录失败,程序卡住,编译和烧录显示不正常
1、有问题的编译终端输出
只有显示编译成功,没有输出其他的东西
2、有问题的烧录输出
Open On-Chip Debugger 0.12.0-rc2-g7a1adfbec (2022-11-06-10:08)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.099104
Info : [stm32f1x.cpu] Cortex-M3 r2p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
[stm32f1x.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000148 msp: 0x20000440
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000148 msp: 0x20000440
** Programming Started **
Error: couldn't open c:/Users/Administrator/Desktop/stm32_EIDE/RCT6/01_Project_demo/Projects/MDK-ARM/build/Template/std_103.hex
embedded:startup.tcl:1516: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1581
at file "embedded:startup.tcl", line 1516
上面其实就是最主要的一句,就是
Error: couldn't open c:/........./build/Template/std_103.hex
其实就是找不到头文件
解决方法:修改配置项即可
全局选项里面的 Use MicroLIB 勾选
链接器里面的不生成 Hex/Bin 文件 不勾选
然后点击右上角全部保存即可
1、没有问题的编译终端输出
2、没有问题的烧录输出
Open On-Chip Debugger 0.12.0-rc2-g7a1adfbec (2022-11-06-10:08)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1000 kHz
Info : STLINK V2J37S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.099104
Info : [stm32f1x.cpu] Cortex-M3 r2p1 processor detected
Info : [stm32f1x.cpu] target has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
[stm32f1x.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x08000148 msp: 0x20000440
[stm32f1x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000148 msp: 0x20000440
** Programming Started **
Info : device id = 0x000aa414
Info : flash size = 256 KiB
Warn : Adding extra erase range, 0x08001734 .. 0x080017ff
** Programming Finished **
** Verify Started **
** Verified OK **