[ABANDONED] STM32CubeIDE and J-Trace not working as expected

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

  • [ABANDONED] STM32CubeIDE and J-Trace not working as expected

    I have had a lingering issue that rears its ugly head from time to time and is a huge productivity killer. I honestly cannot say what triggers the issue, or how to fix it. It is becoming too big of an issue to continue development with the system like this.
    Hardware used:

    -STM32F746BG
    -Seggar J-Trace (SWD @ 4000kHz) or ST-Link
    When using my J-Trace from within STM32CubeIDE I get this output in the console window:

    Source Code

    1. SEGGER J-Link GDB Server V6.62 Command Line Version
    2. JLinkARM.dll V6.62 (DLL compiled Jan 24 2020 16:32:09)
    3. Command line: -port 2331 -s -device STM32F746BG -endian little -speed 12000 -if swd -vd
    4. -----GDB Server start settings-----
    5. GDBInit file: none
    6. GDB Server Listening port: 2331
    7. SWO raw output listening port: 2332
    8. Terminal I/O port: 2333
    9. Accept remote connection: localhost only
    10. Generate logfile: off
    11. Verify download: on
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: on
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: none
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: STM32F746BG
    22. Target interface: SWD
    23. Target interface speed: 12000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Trace PRO V2 Cortex-M compiled Jan 7 2020 16:54:03
    28. Hardware: V2.00
    29. S/N: 752001379
    30. Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    31. Checking target voltage...
    32. Target voltage: 3.27 V
    33. Listening on TCP/IP port 2331
    34. Connecting to target...
    35. Connected to target
    36. Waiting for GDB connection...Connected to 127.0.0.1
    37. Reading all registers
    38. Read 4 bytes @ address 0x08001A42 (Data = 0xE7FEE7FE)
    39. Read 2 bytes @ address 0x08001A42 (Data = 0xE7FE)
    40. WARNING: Failed to read memory @ address 0x00036770
    41. Connected to 127.0.0.1
    42. Reading all registers
    43. WARNING: Failed to read memory @ address 0x00036770
    44. Read 4 bytes @ address 0x08001A42 (Data = 0xE7FEE7FE)
    45. Read 2 bytes @ address 0x08001A42 (Data = 0xE7FE)
    46. Received monitor command: WriteDP 0x2 0x000000F0
    47. O.K.
    48. Received monitor command: ReadAP 0x2
    49. O.K.:0xE00FD003
    50. Reading 32 bytes @ address 0xE00FDFD0
    51. Received monitor command: reset
    52. Resetting target
    53. Downloading 12 bytes @ address 0x00008000 - Verify failed
    54. Downloading 16064 bytes @ address 0x00008010 - Verify failed
    55. Downloading 16000 bytes @ address 0x0000BED0 - Verify failed
    56. Downloading 16000 bytes @ address 0x0000FD50 - Verify failed
    57. Downloading 16144 bytes @ address 0x00013BD0 - Verify failed
    58. Downloading 16176 bytes @ address 0x00017AE0 - Verify failed
    59. Downloading 16208 bytes @ address 0x0001BA10 - Verify failed
    60. Downloading 16240 bytes @ address 0x0001F960 - Verify failed
    61. Downloading 16096 bytes @ address 0x000238D0 - Verify failed
    62. Downloading 16128 bytes @ address 0x000277B0 - Verify failed
    63. Downloading 16048 bytes @ address 0x0002B6B0 - Verify failed
    64. Downloading 16112 bytes @ address 0x0002F560 - Verify failed
    65. Downloading 16096 bytes @ address 0x00033450 - Verify failed
    66. Downloading 15984 bytes @ address 0x00037330 - Verify failed
    67. Downloading 9324 bytes @ address 0x0003B1A0 - Verify failed
    68. Downloading 12 bytes @ address 0x0003D60C - Verify failed
    69. Downloading 16280 bytes @ address 0x0003D618 - Verify failed
    70. Downloading 16288 bytes @ address 0x000415B0 - Verify failed
    71. Downloading 1045 bytes @ address 0x00045550 - Verify failed
    72. Downloading 15146 bytes @ address 0x00045968 - Verify failed
    73. Downloading 15884 bytes @ address 0x00049494 - Verify failed
    74. Downloading 15776 bytes @ address 0x0004D2A0 - Verify failed
    75. Downloading 16048 bytes @ address 0x00051040 - Verify failed
    76. Downloading 16320 bytes @ address 0x00054EF0 - Verify failed
    77. Downloading 16352 bytes @ address 0x00058EB0 - Verify failed
    78. Downloading 16352 bytes @ address 0x0005CE90 - Verify failed
    79. Downloading 16320 bytes @ address 0x00060E70 - Verify failed
    80. Downloading 16336 bytes @ address 0x00064E30 - Verify failed
    81. Downloading 16336 bytes @ address 0x00068E00 - Verify failed
    82. Downloading 16144 bytes @ address 0x0006CDD0 - Verify failed
    83. Downloading 15888 bytes @ address 0x00070CE0 - Verify failed
    84. Downloading 15936 bytes @ address 0x00074AF0 - Verify failed
    85. Downloading 16064 bytes @ address 0x00078930 - Verify failed
    86. Downloading 16288 bytes @ address 0x0007C7F0 - Verify failed
    87. Downloading 16368 bytes @ address 0x00080790 - Verify failed
    88. Downloading 16368 bytes @ address 0x00084780 - Verify failed
    89. Downloading 16368 bytes @ address 0x00088770 - Verify failed
    90. Downloading 16368 bytes @ address 0x0008C760 - Verify failed
    91. Downloading 16368 bytes @ address 0x00090750 - Verify failed
    92. Downloading 14532 bytes @ address 0x00094740 - Verify failed
    93. Downloading 9756 bytes @ address 0x00098004 - Verify failed
    94. Downloading 8 bytes @ address 0x0009A620 - Verify failed
    95. Downloading 4 bytes @ address 0x0009A628 - Verify failed
    96. Downloading 24 bytes @ address 0x000AA62C - Verify failed
    97. Downloading 8 bytes @ address 0x000AA644 - Verify failed
    98. Downloading 3016 bytes @ address 0x000AA650 - Verify failed
    99. Writing register (PC = 0x 80a4)
    100. WARNING: Failed to read memory @ address 0x00036770
    101. WARNING: Failed to read memory @ address 0x000080A4
    102. Read 4 bytes @ address 0xE000ED14 (Data = 0x00040200)
    103. Downloading 4 bytes @ address 0xE000ED14 - Verified OK
    104. Reading all registers
    105. WARNING: Failed to read memory @ address 0x000080A4
    106. Read 4 bytes @ address 0xE000EDFC (Data = 0x01000000)
    107. Downloading 4 bytes @ address 0xE000EDFC - Verified OK
    108. Reading all registers
    109. WARNING: Failed to read memory @ address 0x000080A4
    110. Reading 64 bytes @ address 0x0000C180
    111. WARNING: Failed to read memory @ address 0x0000C180
    112. WARNING: Failed to read memory @ address 0x0000C182
    113. Reading 64 bytes @ address 0x0000C180
    114. WARNING: Failed to read memory @ address 0x0000C180
    115. WARNING: Failed to read memory @ address 0x0000C182
    116. WARNING: Failed to read memory @ address 0x0000C17C
    117. Setting breakpoint @ address 0x0000C17C, Size = 2, BPHandle = 0x0001
    118. Starting target CPU...
    119. ...Target halted (Vector catch, PC = 0x08001A42)
    120. Reading all registers
    121. Removing breakpoint @ address 0x0000C17C, Size = 2
    122. Read 4 bytes @ address 0x08001A42 (Data = 0xE7FEE7FE)
    123. Read 2 bytes @ address 0x08001A42 (Data = 0xE7FE)
    124. Read 4 bytes @ address 0x2004FFFC (Data = 0x01000000)
    125. Reading 64 bytes @ address 0x2004FFC0
    126. WARNING: Failed to read memory @ address 0x000080A4
    127. GDB closed TCP/IP connection
    128. GDB closed TCP/IP connection
    129. Restoring target state and closing J-Link connection...
    Display All
    If you look at the J-Trace log, clearly the verification of the downloaded bytes is failing, why is STM32CubeIDE telling the J-Trace to write to address 0x00008000? It looks like this address has been shifted right 3. The normal programming address is 0x08000000. Super strange and I have no idea how to fix this problem. In total this has probably caused me 2 weeks of development work dealing with it on and off, losing work as I am forced to revert to older code bases to get away from the issue (sometimes even this doesn't help), like right now, im too far off in a branch to revert, I would lose a months worth of work.

    I have noticed that the log says, "SEGGER J-Link GDB Server V6.62 Command Line Version" but I have installed V6.64. How would i go about updating the STM32CubeIDE's version of the j-link GDB server?

    I seem to be able to manually flash a bin or hex file with my J-Trace without issue using the J-Link Commander application provided by Segger. Also other projects work while this one is failing.

    Help would be appreciated here, every minute counts as my project is on a stupidly strict schedule.

    Regards,

    James
  • You could check it either with flashing via gdb, look at "readelf -a your_file.elf | less" if the sections are at right address or trying the stm32loader. The stm32loader expects that you have UART connection to the MCU and that MCU is in bootROM mode (stm32loader can pull the bootROM-enable pins if you have configured it and have them connected, or you connect the pins manually). STM32CubeIDE also uses the same way if you flash via UART.

    With stm32loader you can specify the address manually with -a option (which defaults to 0x0800000) which could avoid your predicament. Converting .elf to .bin can be done via "arm-none-eabi-objcopy".

    OpenOCD could be an option, but for me it never worked with JTrace.
  • Hi James,

    This is how we tested CubeIDE and it worked for us:
    wiki.segger.com/STM32CubeIDE
    Did you setup the CubeIDE like this?

    If I understand you correctly, this issue is not occurring consistently. Correct?
    If so, then it is most likely a CubeIDE issue.
    I would suggest to contact ST about this.

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.