Flasher/How to patch EEPROM data in a PIC device

From SEGGER Wiki
Jump to: navigation, search

To patch data into the EEPROM area of a Microchip pic device, some special circumstances of the Microchip IDE have to be considered. A good starting point is a look into the generated HEX file.

PIC EE IDE.jpeg

A look into the HEX file shows how Microchip maps the data:
EEPROM is mapped to 1E000: But the 256 bytes are stored as 16 bit values in the HEX file which doubles the areasize to 512 bytes. Fill bytes are stored as 0x00. Physically only 8 bits values are stored in the EEPROM!


PIC EE HEX.jpeg

Keep in mind that to double your address offset and then add Microchips offset 1E000.

Writing the data A1 B2 C3 D4 to EEPROM address 0x0D needs the following patch:

#AUTO PATCH 1,1E01A,8:A100B200C300D400

Parameters:
1: Nr. of patches
2: Patch address
3: Number of bytes to patch (max.32 = 0x20)
4: Data to write


For more information regarding patching please have a look into the Flasher User Manual (UM08022)

https://www.segger.com/downloads/flasher/