Comprehensive debugging

I have been trying to see what can be debugged during the boot sequence.

I successfully set the MSEL=0000 and connected OpenOCD/GDB to the board via the USB/JTAG interface.
I can find no documentation regarding how to get the boot to proceed, so I presumed resetting the MSEL=1111 might do the trick and it almost did, it certainly broke out of the tight loop, but telling GDB to continue, the board does not proceed to boot to the prompt

Q1. Is there a gude to debugging through the boot process, I am guessing the above is not the way to do this

Q2. Which hart does the GDB connect to ?
I am guessing it is the monitor HART0, in which case, how do I debug code running on
hart1-4 ?

Is there any documentation I should be referring to, which details debugging the boot process, and describes debug access to all hart’s within the unleashed system ?


In general you should be able to step through the boot sequence with OpenOCD/GDB with a few notes…

  1. If you use the OpenOCD cfg file included in freedom-u-sdk (, it uses the -rtos riscv flag. This allows a single GDB instance to connect to the OpenOCD target and treat the 5 harts as threads. So you can use GDB thread debugging commands (

  2. The pre-compiled version of OpenOCD released from our website has a few issues that have since been resolved that are especially annoying when trying to debug the MaskROM and SPIFlash boot steps. I’d suggest building OpenOCD from source ( if this is something you want to do.

  3. Rather than trying to mess with the MSEL switches as you described above (perhaps they were in an intermediate value and the boot process went off the rails), I would set them to e.g. MSEL=1111, let the core boot, connect the debugger, then use the monitor reset halt command to restart the boot process with the debugger in control. Make sure to use the flush regs command after this step to get the value of e.g. the $pc after this command, GDB doesn’t refresh the values automatically.

Excellent !
Exactly the information I was looking for
Many Thanks