PIC: Changing location of code

2007-11-04
2013-03-12
  • Terry Barnaby
    Terry Barnaby
    2007-11-04

    Hi,

    I am trying to implement a software bootlader for a PIC 16f873a.
    To do this I want to create the bootloader code so that it has a small bit
    of code located at 0x0000, but the rest of the code located at the top
    of memory.
    This is to allow the easy use with programs compiled/linked to run at 0x0000.

    I have not been able to work out how to do this.
    I have tried adding "#pragma codeseg BOOTLOADER" and editing the
    linker spec file amoungst other things.

    Any ideas on how to acheive this ?

    Cheers

    Terry

     
    • Terry Barnaby
      Terry Barnaby
      2007-11-12

      I have found that this can be achieved by modifying the link script file by adding something like:

      "SECTION NAME=code_bootLoader ROM=page1"

      Where "bootLoader" was the name of the 'C' source file in my case.

      Terry