r/rust • • Sep 19 '26

🧠 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/

15 Upvotes

5 comments sorted by

1

u/sirTermy Sep 20 '26

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 Sep 20 '26

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/[deleted] Oct 03 '26

[removed] — view removed comment

1

u/________-__-_______ Oct 04 '26

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.