Tiny Multi Bootloader+

PIC10 family firmwares:



Principle

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

 

Description of the data tranfert

Represents the character of one byte [] below.

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

[AddressH] Start address of the flash page to override the data. (upper)
[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:
[EEAddressH][EEAddressL][2][EEData][0][SUM]

[EEAddressH] Address of the EEPROM to override the data | 0x40 (upper)
[EEAddressL] Address of the EEPROM to override the data. (lower) EEAddressH:EEAddressL >= 0x4000
[2] Number of data transfers. (Always 2)
[EEData] EEPROM 8-bit data to be rewritten.
[0] Always 0.
[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:

Loading firmware from PC app, wo/ changing RESET vector

How to bypass activation of the bootloader.

To provide a jumper switch pin which is not used for communication.

Program modifications example: <tinybld12F617_8MHz_int_9600.asm>

;0000000000000000000000000 RESET 00000000000000000000000000
            org     0x0000
    pagesel IntrareBootloader
            goto    IntrareBootloader

                                    ;view with TabSize=4
;&&&&&&&&&&&&&&&&&&&&&&& START &&&&&&&&&&&&&&&&&
;---------------------- Bootloader ----------------------
            org     first_address
; nop
; nop
; nop
; nop
            org     first_address+4
IntrareBootloader:
;* add these lines to your source file **
    btfss   GPIO,0      ;check Jumper pin
    goto    first_address
;**********
                                    ;init int clock & serial port
#ifdef Direct_TX
bcf GPIO,TX
#else
bsf GPIO,TX
#endif

How to use:
  • First start,
    • Writing a program to remove the jumper pin.
  • Second and subsequent,
    • Program run time, You plug the jumper pin
    • Program rewriting, You remove the jumper pin.