Tiny Multi Bootloader+

PIC18 family firmwares:



Principle

Example given for a PIC16F1847, but it's exactly the same principle for PIC18 device family.

 

Description of the data tranfert

Represents the character of one byte [] below.

① Flash transfer format:
[AddressU][AddressH][AddressL][2*N][DataL(1)][DataH(1)]....[DataL(N)][DataH(N)][SUM]

[AddressU] Start address of the flash page to override the data. (upper)
[AddressH] Start address of the flash page to override the data. (middle)
[AddressL] Start address of the flash page to override the data. (lower)
[2*N] Number of transfers of data as described in piccode.ini. (byte notation)
[DataL/H(n)] Rewrite data (2*N)bytes.
[SUM] Checksum.

② EEPROM transfer format:
[EEAddressU][EEAddressH][EEAddressL][1][EEData][SUM]

[EEAddressU] Address of the EEPROM to override the data | 0x40. (upper)
[EEAddressH] Address of the EEPROM to override the data. (middle)
[EEAddressL] Address of the EEPROM to override the data. (lower)
EEAddressU:EEAddressH:EEAddressL >= 0x400000
[1] Number of data transfers. (Always 1)
[EEData] EEPROM 8-bit data to be rewritten.
[SUM] Checksum.

③ Config transfer format:
[CFGAddressU][CFGAddressH][CFGAddressL][14][CFGDataL(1)][CFGDataH(1)].....[CFGDataL(7)][CFGDataH(7)][SUM]

[CFGAddressU] Start address of the Config data to overwrite the data | 0x80. (upper)
[CFGAddressH] Start address of the Config data to overwrite the data. (middle)
[CFGAddressL] Start address of the Config data to overwrite the data. (lower)
CFGAddressU:CFGAddressH:CFGAddressL >= 0x800000
[14] Number of data transfers. (Always 14)
[CFGData(n)] Rewrite data (2*7)bytes.
[SUM] Checksum.

Modify existing fimwares for a new device

###todo

Before you compile your new bootloader verify that your compiler will generate absolute code (and not relocatable code)!
To do so, in MPLAB IDE go to "Project" > "Build Options..." > "Project"
Your "MPASM/C17/C18" tab must look like the following: