开发环境:野火的stm32f407,
rt-thread studio版本是版本: 2.2.6,
stm32f4的资源包为0.2.2,
stlink使用正点原子的。
可以下载,不能在线调试。
下载:
在线调试,仿真:
控制台信息如下:
STMicroelectronics ST-LINK GDB server. Version 7.0.0
Copyright (c) 2022, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
LogFile Name : debug.log
Logging Level : 31
Listen Port Number : 61235
Status Refresh Delay : 15s
Verbose Mode : Disabled
COM frequency = 9000 kHz
Target connection mode: Default
Reading ROM table for AP 0 @0xe00fffd0
Hardware watchpoint supported by the target
ST-LINK Firmware version : V2J40S7
Device ID: 0x413
PC: 0x1fff4bcc
ST-LINK device status: HALT_MODE
ST-LINK detects target voltage = 3.14 V
ST-LINK device status: HALT_MODE
Stm32Device, pollAndNotify running...
ST-LINK device initialization OK
SwvSrv state change: 0 -> 1
Waiting for connection on port 61236...
Waiting for debugger connection...
Waiting for connection on port 61235...
Accepted connection on port 61235...
Debugger connected
Waiting for debugger connection...
Waiting for connection on port 61235...
GDB session thread running
GdbSessionManager, session started: 1
Wrapping read detected. Addr: 0xffffffff; Length: 4
Wrapping read detected. Addr: 0xffffffff; Length: 4
Stm32Device, closeDevice() entry
GDB session, device event: 5
Stm32Device, pollAndNotify stopped
Stm32Device, closeDevice() exit
------ Switching to STM32CubeProgrammer -----
-------------------------------------------------------------------
STM32CubeProgrammer v2.11.0
-------------------------------------------------------------------
Log output file: C:\Users\AppData\Local\Temp\STM32CubeProgrammer_a04772.log
ST-LINK SN : 2D3575120303512030303032
ST-LINK FW : V2J40S7
Board : --
Voltage : 3.14V
JTAG freq : 9000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x413
Revision ID : Rev Y
Device name : STM32F405xx/F407xx/F415xx/F417xx
Flash size : 1 MBytes (default)
Device type : MCU
Device CPU : Cortex-M4
BL Version : --
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a04772.srec
File : ST-LINK_GDB_server_a04772.srec
Size : 55.10 KB
Address : 0x08000000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 3]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:03.892
------ Switching context -----
COM frequency = 9000 kHz
Target connection mode: Default
Reading ROM table for AP 0 @0xe00fffd0
Hardware watchpoint supported by the target
ST-LINK Firmware version : V2J40S7
Device ID: 0x413
PC: 0x1fff4bcc
ST-LINK detects target voltage = 3.14 V
ST-LINK device status: HALT_MODE
Stm32Device, pollAndNotify running...
GDB session, device event: 6
Enter STM32_SystemReset() function
Enter STM32_InitAfterReset() function
NVIC_DFSR_REG = 0x00000008
NVIC_CFGFSR_REG = 0x00000000
GDB session, device event: 3
GDB session, device event: 1
ST-LINK device status: RUN_MODE
试一下这个方法,我也是遇到这个一模一样的问题了,使用这个方法成功解决了!
在startup_stm32l475xx.S文件中,第97行bl __libc_init_array这行代码注释掉!!
注:startup_stm32l475xx.S
文件路径为rtt_demo_io\libraries\CMSIS\Device\ST\STM32L4xx\Source\Templates\gcc
👍。我这情况和板子的串口打印有关,测试发现,用原子的串口工具打开调试口,就可以调试了。
不太行呀,正点的板子,调试有时好使,有时不好使