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):
J-Link>ishalted
CPU is halted (PC = 0x080271E8).
J-Link>regs
PC = 080271E8, CycleCnt = 809DC5AE
R0 = 00000000, R1 = CDCDCDCD, R2 = 80000000, R3 = 08030CDD
R4 = 6802B2F0, R5 = 00000001, R6 = 6802B2F0, R7 = CCCC0007
R8 = CCCC0008, R9 = CCCC0009, R10= CCCC000A, R11= CCCC000B
R12= 08030CDC
SP(R13)= 20003400, MSP= 200033D8, PSP= 20003400, R14(LR) = 21000000
XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 02000000, CONTROL = 02, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
FPS0 = 2292A714, FPS1 = 1841CC2D, FPS2 = 1826B610, FPS3 = 80094E08
FPS4 = 2DC4E403, FPS5 = 06436010, FPS6 = 44102763, FPS7 = 029DAC32
FPS8 = D0D0E426, FPS9 = 9487C14B, FPS10= 14B14703, FPS11= 4E1DC230
FPS12= 48BB8020, FPS13= A5B141A8, FPS14= 2C81E8D1, FPS15= 80F44A30
FPS16= 4C004101, FPS17= AC1281A4, FPS18= 63F88A41, FPS19= C13226B0
FPS20= AA9584DA, FPS21= C0A2FA23, FPS22= 88D62E08, FPS23= 418010D1
FPS24= 087B948E, FPS25= 5416064D, FPS26= 15340493, FPS27= F4C580C6
FPS28= 81220252, FPS29= 02801471, FPS30= 34840245, FPS31= C06E1150
FPSCR= 00000000
J-Link>rreg r0
R0 = 0x00000000
J-Link>rreg r14
R14 = 0x21000000
J-Link>rreg r13
Illegal register name.
Syntax: rreg <RegName>
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13 (SP)
R14
R15 (PC)
XPSR
// ... a bunch of register names edited out
MSPLIM
PSPLIM
J-Link>rreg r15
Illegal register name.
Syntax: rreg <RegName>
R0
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
R13 (SP)
R14
R15 (PC)
XPSR
// ... a bunch of register names edited out
MSPLIM
PSPLIM
J-Link>
Display More