[SOLVED] JLink Commander cannot read/write R13 or R15

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

  • JLink Commander cannot read/write R13 or R15

    The target is a GD32F303ZK. I am using SEGGER J-Link Commander V7.60d.

    I can debug the chip without problem (using IAR 5.2 or IAR 9.1), and I can flash it using JFlash or JLink commander. So generally the J-Link is working fine with the GD32F303ZK.

    However I was doing some low-level checkout because one of our boards is acting strange (though everything I copy/paste here is from a a session with a fully working board). I wanted to manipulate the R15 (PC) and R13 (SP) registers to simulate a reset to a different program that is flashed on the board, but is different than the program that is specified in the GD32's flash memory locations for the the initial SP and PC (addresses 0x0800_0000 and 0x0800_0004).

    I can use the `rreg` and `wreg` jlink commander commands to read or write any general purpose register except r13 or r15. For those registers jlink command responds "Illegal register name." "Syntax: rreg <RegName>" then proceeds to list dozens of valid register names (including "R13 (SP)" and "R15 (PC)").


    I have tried using variations of the register names, such as "r13", "R13", "sp", "SP", and even "R13 (SP)" (as given in the error message) with the same result for all of them.



    Here is a copy paste (with the list of valid register names mostly deleted to make reading easier):



    Source Code

    1. J-Link>ishalted
    2. CPU is halted (PC = 0x080271E8).
    3. J-Link>regs
    4. PC = 080271E8, CycleCnt = 809DC5AE
    5. R0 = 00000000, R1 = CDCDCDCD, R2 = 80000000, R3 = 08030CDD
    6. R4 = 6802B2F0, R5 = 00000001, R6 = 6802B2F0, R7 = CCCC0007
    7. R8 = CCCC0008, R9 = CCCC0009, R10= CCCC000A, R11= CCCC000B
    8. R12= 08030CDC
    9. SP(R13)= 20003400, MSP= 200033D8, PSP= 20003400, R14(LR) = 21000000
    10. XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
    11. CFBP = 02000000, CONTROL = 02, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    12. FPS0 = 2292A714, FPS1 = 1841CC2D, FPS2 = 1826B610, FPS3 = 80094E08
    13. FPS4 = 2DC4E403, FPS5 = 06436010, FPS6 = 44102763, FPS7 = 029DAC32
    14. FPS8 = D0D0E426, FPS9 = 9487C14B, FPS10= 14B14703, FPS11= 4E1DC230
    15. FPS12= 48BB8020, FPS13= A5B141A8, FPS14= 2C81E8D1, FPS15= 80F44A30
    16. FPS16= 4C004101, FPS17= AC1281A4, FPS18= 63F88A41, FPS19= C13226B0
    17. FPS20= AA9584DA, FPS21= C0A2FA23, FPS22= 88D62E08, FPS23= 418010D1
    18. FPS24= 087B948E, FPS25= 5416064D, FPS26= 15340493, FPS27= F4C580C6
    19. FPS28= 81220252, FPS29= 02801471, FPS30= 34840245, FPS31= C06E1150
    20. FPSCR= 00000000
    21. J-Link>rreg r0
    22. R0 = 0x00000000
    23. J-Link>rreg r14
    24. R14 = 0x21000000
    25. J-Link>rreg r13
    26. Illegal register name.
    27. Syntax: rreg <RegName>
    28. R0
    29. R1
    30. R2
    31. R3
    32. R4
    33. R5
    34. R6
    35. R7
    36. R8
    37. R9
    38. R10
    39. R11
    40. R12
    41. R13 (SP)
    42. R14
    43. R15 (PC)
    44. XPSR
    45. // ... a bunch of register names edited out
    46. MSPLIM
    47. PSPLIM
    48. J-Link>rreg r15
    49. Illegal register name.
    50. Syntax: rreg <RegName>
    51. R0
    52. R1
    53. R2
    54. R3
    55. R4
    56. R5
    57. R6
    58. R7
    59. R8
    60. R9
    61. R10
    62. R11
    63. R12
    64. R13 (SP)
    65. R14
    66. R15 (PC)
    67. XPSR
    68. // ... a bunch of register names edited out
    69. MSPLIM
    70. PSPLIM
    71. J-Link>
    Display All
  • [SOLVED] JLink Commander cannot read/write R13 or R15

    Update: While the following doesn't work:

    Source Code

    1. J-Link>rreg R13 (SP)
    2. Illegal register name.
    3. Syntax: rreg <RegName>
    4. ... long list of registers elided ...


    I found that using quotes makes it work:

    Source Code

    1. J-Link>rreg "R13 (SP)"
    2. R13 (SP) = 0x20003400
    3. J-Link>rreg "R15 (PC)"
    4. R15 (PC) = 0x080271E8

    I'd like to ask for an enhancement to jlink.exe so that the simpler, more commonly used names "R13", "SP", "R15", and "PC" be accepted as aliases for the respective registers.

    I find it surprising that no one has complained about this before.
  • Hello,

    Thank you for your inquriy.
    The issue is reproducible and will be fixed.

    Best regards,
    Nino
    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.