STM32
直播中

杨帆

8年用户 1472经验值
私信 关注
[问答]

STM32CubeIDE生成hex烧写报错的原因?

使用STM32CubeIDE 生成的ELF可以正常调试。但生成hex烧写则会出现以下的情况
Starting target CPU...
ERROR: Could not start CPU core. (ErrorCode: -1)
ERROR: Cannot read register 15 (R15) while CPU is running
Reading all registers
ERROR: Cannot read register 0 (R0) while CPU is running
ERROR: Cannot read register 1 (R1) while CPU is running
ERROR: Cannot read register 2 (R2) while CPU is running
ERROR: Cannot read register 3 (R3) while CPU is running

SEGGER J-Link GDB Server V6.80b Command Line Version


具体log如下
有知道的麻烦告知下,非常感谢

JLinkARM.dll V6.80b (DLL compiled Jun  5 2020 17:40:22)

Command line: -port 2331 -s -device STM32F413ZG -endian little -speed 200 -if swd -vd
-----GDB Server start settings-----
GDBInit file:                  none
GDB Server Listening port:     2331
SWO raw output listening port: 2332
Terminal I/O port:             2333
Accept remote connection:      localhost only
Generate logfile:              off
Verify download:               on
Init regs on start:            off
Silent mode:                   off
Single run mode:               on
Target connection timeout:     0 ms
------J-Link related settings------
J-Link Host interface:         USB
J-Link script:                 none
J-Link settings file:          none
------Target related settings------
Target device:                 STM32F413ZG
Target interface:              SWD
Target interface speed:        200kHz
Target endian:                 little

Connecting to J-Link...
J-Link is connected.
Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
Hardware: V8.00
S/N: 17935099
Feature(s): RDI,FlashDL,FlashBP,JFlash
Checking target voltage...
Target voltage: 3.14 V
Listening on TCP/IP port 2331
Connecting to target...
Connected to target
Waiting for GDB connection...Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000596 (Data = 0xF8A7F000)
Read 2 bytes @ address 0x08000596 (Data = 0xF000)
Connected to 127.0.0.1
Reading all registers
Read 4 bytes @ address 0x08000596 (Data = 0xF8A7F000)
Read 2 bytes @ address 0x08000596 (Data = 0xF000)
Received monitor command: WriteDP 0x2 0xF0
O.K.
Received monitor command: ReadAP 0x2
O.K.:0xE00FF003
Reading 32 bytes @ address 0xE00FFFD0
Received monitor command: reset
Resetting target
Read 4 bytes @ address 0x08000682 (Data = 0x00004770)
Read 2 bytes @ address 0x08000682 (Data = 0x4770)
Read 4 bytes @ address 0x08000682 (Data = 0x00004770)
Read 2 bytes @ address 0x08000682 (Data = 0x4770)
Downloading 3372 bytes @ address 0x08000000 - Verified OK
Writing register (PC = 0x 800064c)
Read 4 bytes @ address 0x0800064C (Data = 0xD034F8DF)
Read 2 bytes @ address 0x0800064C (Data = 0xF8DF)
Read 4 bytes @ address 0x08000682 (Data = 0x00004770)
Read 2 bytes @ address 0x08000682 (Data = 0x4770)
Read 4 bytes @ address 0x08000682 (Data = 0x00004770)
Read 2 bytes @ address 0x08000682 (Data = 0x4770)
Read 4 bytes @ address 0xE000ED14 (Data = 0x00000200)
Downloading 4 bytes @ address 0xE000ED14 - Verified OK
Reading all registers
Read 4 bytes @ address 0x0800064C (Data = 0xD034F8DF)
Read 2 bytes @ address 0x0800064C (Data = 0xF8DF)
WARNING: Failed to read memory @ address 0xFFFFFFFE
WARNING: Failed to read memory @ address 0xFFFFFFFE
Read 4 bytes @ address 0xE000EDFC (Data = 0x00000000)
Downloading 4 bytes @ address 0xE000EDFC - Verified OK
Reading all registers
Read 4 bytes @ address 0x0800064C (Data = 0xD034F8DF)
Read 2 bytes @ address 0x0800064C (Data = 0xF8DF)
Starting target CPU...
ERROR: Could not start CPU core. (ErrorCode: -1)
ERROR: Cannot read register 15 (R15) while CPU is running
Reading all registers
ERROR: Cannot read register 0 (R0) while CPU is running
ERROR: Cannot read register 1 (R1) while CPU is running
ERROR: Cannot read register 2 (R2) while CPU is running
ERROR: Cannot read register 3 (R3) while CPU is running
ERROR: Cannot read register 4 (R4) while CPU is running
ERROR: Cannot read register 5 (R5) while CPU is running
ERROR: Cannot read register 6 (R6) while CPU is running
ERROR: Cannot read register 7 (R7) while CPU is running
ERROR: Cannot read register 8 (R8) while CPU is running




回帖(1)

邹俩珍

2024-4-9 18:12:26
这种错误通常是由于烧写过程中与目标设备的通信失败引起的。可能的原因包括以下几点:

1. 连接问题:确保目标设备正确连接到烧写器上,并且连接正常。检查USB连接或者JTAG/SWD接口是否有松动或损坏。

2. 目标设备的复位问题:检查目标设备的复位电路是否工作正常。复位信号可能需要从烧写器发送给目标设备,以使其进入烧写模式。

3. 烧写器设置问题:检查烧写器的配置参数是否与目标设备的要求相匹配。可能需要在烧写工具中手动指定目标设备型号、连接接口等设置。

4. 软件问题:确保使用的烧写工具软件是最新版本,并且与使用的IDE兼容。尝试更新烧写工具软件或者使用其他烧写工具进行测试。

如果上述方法仍然无法解决问题,建议参考烧写工具和IDE的手册,查找相关错误代码的具体含义,或者联系供应商的技术支持寻求帮助。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分