S32k342 Program Counter does not start at main

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S32k342 Program Counter does not start at main

960 次查看
pb632146
Contributor V

When I try to debug my program it flashes properly, but then it puts itself into sram and never leaves.


Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x00000000
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x00000000
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x00000000
Read register 'r5' (4 bytes) from hardware: 0x00000000
Read register 'r6' (4 bytes) from hardware: 0x00000000
Read register 'r7' (4 bytes) from hardware: 0x00000000
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x00000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x00000000
Read register 'sp' (4 bytes) from hardware: 0x00024020
Read register 'lr' (4 bytes) from hardware: 0xFFFFFFFF
Read register 'pc' (4 bytes) from hardware: 0x2C014020
Read register 'xpsr' (4 bytes) from hardware: 0x00000001
Setting breakpoint @ address 0x004033BA, Kind = 2, Type = THUMB, BPHandle = 0x0001
Starting target CPU...
Debugger requested to halt target...
...Target halted (PC = 0x2040012E)
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x00000000
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x00000000
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x00000000
Read register 'r5' (4 bytes) from hardware: 0x00000000
Read register 'r6' (4 bytes) from hardware: 0x00000000
Read register 'r7' (4 bytes) from hardware: 0x00000000
Read register 'r8' (4 bytes) from hardware: 0x00000000
Read register 'r9' (4 bytes) from hardware: 0x00000000
Read register 'r10' (4 bytes) from hardware: 0x00000000
Read register 'r11' (4 bytes) from hardware: 0x00000000
Read register 'r12' (4 bytes) from hardware: 0x00000000
Read register 'sp' (4 bytes) from hardware: 0x00024020
Read register 'lr' (4 bytes) from hardware: 0xFFFFFFFF
Read register 'pc' (4 bytes) from hardware: 0x2E014020
Read register 'xpsr' (4 bytes) from hardware: 0x00000001
Removing breakpoint @ address 0x004033BA, Size = 2
Read 4 bytes @ address 0x2040012E (Data = 0xFFFFE7FD)
Read 2 bytes @ address 0x2040012E (Data = 0xE7FD)
Reading 64 bytes @ address 0x00000000
WARNING: Failed to read memory @ address 0x00000000
WARNING: Failed to read memory @ address 0x00000000
Read 4 bytes @ address 0x2040012E (Data = 0xFFFFE7FD)

I can see that it has the breakpoint for the start of main, but instead the pc points to a random location in sram where the global variables are.

 

"Removing breakpoint @ address 0x004033BA, Size = 2"

 

pb632146_2-1738154241394.png

but the line immediately after itin the console is 

Read 4 bytes @ address 0x2040012E (Data = 0xFFFFE7FD) which is just sram data

pb632146_0-1738153778909.png

Does anyone know what might cause this?

0 项奖励
回复
3 回复数

938 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

JTAG recovery start address is 0x20400100, so it may be that some instructions were executed and then it crashed at that address.

Do you have HSE downloaded into the MCU? There are some reasons JTAG recovery address is reached such as no IVT, 8 consecutive resets, or boot auth failed. Please check if any of these reasons apply.

If not, it may be caused by a wrong clock configuration. Please check clock configuration table from S32K3xx's Reference Manual as well.

Best regards,
Julián

0 项奖励
回复

920 次查看
pb632146
Contributor V
 

I do not know what HSE is so probably not, what is it? How would I go about checking the possible causes for it to go jtag recovery such as the ones you listed?

I will also note that sometimes during programming flash it will completely freeze the S32DS and I have to turn off the board/debugger for it to fix. But only sometimes so I am a little concerned. The debugger still flashes other programs I have just fine so I assume something is wrong with the startup files being given to it?

pb632146_1-1738178921602.png

 

0 项奖励
回复

916 次查看
Julián_AragónM
NXP TechSupport
NXP TechSupport

Hi @pb632146,

So, this issue is only present in that specific project? What exactly are you configuring in it? Are you able to share it?

Also, are you able to test another debugger or board with this same project?

Best regards,
Julián

0 项奖励
回复