[SOLVED] Debug session unexpectedly silently fails to flash target (STM32H7) ("RAM check failed")

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Debug session unexpectedly silently fails to flash target (STM32H7) ("RAM check failed")

    Hi all!

    I are developing software for an ST STM32H7* based MCU.

    Unfortunately flashing the target using a J-Link Ultra+ debugger probe fails to flash the target.

    I don't think it's relevant but I am using the CLion IDE and have added the GDB server from STM32CubeIDE:

    GDB Server: C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.jlink.win32_2.1.0.202204211145\tools\bin\JLinkGDBServerCL.exe

    GSB Server args: -device "STM32H7[...]" -if swd -speed 24000 -port 45102 -nogui -singlerun


    Here's the command line output (marked as source code for bette readability):

    Source Code

    1. C:\ST\STM32CubeIDE_1.8.0\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.jlink.win32_2.1.0.202204211145\tools\bin\JLinkGDBServerCL.exe -device STM32H7[...] -if swd -speed 24000 -port 45102 -nogui -singlerun
    2. SEGGER J-Link GDB Server V7.66 Command Line Version
    3. JLinkARM.dll V7.66 (DLL compiled May 18 2022 15:52:58)
    4. Command line: -device STM32H7[...] -if swd -speed 24000 -port 45102 -nogui -singl
    5. erun
    6. -----GDB Server start settings-----
    7. GDBInit file: none
    8. GDB Server Listening port: 45102
    9. SWO raw output listening port: 2332
    10. Terminal I/O port: 2333
    11. Accept remote connection: localhost only
    12. Generate logfile: off
    13. Verify download: off
    14. Init regs on start: off
    15. Silent mode: off
    16. Single run mode: on
    17. Target connection timeout: 0 ms
    18. ------J-Link related settings------
    19. J-Link Host interface: USB
    20. J-Link script: none
    21. J-Link settings file: none
    22. ------Target related settings------
    23. Target device: STM32H7[...]
    24. Target interface: SWD
    25. Target interface speed: 24000kHz
    26. Target endian: little
    27. Connecting to J-Link...
    28. J-Link is connected.
    29. Firmware: J-Link Ultra V5-1 compiled May 2 2022 09:00:17
    30. Hardware: V5.10
    31. S/N: [...]
    32. Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    33. Checking target voltage...
    34. Target voltage: 3.36 V
    35. Listening on TCP/IP port 45102
    36. Connecting to target...
    37. Connected to target
    38. Waiting for GDB connection...Connected to 127.0.0.1
    39. Reading all registers
    40. Reading 64 bytes @ address 0x080352C0
    41. Read 4 bytes @ address 0x08035574 (Data = 0xE000ED00)
    42. Read 2 bytes @ address 0x08035448 (Data = 0xF7DB)
    43. Read 2 bytes @ address 0x080362A4 (Data = 0xB508)
    44. Read 2 bytes @ address 0x08057DE4 (Data = 0x4770)
    45. Read 4 bytes @ address 0x0802B814 (Data = 0xD1E12B00)
    46. Downloading 664 bytes @ address 0x08000000
    47. Downloading 16000 bytes @ address 0x080002A0
    48. Downloading 16048 bytes @ address 0x08004120
    49. Downloading 16048 bytes @ address 0x08007FD0
    50. Downloading 15792 bytes @ address 0x0800BE80
    51. Downloading 16080 bytes @ address 0x0800FC30
    52. Downloading 16064 bytes @ address 0x08013B00
    53. Downloading 15920 bytes @ address 0x080179C0
    54. Downloading 16112 bytes @ address 0x0801B7F0
    55. Downloading 16032 bytes @ address 0x0801F6E0
    56. Downloading 15936 bytes @ address 0x08023580
    57. Downloading 15888 bytes @ address 0x080273C0
    58. Downloading 15856 bytes @ address 0x0802B1D0
    59. Downloading 15888 bytes @ address 0x0802EFC0
    60. Downloading 15952 bytes @ address 0x08032DD0
    61. Downloading 16000 bytes @ address 0x08036C20
    62. Downloading 16128 bytes @ address 0x0803AAA0
    63. Downloading 16160 bytes @ address 0x0803E9A0
    64. Downloading 16032 bytes @ address 0x080428C0
    65. Downloading 16096 bytes @ address 0x08046760
    66. Downloading 16112 bytes @ address 0x0804A640
    67. Downloading 16048 bytes @ address 0x0804E530
    68. Downloading 15920 bytes @ address 0x080523E0
    69. Downloading 10288 bytes @ address 0x08056210
    70. Downloading 16352 bytes @ address 0x08058A40
    71. Downloading 16272 bytes @ address 0x0805CA20
    72. Downloading 8196 bytes @ address 0x080609B0
    73. Downloading 3932 bytes @ address 0x080629B4
    74. Downloading 3344 bytes @ address 0x08063910
    75. Downloading 36 bytes @ address 0x08064620
    76. Downloading 4 bytes @ address 0x08064644
    77. Downloading 1296 bytes @ address 0x08064648
    78. ERROR: Failed to prepare for programming.
    79. RAM check failed @ addr 0x24000F78.
    80. RAM check failed while testing 0x1FF0 bytes @ addr 0x240007C4.
    81. Writing register (PC = 0x 8033da8)
    82. Reading 64 bytes @ address 0x080352C0
    83. Read 4 bytes @ address 0x08035574 (Data = 0xE000ED00)
    84. Read 2 bytes @ address 0x08035448 (Data = 0xF7DB)
    85. Read 2 bytes @ address 0x080362A4 (Data = 0xB508)
    86. Read 2 bytes @ address 0x08057DE4 (Data = 0x4770)
    87. Received monitor command: reset
    88. Resetting target
    89. Resetting target
    90. Debugger connected to tcp::45102
    91. Setting breakpoint @ address 0x08035448, Size = 2, BPHandle = 0x0001
    92. Starting target CPU...
    93. ...Breakpoint reached @ address 0x08035448
    94. Reading all registers
    95. Removing breakpoint @ address 0x08035448, Size = 2
    96. Read 4 bytes @ address 0x08035448 (Data = 0xFE08F7DB)
    97. Reading 64 bytes @ address 0x2405FBC0
    98. Read 4 bytes @ address 0x08033DDE (Data = 0xFC004770)
    99. Reading 64 bytes @ address 0x08033D80
    100. Read 4 bytes @ address 0x08033DE0 (Data = 0x2405FC00)
    Display All
    (I've manually removed the specific STM32H7 model and my J-Link debugger probe's S/N.)



    The relevant part:

    J-Link GDB wrote:

    ERROR: Failed to prepare for programming.
    RAM check failed @ addr 0x24000F78.
    RAM check failed while testing 0x1FF0 bytes @ addr 0x240007C4.
    GDB the continues to start the debug session. So it kind of fails silently without having flashed my new code.


    I want to use the J-Link for both debug-stepping and tracing (using RTT and Percepio Tracealyzer).


    My current workaround:
    • flash using an ST-Link debugger probe
    • debug & trace using the J-Link debugger probe.
    That's quite tedious and I'd like to fix this.


    Unfortunately, I've no idea what could go wrong - I don't really think that the MCU's internal RAM is broken. I'd like to believe that flashing using the J-Link Ultra+ and the same GDB server has worked previously -- but I am not too sure at the moment.

    Please let me know if I can/should provide any further details.

    Cheers,
    mwb
  • It doesn't really help but I was experiencing similar issues with an STM32F4:
    [ABANDONED] JlinkExe erase Command fails with RAM check

    I couldn't solve this. Flashing worked for me (with the automatically included page erases). However, a manual dedicated flash erase always failed. I also don't think anything is wrong with your controller. We initially thought that too and conducted some memory tests on the STM with no result of an corrupt memory cell.
  • Hi Shino,

    thanks for your post.

    The following setting in the CLion GDB run/debug configuration seems to do the trick:



    From the console:

    Brainfuck Source Code

    1. Waiting for GDB connection...Connected to 127.0.0.1
    2. Reading all registers
    3. Reading 64 bytes @ address 0x080352C0
    4. Read 4 bytes @ address 0x08035574 (Data = 0xE000ED00)
    5. ...
    6. Read 4 bytes @ address 0x0802B730 (Data = 0xD9072B01)
    7. Reading 64 bytes @ address 0x24002F40
    8. Read 4 bytes @ address 0x0802F25C (Data = 0xB082B580)
    9. Received monitor command: reset
    10. Resetting target
    11. Resetting target
    12. Downloading 664 bytes @ address 0x08000000
    13. Downloading 16000 bytes @ address 0x080002A0
    14. ...
    15. Downloading 36 bytes @ address 0x08064620
    16. Downloading 4 bytes @ address 0x08064644
    17. Downloading 1296 bytes @ address 0x08064648
    18. Comparing flash [....................] Done.
    19. Writing register (PC = 0x 8033da8)
    20. Reading 64 bytes @ address 0x080352C0
    21. Read 4 bytes @ address 0x08035574 (Data = 0xE000ED00)
    22. ...
    Display All

    HTH,
    mwb