[SOLVED] JLink target fails to read registers or halt processor when running in BOTH Virtual Box and VMWare Workstation PRO

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

  • [SOLVED] JLink target fails to read registers or halt processor when running in BOTH Virtual Box and VMWare Workstation PRO

    I'm able to debug my NXP MIMXRT1051 perfectly fine when running natively on linux and windows, however when using Virtual Box Virtual Box OR VMWare Workstation PRO (Ubuntu 18.04 guest with
    4.18.0-21-generic kernel) I get the following error when using the JLinkGDBServer


    Source Code

    1. SEGGER J-Link GDB Server V6.46c Command Line Version
    2. JLinkARM.dll V6.46c (DLL compiled Jun 3 2019 18:36:33)
    3. Command line: -if SWD -device MIMXRT1051CVL5B -port 2331 -settingsfile settings.jlink
    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: yes
    10. Generate logfile: off
    11. Verify download: off
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: off
    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: settings.jlink
    20. ------Target related settings------
    21. Target device: MIMXRT1051CVL5B
    22. Target interface: SWD
    23. Target interface speed: 4000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Link V10 compiled May 27 2019 15:48:59
    28. Hardware: V10.10
    29. S/N: 50121504
    30. Feature(s): GDB
    31. Checking target voltage...
    32. Target voltage: 3.25 V
    33. Listening on TCP/IP port 2331
    34. Connecting to target...Connected to target
    35. Waiting for GDB connection...Connected to 127.0.0.1
    36. Reading all registers
    37. Read 4 bytes @ address 0x600097AC (Data = 0x0000E7F9)
    38. Read 2 bytes @ address 0x600097AC (Data = 0xE7F9)
    39. Received monitor command: reset
    40. Resetting target
    41. Received monitor command: halt
    42. Halting target CPU...
    43. WARNING: CPU could not be halted
    44. ERROR: Can not read register 15 (R15) while CPU is running
    45. ...Target halted (PC = 0x00000000)
    46. Downloading 1024 bytes @ address 0x00000000
    47. Downloading 15968 bytes @ address 0x00000400
    48. Downloading 16112 bytes @ address 0x00004260
    49. Downloading 16080 bytes @ address 0x00008150
    50. Downloading 16192 bytes @ address 0x0000C020
    51. Downloading 8912 bytes @ address 0x0000FF60
    52. Downloading 8 bytes @ address 0x00012230
    53. Downloading 4 bytes @ address 0x00012238
    54. Downloading 4 bytes @ address 0x0001223C
    55. Downloading 156 bytes @ address 0x00012240
    56. Writing register (PC = 0x 4b4)
    57. Starting target CPU...
    58. ERROR: CPU is not halted
    59. ERROR: Can not read register 15 (R15) while CPU is running
    60. Reading all registers
    61. ERROR: Can not read register 0 (R0) while CPU is running
    62. ERROR: Can not read register 1 (R1) while CPU is running
    63. ERROR: Can not read register 2 (R2) while CPU is running
    64. ERROR: Can not read register 3 (R3) while CPU is running
    65. ERROR: Can not read register 4 (R4) while CPU is running
    66. ERROR: Can not read register 5 (R5) while CPU is running
    67. ERROR: Can not read register 6 (R6) while CPU is running
    68. ERROR: Can not read register 7 (R7) while CPU is running
    69. ERROR: Can not read register 8 (R8) while CPU is running
    70. ERROR: Can not read register 9 (R9) while CPU is running
    71. ERROR: Can not read register 10 (R10) while CPU is running
    72. ERROR: Can not read register 11 (R11) while CPU is running
    73. ERROR: Can not read register 12 (R12) while CPU is running
    74. ERROR: Can not read register 13 (R13) while CPU is running
    75. ERROR: Can not read register 14 (R14) while CPU is running
    76. ERROR: Can not read register 15 (R15) while CPU is running
    77. ERROR: Can not read register 16 (XPSR) while CPU is running
    78. ERROR: Can not read register 17 (MSP) while CPU is running
    79. ERROR: Can not read register 18 (PSP) while CPU is running
    80. ERROR: Can not read register 24 (PRIMASK) while CPU is running
    81. ERROR: Can not read register 25 (BASEPRI) while CPU is running
    82. ERROR: Can not read register 26 (FAULTMASK) while CPU is running
    83. ERROR: Can not read register 27 (CONTROL) while CPU is running
    84. ERROR: Can not read register 32 (FPSCR) while CPU is running
    85. ERROR: Can not read register 33 (FPS0) while CPU is running
    86. ERROR: Can not read register 34 (FPS1) while CPU is running
    87. ERROR: Can not read register 35 (FPS2) while CPU is running
    88. ERROR: Can not read register 36 (FPS3) while CPU is running
    89. ERROR: Can not read register 37 (FPS4) while CPU is running
    90. ERROR: Can not read register 38 (FPS5) while CPU is running
    91. ERROR: Can not read register 39 (FPS6) while CPU is running
    92. ERROR: Can not read register 40 (FPS7) while CPU is running
    93. ERROR: Can not read register 41 (FPS8) while CPU is running
    94. ERROR: Can not read register 42 (FPS9) while CPU is running
    95. ERROR: Can not read register 43 (FPS10) while CPU is running
    96. ERROR: Can not read register 44 (FPS11) while CPU is running
    97. ERROR: Can not read register 45 (FPS12) while CPU is running
    98. ERROR: Can not read register 46 (FPS13) while CPU is running
    99. ERROR: Can not read register 47 (FPS14) while CPU is running
    100. ERROR: Can not read register 48 (FPS15) while CPU is running
    101. ERROR: Can not read register 49 (FPS16) while CPU is running
    102. ERROR: Can not read register 50 (FPS17) while CPU is running
    103. ERROR: Can not read register 51 (FPS18) while CPU is running
    104. ERROR: Can not read register 52 (FPS19) while CPU is running
    105. ERROR: Can not read register 53 (FPS20) while CPU is running
    106. ERROR: Can not read register 54 (FPS21) while CPU is running
    107. ERROR: Can not read register 55 (FPS22) while CPU is running
    108. ERROR: Can not read register 56 (FPS23) while CPU is running
    109. ERROR: Can not read register 57 (FPS24) while CPU is running
    110. ERROR: Can not read register 58 (FPS25) while CPU is running
    111. ERROR: Can not read register 59 (FPS26) while CPU is running
    112. ERROR: Can not read register 60 (FPS27) while CPU is running
    113. ERROR: Can not read register 61 (FPS28) while CPU is running
    114. ERROR: Can not read register 62 (FPS29) while CPU is running
    115. ERROR: Can not read register 63 (FPS30) while CPU is running
    116. ERROR: Can not read register 64 (FPS31) while CPU is running
    117. ERROR: Can not read register 33 (FPS0) while CPU is running
    118. ERROR: Can not read register 34 (FPS1) while CPU is running
    119. ERROR: Can not read register 35 (FPS2) while CPU is running
    120. ERROR: Can not read register 36 (FPS3) while CPU is running
    121. ERROR: Can not read register 37 (FPS4) while CPU is running
    122. ERROR: Can not read register 38 (FPS5) while CPU is running
    123. ERROR: Can not read register 39 (FPS6) while CPU is running
    124. ERROR: Can not read register 40 (FPS7) while CPU is running
    125. ERROR: Can not read register 41 (FPS8) while CPU is running
    126. ERROR: Can not read register 42 (FPS9) while CPU is running
    127. ERROR: Can not read register 43 (FPS10) while CPU is running
    128. ERROR: Can not read register 44 (FPS11) while CPU is running
    129. ERROR: Can not read register 45 (FPS12) while CPU is running
    130. ERROR: Can not read register 46 (FPS13) while CPU is running
    131. ERROR: Can not read register 47 (FPS14) while CPU is running
    132. ERROR: Can not read register 48 (FPS15) while CPU is running
    133. ERROR: Can not read register 49 (FPS16) while CPU is running
    134. ERROR: Can not read register 50 (FPS17) while CPU is running
    135. ERROR: Can not read register 51 (FPS18) while CPU is running
    136. ERROR: Can not read register 52 (FPS19) while CPU is running
    137. ERROR: Can not read register 53 (FPS20) while CPU is running
    138. ERROR: Can not read register 54 (FPS21) while CPU is running
    139. ERROR: Can not read register 55 (FPS22) while CPU is running
    140. ERROR: Can not read register 56 (FPS23) while CPU is running
    141. ERROR: Can not read register 57 (FPS24) while CPU is running
    142. ERROR: Can not read register 58 (FPS25) while CPU is running
    143. ERROR: Can not read register 59 (FPS26) while CPU is running
    144. ERROR: Can not read register 60 (FPS27) while CPU is running
    145. ERROR: Can not read register 61 (FPS28) while CPU is running
    146. ERROR: Can not read register 62 (FPS29) while CPU is running
    147. ERROR: Can not read register 63 (FPS30) while CPU is running
    148. ERROR: Can not read register 64 (FPS31) while CPU is running
    149. WARNING: Failed to read memory @ address 0xDEADBEEE
    Display All

    And the debugger just hangs there. My settings.jlink file is just `SetResetType = 4`.

    On the gdb client side, I run with the following .gdbinit file

    Source Code

    1. set print pretty on
    2. file ./build/debug/link-controller-app.elf
    3. set substitute-path /app .
    4. target remote localhost:2331
    5. monitor reset
    6. monitor halt
    7. load
    Once GDB starts I type "continue" and it instantly hits a SIGTRAP on the client side, with the JLinkGDBServer hanging on the error above. The GDB client application shows the following:

    Source Code

    1. (gdb) c
    2. Continuing.
    3. Program received signal SIGTRAP, Trace/breakpoint trap.
    4. 0xdeadbeee in ?? ()

    The exact same set of files (.gdbinit, settings.jlink) and same JLink software version/arm-none-eabi-gdb on a native linux system run fine. Is anyone aware of any issues that Virtual Box presents the JLink? I have tried both USB2.0 and USB3.0 controllers on the virtual box side, with no luck.


    EDIT: The same thing happens in VMware workstation. So it seems the JLink just does not like to be run in a virual environment. I get the same error in both types of virtual machine managers: "ERROR: Can not read register xxxxx while CPU is running"

    The post was edited 1 time, last by bigbrett ().

  • UPDATE: Realized the JLink software versions were different. For some reason, both virtual or not, everything works fine with GDB server V6.44b but is broken in the most recent version (at least for the board and chip that I'm working with). Hopefully someone from SEGGER can chime in here, since I imagine there is a bug somewhere.