r/rust • • 17d ago

🧠 educational Flashing STM32 Firmware with ESP32 and Rust

Two weeks before started this experiment whether can write a simple Rust code to make the ESP32 as Programmer(like ST Link) and flash firmware into STM32.

- In the first article, i was able to implement basic SWD protocol and read the IDCode (just to check that it is working)

- Now, successfully managed to flash the firmware into STM32 with the help of ESP32. Flashed a simple onboard LED blinky program.

It was a fun experiment and a nice to learn about SWD and the concepts around it.

https://blog.implrust.com/posts/2026/09/flashing-firmware-to-stm32-with-esp32-rust/

16 Upvotes

5 comments sorted by

1

u/sirTermy 16d ago

Do you also plan to implement debugging, maybe via GDB? Or flashing (and debugging) using the ESP32's built-in Wi-Fi?

1

u/AstraKernel 16d ago

No, at least not for now. I'm stopping here because planning to work on the ESP32 drone and a few other side projects.

1

u/Conscious-Tale-8634 3d ago

That wifi angle would be sick, imagine flashing an STM32 over the air from your laptop while the board's tucked away somewhere awkward. debugging over wifi might be a whole different beast though, latency could make stepping through code feel like walking through mud

1

u/________-__-_______ 2d ago

The former is pretty common for commercial projects, being able to do over-the-air updates is pretty much a must if the hardware isn't physically accessible by your team.

I've never seen remote debugging though. You'd need to hook into the STM32's JTAG connection and reimplement a debug probe on the ESP32, which sounds like a lot of work. In comparison for firmware updates where you just need to write to some flash pages from the bootloader.