Debugging Particle on Windows

Julien Vanier
Sep 1, 2015 · 3 min read

This article is a complement to my 5 steps to setup and use a debugger with the Particle Photon with specific steps to using the debugger on Windows.

Compiling the firmware and using the debugger is the same, so I won’t repeat those steps here.

I ran these steps on Windows 10.

Install the software

Install the drivers

  • Install the Photon in the Programmer Shield
  • Plug the USB from your Programmer shield to your computer
  • Open Zadig
  • Check Options → List all devices
  • Select Particle FT2232 (Interface 0) and libusbK for the driver
    IMPORTANT: Interface 0, not interface 1
  • Click Install driver or Reinstall driver
Install the driver for the Debugger Shield

If you haven’t installed the DFU driver before, follow these steps too

  • Disconnect the USB from the Programmer Shield and connect it to your Photon so that the Photon is connected to your computer
  • Enter DFU mode on the Photon: hold the Setup button, press and release reset, and keep holding Setup until the LED flashes yellow
  • Open Zadig
  • Select Photon DFU Mode and lubusbK for the driver
  • Click Install driver or Reinstall driver
Install the driver for the Photon in reflash mode (DFU)

Compile the firmware

The Windows-specific part here is to build the firmware with a clean path to avoid issues with incompatible versions of make, git, rm…

Connect the USB cable to the Photon (not to the Programmer Shield), put the Photon in DFU mode, compile and flash the firmware.

set PATH=C:\Windows\system32;C:\Windows;C:\Particle\Toolchain\MinGW\bin\;C:\Particle\Toolchain\MinGW\msys\1.0\bin;C:\Particle\Toolchain\GCC-ARM\bin;C:\Particle\Tools\DFU-util;C:\Particle\Toolchain\Make\bin;C:\Particle\Tools\Git\bin
cd /d C:\Particle\firmware\modules
bash
make clean all program-dfu PARTICLE_DEVELOP=1 PLATFORM=photon USE_SWD_JTAG=y
Compiling and reflashing through DFU completed (even though it shows error during download get_status at the end)

Start the debugger

  • Open a command line to C:\Particle\openocd\bin-x64
  • Start openocd
openocd.exe -f particle-ftdi.cfg -f stm32f2x.cfg -c "gdb_port 3333"
The interface between GDB and the Programmer Shield

Start GDB (GNU Project debugger) with an ELF file to load the symbols (mapping of memory addresses to names)

arm-none-eabi-gdb -ex "target remote localhost:3333" ../build/target/user-part/platform-6-m/user-part.elf
GDB ready to debug

Debug away!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store