A container supporting Particle firmware debugging.
1.1K
The Docker debug container will execute arm-none-eabi-gdb, and any parameters you pass behind it will be passed directly to arm-none-eabi-gdb. Before a device can be debugged, it will need to be in DFU mode (blinking yellow).
NOTE: The configuration shown below will allow you to debug Particle firmware using the Particle Debugger or Programmer Shield.
docker run --interactive --mount type=bind,source=<local firmware repository>,target=/particle-iot/device-os --mount type=bind,source=<user application folder>,target=/particle-iot/app --privileged --rm --tty zfields/particle-dbg --directory /usr/local/lib/gcc-arm-none-eabi-5_3-2016q1/arm-none-eabi/include/c++/5.3.1/bits --directory /particle-iot/device-os/third_party/freertos --directory /particle-iot/device-os/third_party/nrf5_sdk --directory /particle-iot/device-os/communication --directory /particle-iot/device-os/hal --directory /particle-iot/device-os/system --directory /particle-iot/device-os/wiring -ex 'target remote | openocd -f interface/<debugging hardware>.cfg -f target/<target hardware>.cfg -c "<mcu family>.cpu configure -rtos FreeRTOS; gdb_port pipe; log_output openocd.log;"' <user application>.elf
NOTE: This process runs inside a container, where the file locations are no longer relative to where they were originally compiled. To compensate for this, we must supply the
--directoryparameter togdb.
<local firmware repository> - This is the path to the firmware folder on your local machine.<user application folder> - This is the path to the user application folder on your local machine.<user application> - This will be the name of the resulting binary (i.e. my_app.elf).gdb pipes into openocd, and you can configure OpenOCD using the following parameters...
<debugging hardware>
-f interface/particle-ftdi.cfg --> Programmer Shield-f interface/cmsis-dap.cfg --> Particle Debugger<target hardware>
-f target/stm32f1x.cfg --> Spark Core-f target/stm32f2x.cfg --> Gen2: Photon/Electron-f target/particle.cfg --> Gen3: Argon/Boron/Xenon<mcu family>
stm32f2x.cpu configure -rtos FreeRTOS; --> Gen2: Photon/Electronnrf52.cpu configure -rtos FreeRTOS; --> Gen3: Argon/Boron/XenonOnce you have launched the container, you will be prompted with a GDB shell. Use the follow commands to engage the target device and start debugging.
(gdb) monitor reset halt
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08003700 msp: 0x20020000
(gdb) break setup
Breakpoint 1 at 0x80373e0: file /particle-iot/app//src/blinky.cpp, line 12.
(gdb) continue
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
...
Content type
Image
Digest
Size
122.2 MB
Last updated
over 7 years ago
docker pull zfields/particle-dbg