Difference between revisions of "Flasher/How to patch EEPROM data in a PIC device"

From SEGGER Wiki
Jump to: navigation, search
(Patching EEPROM Data in a Microchip PIC device)
 
Line 1: Line 1:
To patch data into the EEPROM of a Microchip pic device, some special circumstances of the Microchip IDE have to be considered.
+
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.
 
A good starting point is a look into the generated HEX file.
   
 
[[File:PIC EE IDE.jpeg|800px]]
 
[[File:PIC EE IDE.jpeg|800px]]
  +
  +
A look into the HEX file shows how Microchip maps the data:<br>
  +
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!
  +
  +
  +
[[File:PIC EE HEX.jpeg|500px]]
  +
  +
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:
  +
<syntaxhighlight>
  +
#AUTO PATCH 1,1E01A,8:A100B200C300D400
  +
</syntaxhighlight>
  +
  +
Parameters:<br>
  +
1: Nr. of patches<br>
  +
2: Patch address<br>
  +
3: Number of bytes to patch (max.32 = 0x20)<br>
  +
4: Data to write<br>
  +
  +
  +
For more information regarding patching please have a look into the Flasher User Manual (UM08022)
  +
  +
https://www.segger.com/downloads/flasher/

Latest revision as of 08:54, 15 August 2023

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/