Break IC R5F2L388 Firmware: The ID Code That Gates the Serial Port
A Renesas R5F2L388CNFP does not refuse to talk. It synchronises, exchanges a few frames, and then stops. The stop is the interesting part, because it is a decision made in software by a boot program that lives in the same array you are trying to read.
That separates this family from parts where protection is a physical gate. Here the gate is a comparison, and a comparison is a different object to attack.

The handshake before the lock
Standard serial programming on the R8C core begins with a synchronisation frame, then the host sends an eight-byte ID code. The on-chip boot program reads the stored copy and compares.
On a match it returns the device code and the memory size, and every later command is accepted. On a mismatch it returns an error frame and the session ends.
| Input | What the boot program does |
|---|---|
| Correct ID code | Returns device code and accepts commands |
| Wrong ID code | Returns an error frame, closes the session |
| No ID code sent | Waits, then times out |
| Blank device | Accepts, because erased flash reads as all ones |
The fourth row is the commercial one. A device that was never programmed has no stored code to compare against, so the gate stands open — which is why the same programmer works on a fresh part and fails on a production one with an identical part number.
Why eight bytes is not a guessing problem
Sixty-four bits, and a serial session is a poor oracle. Each attempt costs a reset, a synchronisation, and the timeout of the error path — a second at best, more once a fixture and a test script are involved.
| Budget | Attempts at one second each | Chance of a hit |
|---|---|---|
| One day | 86,400 | 4.8 × 10⁻¹⁵ |
| One year | 3.2 × 10⁷ | 1.8 × 10⁻¹² |
| One century | 3.2 × 10⁹ | 1.8 × 10⁻¹⁰ |
The arithmetic is the ordinary exhaustive-search argument, which is why brute force is the wrong instinct here. There is also no partial credit: the comparison does not report how many bytes matched, so a guess cannot grow one byte at a time.
What the comparison is built from
Two properties of the implementation decide what can be done about it.
The comparison runs on the same core that will later execute the firmware, from code held in flash, at a clock derived from the programmer’s synchronisation frames. It is a branch, and a branch has a timing.
The stored ID is an ordinary part of the array, with the same cell structure as the code. Any route that reaches the array reaches it too.
| Property | Consequence |
|---|---|
| Software comparison | A glitch can flip the branch |
| Same array as the code | Any array read yields it |
| Read by the boot program | Its address is discoverable |
| Programmed with the firmware | Never blank on a real unit |
Two routes, and how they differ
The first route attacks the branch. A supply or clock disturbance timed to the comparison makes the boot program take the accepting path regardless of the bytes sent. The general technique is the glitch search problem, and it is easier here than on many parts because the target is one comparison at a known position in a known frame sequence.
The second route ignores the serial port and reads the array. Decapsulation, or any in-circuit path that reaches the array, returns the ID code along with the firmware — and once the ID is known the serial port works again for verification.
The two are complementary: one proves what the device contains, the other reads it back through a path the vendor supports.
What the image looks like when it arrives
An R8C image is a byte-addressed heximal file with the firmware in place, the ID code in its own record near the top of the first block, and the option bytes beside it.
Do not discard that region when you rebuild a unit. A device that boots on the bench and resets in the field usually has its option function select bytes left at the erased value, and the fix is a comparison against the original dump rather than a change to the code.
| Region | Content | If it is wrong |
|---|---|---|
| Reset and start-up | Initial address, stack setup | Nothing runs |
| Firmware | The application | Behaviour differs |
| ID code | Eight bytes | Serial port refuses |
| Option bytes | Clock, watchdog, protection | Boot loop, resets |

What we deliver
For a protected R5F2L388CNFP the deliverable is a binary image, the eight-byte ID code, the option bytes, and a note on which route produced them.
That note matters because an image recovered through the serial port after a glitch and one read from the array carry different confidence, and the difference shows when the image is used to build a second unit. Both routes are described in break IC and MCU attack; formats and verification are in extract MCU code.