Page 1 of 1
Using the embedded debugger
Posted: Thu Oct 22, 2020 2:54 am
by nrD
Both microbit v1 and v2 have integrated debugger. I know it is possible to use it with platformio for example.
Any way to use it in micropython (ideally with some kind of GUI like with VS Code - whether that is using GDB underneath with some kind of remote attach or whatever)?
I think it would be amazing for teaching students (both high school and university). We currently do this with Atmel Studio on SAMD boards (running FreeRTOS).
Re: Using the embedded debugger
Posted: Thu Oct 22, 2020 6:37 am
by jimmo
nrD wrote: ↑Thu Oct 22, 2020 2:54 am
Any way to use it in micropython (ideally with some kind of GUI like with VS Code - whether that is using GDB underneath with some kind of remote attach or whatever)?
I think it would be amazing for teaching students (both high school and university). We currently do this with Atmel Studio on SAMD boards (running FreeRTOS).
Yes, I have done this with the v1 micro:bit (and I imagine the v2 will be similar).
Note that this is limited to debugging the C code, not the Python code (there's no interactive debugger for MicroPython on any board), but I assume that if you're comparing to FreeRTOS on SAMD then this is what you mean anyway.
The basic idea is that the USB frontend on the micro:bit runs DAPLink, which you can connect to with pyocd or openocd, and then gdb use that as a remote and debug using the elf file. I don't have any experience with VS Code, but hopefully that just builds on top of gdb and remote attach.
Here's how I do it with a v1 micro:bit
In one terminal:
$ pyocd-gdbserver
In another terminal
$ arm-none-eabi-gdb build-microbit/firmware.elf
...
(gdb) target remote localhost:3333