Break Secured GD32F305RBT6 Firmware: LQFP64 128 KB Recovery
The GD32F305RBT6 is the smallest flash member of GigaDevice’s connectivity line that reaches the bench in an LQFP64 body: 128 KB of flash beside a Cortex-M4 core at 120 MHz with a hardware FPU. It turns up in controllers whose firmware was never archived, and whose owner meets the read lock only when the original programmer is gone. To break the secured GD32F305RBT6 firmware you have to recover the image without erasing the device, and that begins with knowing exactly where the lock is stored.

Where the lock actually lives
The protection on this part is not threaded through the application code where a reader might look for it. It sits in the FMC option bytes, in a field GigaDevice calls the Security Protection (SPC) level. At level 0 the part is open. At level 1 the debug interface is refused access to the main flash array and the ROM bootloader declines its read-memory command. At level 2 the part is permanently sealed: no SWD, no USB DFU, no return. Almost every locked field unit we receive sits at level 1, which is recoverable; level 2 forces a physical rather than an electrical route. This split defines the method, because it changes completely at the boundary.
Why the debugger stops at the door
A fresh SWD session against the Cortex-M4 debug access port will often link at the physical layer and then fail the moment it reads 0x08000000. The FMC samples the SPC level after reset and gates the AHB window into flash, so the probe sees a bus but not its contents. That is why simply attaching a debugger and clicking read never returns an image, and why the common advice to unlock with a mass erase is a trap: stepping the part back to level 0 destroys the 128 KB you were sent to recover. A locked LQFP64 firmware recovery therefore cannot go through the documented unlock path.
The USB path is the same lock
Because the F305 carries USB OTG, the ROM bootloader also enumerates as a DFU device, and that is the second door a reader tries. It is gated by the very same SPC level. The DFU read-memory command returns an error exactly where the SWD read did, so the USB route is not a back door past the debug lock — it is the same lock reached by a different cable. This matters for the F305 specifically, because owners who enabled USB boot often assume the interface is a way in. It is not; both interfaces answer to the single security decision the FMC makes once at reset.
The bypass that works at level 1
Because that security decision is made early in the boot sequence, it is exposed to a correctly timed fault. A clock or voltage glitch delivered on the cycle where the FMC evaluates the SPC field can make the check fall through, leaving the debug port open for the few milliseconds needed to stream the flash out. On the RBT6 the margin is reasonable: the smaller 128 KB array is a fast capture once the port holds. The fault-injection rig we use is described in our notes on clock glitching and power glitching, and the same principle applies across the line when the secure flash read is blocked.
What the LQFP64 package changes
The 64-lead body limits pins but not the protection logic; the security model is identical to the larger family members, and what changes is only handling and capture time. With 64 leads the part is easy to fixture, and because the flash is only 128 KB a full image is a quick capture once the port holds open. The table below ties the three SPC levels to what is possible on this exact part.
| SPC level | Debug read | USB DFU read | Recoverable |
|---|---|---|---|
| 0 – open | yes | yes | not needed |
| 1 – read lock | no | no | yes, by glitch |
| 2 – chip lock | no | no | only by decap |
What we verify before returning anything
A recovered image is only worth having if it is whole. Before the RBT6 leaves the bench the 128 KB is read twice and the two passes are checksummed against each other. A glitch that closed the port mid-read shows up as a mismatch and triggers a re-capture of the block. Only a clean, complete image is handed back, and where the goal is a clone the same verified file is what gets written to a blank clone of the part.
How the result is returned
When the port stays open the image is delivered as a clean binary together with the extracted option bytes so you can see the original lock state, and where analysis is the goal we also supply a disassembly. The work is a read, not a repair. The larger flash variants carry the same lock but leave the glitch far more room to land.