0

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.

c0m4
  • 4,343
  • 10
  • 35
  • 40
  • This looks right to me, where did you add this line? It should be in the "Additional command-line options" box of the Global tab of the build options for the project. – Martin Sep 21 '09 at 12:12
  • In a bat file. I compile from the command line. Anyway, I decided to simply throw away code that fall within those ranges and patch it manualy (with a script). If you put that in an answer you get a free "Correct Answer" :-) – c0m4 Sep 21 '09 at 14:48

1 Answers1

1

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
  • 11,091
  • 41
  • 58