Debug help for cc2538

Hi everyone,

I have a question about debugging with cc2538.

I 'm testing the 6LoWPAN function on both RIOT and Contiki-NG. While stepping debugging, RIOT works fine, but Contiki-NG fails.

I’m using the same debugging method for both: First, I connect JLink to the SmartRF06+cc2538EM. Then, I open JLinkDebugServer in one session and gdb in another.

When the gdb connection is established for Contiki-NG, it shows that the code step into 0xdeadbeee. and the JLinkDebugExe output

Reading common registers: ERROR: Cannot read register 0 (R0) while CPU is running
Read register 'r0' (4 bytes) from hardware: 0xEFBEADDE
ERROR: Cannot read register 1 (R1) while CPU is running

Have anyone encounter this problem or notice any information related when implementing the RIOT cc2538 part.

Any insights related to this problem or helpful information would be greatly appreciated.

I’ve asked about this on the Contiki-NG github issue but I haven’t received a response for several weeks.

Thanks, Dingisoul

A wild guess: Maybe the MCU is locked in some “final product - lock out customers” setting when flashing Contiki that protects the registers from being read?

Sorry for not being more helpful; I’m too busy with other things right now. Feel free to pin me in a week again if nobody else answers you. I’ll try to carve out half an our to look into this, if the issue is still relevant then.

Thank you, Maribu.

I’ll examine the relevant and suspicious settings in Contiki’s code.

No need to apologize - your help is greatly appreciated.

Hi Maribu,

I’ve discovered the root cause of the issue. Contiki-NG enables the watchdog timer by default.

When stepping through the code during debugging, it triggers the watchdog timeout, causing the entire system to reboot and resulting in the debugger fail.

I comment out the watchdog code, and now the debugger is working properly.

RIOT do not use cc2538’s watchdog, so the debug originally works well.

Thanks, Maribu