tags:

views:

123

answers:

1

I want to use Claudiu Chiculitas tiny bootloader for PIC16 (i have modyfied it to suit my chip) but since that bootloader does not move code to prevent overwriting the bootloader, I must somehow manually see to that the bootloader is not overwritten. I have tried to use the --rom option like this:

--rom=default,-0-4,-3f00-3fff

What I want is: No code in the first 4 words of code memmory, because thats where the jump to the bootloader is and no code in the last 128 words of memory because thats where the actual bootloader is. --rom like I use it does nothing. Im using HI-TECH PICC STD COMPILER (Microchip PICmicro) V9.60PL3 and the chip is pic16f876A.

+1  A: 

You can also do this with a custom linker script. Usually, your linker script would contain these lines to put the reset vectors first and the code (in the page named "page") behind it:

CODEPAGE   NAME=vectors    START=0x0            END=0x29           PROTECTED
CODEPAGE   NAME=page       START=0x2A           END=0x7FFF

For the bootloader used in Microchip's FSDem board (which occupies the 0x0-0x800 range, and expects your program to have its own vectors at 0x800), this is replaced by the lines below which prevent the linker from using anything below 0x800:

CODEPAGE   NAME=boot       START=0x0            END=0x7FF          PROTECTED
CODEPAGE   NAME=vectors    START=0x800          END=0x0x829        PROTECTED
CODEPAGE   NAME=page       START=0x82A          END=0x7FFF
Wim