Restore an MSP430G2001 Locked Heximal Program from a Single Flash Segment
Restoring a locked image means working inside a very small budget. The MSP430G2001 carries 512 bytes of flash, one erase segment, with no second copy on the die and no room for a shadow image, so a restore MSP430G2001 locked heximal program has to be non-destructive by construction. That drives everything: where the vectors sit inside the same segment as the code, why a reconstructed heximal file must carry both blocks at their real addresses, and why the flashing routine has to run from RAM without overwriting itself.
Why one 512-byte segment changes the whole recovery method
The MSP430G2001 is the smallest in the MSP430G2x01 family: 0.5 KB of flash, 128 bytes of SRAM and 10 I/O pins, a 16-bit Timer_A with two capture and compare registers, a brownout detector and a factory-calibrated DCO frequency. The core is a 16-bit RISC design with a 62.5 ns instruction cycle.
What makes MSP430G2001 single flash segment recovery hard is the absences. No analog comparator, no ADC, no serial interface and no bootstrap loader, so nothing writes to the part unless the read comes first. The MSP430G2101 flash content restoration write-up covers a larger sibling.
The flash map of an MSP430G2001
Main flash is divided into 512-byte segments, so the whole array is one segment. Two 128-byte information flash segments at 0x1000 to 0x107F and 0x1080 to 0x10FF hold calibration and lock data in TLV format.
| Region | Address range | Size | Contents |
|---|---|---|---|
| Main flash, one segment | 0xFFC0 to 0xFFFF | 512 bytes | Program code plus the reset and interrupt vectors |
| Information segment B | 0x1000 to 0x107F | 128 bytes | Calibration and lock data in TLV format |
| Information segment A | 0x1080 to 0x10FF | 128 bytes | Calibration and lock data in TLV format |
| SRAM | 0x0200 to 0x027F | 128 bytes | Stack, variables and the flashing routine itself |
The erase unit is one 512-byte segment and the smallest programmable unit is one word, so the vector table and the program body share an erase unit. Code cannot be replaced while leaving the vectors untouched, so the reconstruction has to be right the first time, as the MSP430G2152 data replication case shows.
How to restore MSP430G2001 locked heximal program with the right addresses
A heximal file is not a flat blob. Each record carries its own load address, so the program body and the vector block must be two addressed regions at their true locations. Concatenating the bytes under one start address puts the vector table at the bottom of the segment, where the reset vector is not.
That MSP430G2001 vector table reconstruction has to reproduce the reset and interrupt vectors at the top of the address space, with the reset vector pointing at the recovered entry point. The space below them is the program body, written as contiguous records with per-line checksums.
Running the flashing routine from 128 bytes of RAM
Programming means executing code from RAM, since the flash controller cannot write to the segment the routine occupies. With 128 bytes of SRAM at 0x0200 to 0x027F, that MSP430G2001 RAM resident flashing routine shares the space with its own stack and variables, so it must never overwrite its working variables.
The flash controller key matters here. The high byte of FCTL1, FCTL3 or FCTL4 must hold 0xA5 for a write to be accepted, and a sequence issued without that key does nothing, with no error flag. A wrong key looks like an operation followed by an unchanged array, so read-back comparison is not optional, as the MSP430G2131 embedded flash software recovery procedure shows.
Verifying the restored image before it goes back on the board
Verification happens in two directions. Power the part, confirm it leaves reset and reaches the application, then read the segment back and compare it to the source. The timing reference matters because the factory-calibrated DCO constant lives in the information flash, not the program segment. The MSP430G2212 flash program reverse reading write-up shows the same split between code and calibration data.
That is the point people miss. An MSP430G2001 512 byte program restore that copies only the main segment produces a part running the original code but keeping its own DCO value, so a timer tuned on the original shifts on the replacement. Recovered information segments should travel with it, as the MSP430G2352 flash memory binary restoration shows.

To restore MSP430G2001 locked heximal program, treat the 512-byte segment as one indivisible unit: recover the code and the vectors as two addressed blocks, confirm the reset vector points into the image, rebuild the file with correct addresses and per-line checksums, and keep the flashing routine inside 128 bytes of RAM with the 0xA5 key handled properly. Where the client needs the extraction itself, our laboratory performs the read and returns the recovered image.