I just watched this #EEVBlog post in which Dave set Sonnet 5.5 on High to reverse-engineer the firmware for his multimeter based on an #STM32, having previously connected an ST-Link to the SWD pin header of the multimeter. Overnight, it dumped the firmware through the ST-Link, decompiled the machine code to C with Ghidra, documented it thoroughly, wrote a simulator to test the rebuilt firmware, compiled it with GCC (the original used some crappy proprietary compiler), and when he gave the go-ahead, flashed the new firmware onto the meter.
It hung at startup, which Dave didn't notice, so it spent another 12 minutes debugging the startup problem over SWD, and then profiled the execution over SWD to make sure it didn't have other problems. The simulator hadn't simulated the timing requirement that led to the hang, and GCC's code was faster and smaller.
This seems pretty inspirational with respect to things like right to repair, malicious firmware, DRM, planned obsolescence, preinstalled spyware, and e-waste. And Sonnet 5.5 is not the top-capability model; open-weights models are apparently capable of doing this level of firmware improvisation as well. Dave mentioned one of his viewers that used one to write a higher-performance firmware image for the meter.
A really nice thing about the popularity of the STM32 and clones is that there's no OTP version, so AFAIK you can always reprogram them with fresh firmware. The security bits just prevent this kind of firmware readout when they're enabled, but I don't think they can prevent you from wiping and repurposing the chip.