瑞萨MCU RA4M1 FLASH锁死问题记录
前言
最近接触了一块瑞萨的开发板RA4M1-EK,发现MDK烧录调试时打断点总是无法生效(要么不对,要么乱飞),启动时总会跳到莫名的汇编地址
问题记录
MDK烧录提示
Rebuild started: Project: LED
*** Using Compiler 'V6.19', folder: 'D:\software\MDK5.38\ARM\ARMCLANG\Bin'
Rebuild target 'Target_1'
Before Build - User command #1: cmd /c ""D:\renesas\fsp\ra4m1\led\rasc_launcher.bat" "D:\renesas\fsp\ra4m1\led\rasc_version.txt" -nosplash --launcher.suppressErrors --generate --compiler ARMv6 --devicefamily ra "D:\renesas\fsp\ra4m1\led\configuration.xml" 2> "%TEMP%\rasc_stderr.out" && echo. > "D:\renesas\fsp\ra4m1\led\output.rasc""
[INFO] Input file "D:\renesas\fsp\ra4m1\LED\configuration.xml" is older than output file "D:\renesas\fsp\ra4m1\LED\output.rasc". Skipping RASC invocation.
compiling hal_entry.c...
compiling bsp_guard.c...
compiling board_leds.c...
compiling bsp_sbrk.c...
compiling bsp_group_irq.c...
compiling board_init.c...
compiling bsp_macl.c...
compiling bsp_io.c...
compiling startup.c...
compiling bsp_ipc.c...
compiling bsp_delay.c...
compiling bsp_irq.c...
compiling bsp_common.c...
compiling bsp_register_protection.c...
compiling system.c...
compiling bsp_clocks.c...
compiling bsp_sdram.c...
compiling bsp_security.c...
compiling bsp_linker.c...
compiling hal_data.c...
compiling vector_data.c...
compiling pin_data.c...
compiling common_data.c...
compiling main.c...
compiling r_ioport.c...
linking...
Program Size: Code=2020 RO-data=464 RW-data=0 ZI-data=1124
FromELF: creating hex file...
After Build - User command #1: cmd /c ""D:\renesas\fsp\ra4m1\led\rasc_launcher.bat" "D:\renesas\fsp\ra4m1\led\rasc_version.txt" -nosplash --launcher.suppressErrors --gensmartbundle --compiler ARMv6 --devicefamily ra "D:\renesas\fsp\ra4m1\led\configuration.xml" "D:\renesas\fsp\ra4m1\led\Objects\LED.axf" 2> "%TEMP%\rasc_stderr.out""
[INFO] Input file "D:\renesas\fsp\ra4m1\led\Objects\LED.axf" is newer than output file "D:\renesas\fsp\ra4m1\LED\Objects\LED.sbd". Proceeding with RASC invocation...
Generating Smart Bundle..
".\Objects\LED.axf" - 0 Error(s), 0 Warning(s).
Build Time Elapsed: 00:00:09
Load "D:\\renesas\\fsp\\ra4m1\\led\\Objects\\LED.axf"
Set JLink Project File to "D:\renesas\fsp\ra4m1\led\JLinkSettings.ini"
* JLink Info: Device "R7FA4M1AB" selected.JLink info:
------------
DLL: V8.60 , compiled Aug 13 2025 12:04:02
Firmware: J-Link OB-S124 compiled Apr 1 2025 10:13:40
Hardware: V1.00
S/N : 831189195 * JLink Info: InitTarget() start
* JLink Info: Identifying target device...
* JLink Info: SWD selected. Executing JTAG -> SWD switching sequence...
* JLink Info: Initializing DAP...
* JLink Info: DAP initialized successfully.
* JLink Info: InitTarget() end - Took 22.9ms
* JLink Info: Found SW-DP with ID 0x5BA02477
* JLink Info: DPIDR: 0x5BA02477
* JLink Info: CoreSight SoC-400 or earlier
* JLink Info: Scanning AP map to find all available APs
* JLink Info: AP[2]: Stopped AP scan as end of AP map has been reached
* JLink Info: AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
* JLink Info: AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
* JLink Info: Iterating through AP map to find AHB-AP to use
* JLink Info: AP[0]: Core found
* JLink Info: AP[0]: AHB-AP ROM base: 0xE00FF000
* JLink Info: CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
* JLink Info: Found Cortex-M4 r0p1, Little endian.
* JLink Info: FPUnit: 6 code (BP) slots and 2 literal slots
* JLink Info: CoreSight components:
* JLink Info: ROMTbl[0] @ E00FF000
* JLink Info: [0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
* JLink Info: [0][1]: E0001000 CID B105E00D PID 003BB002 DWT
* JLink Info: [0][2]: E0002000 CID B105E00D PID 002BB003 FPB
* JLink Info: [0][3]: E0000000 CID B105E00D PID 003BB001 ITM
* JLink Info: [0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
* JLink Info: [0][5]: E0041000 CID B105900D PID 000BB925 ETM
* JLink Info: [0][6]: E0042000 CID B105900D PID 002BB908 CSTF
* JLink Info: [0][7]: E0043000 CID B105900D PID 001BB961 TMC
* JLink Info: [0][8]: E0044000 CID B105F00D PID 001BB101 TSG
ROMTableAddr = 0xE00FF000
* JLink Info: Reset type: NORMAL (https://wiki.segger.com/J-Link_Reset_Strategies)
* JLink Info: Reset: Halt core after reset via DEMCR.VC_CORERESET.
* JLink Info: Reset: Reset device via AIRCR.SYSRESETREQ.
* JLink Info: T-bit of XPSR is 0 but should be 1. Changed to 1.
* JLink Info: T-bit of XPSR is 0 but should be 1. Changed to 1.Target info:
------------
Device: R7FA4M1AB
VTarget = 3.300V
State of Pins:
TCK: 0, TDI: 1, TDO: 1, TMS: 1, TRES: 1, TRST: 255
Hardware-Breakpoints: 6
Software-Breakpoints: 8192
Watchpoints: 4
JTAG speed: 2000 kHz* JLink Info: Memory map 'after startup completion point' is active
* JLink Info: T-bit of XPSR is 0 but should be 1. Changed to 1.
* JLink Info: T-bit of XPSR is 0 but should be 1. Changed to 1.
Erase Failed!
Error: Flash Download failed - "Cortex-M4"
* JLink Info: OnDisconnectTarget() start
* JLink Info: OnDisconnectTarget() end - Took 17us
Flash Load finished at 08:45:44
手动用JFlashLite.exe烧录也提示失败
用RFP工具烧录也无济于事
硬件连线已经进入SCI Boot模式
EK板子上是内置了一块JLINK芯片的,RFP配置选择了jlink && SWD
另外V3.20版本的RFP没有看到相关初始化选项(瑞萨技术客服说正常连接时是可以看到的,不是版本的问题)
尝试仅擦除,不烧录,还是提示Error
UART烧录也会失败
最后瑞萨的技术支持说:这个情况只能换板子上的芯片了。(真是无语了,瑞萨的芯片居然这么脆弱!)