0

I'm writing a bootloader for a PIC18F87K22. I used the -mrom command line argument recommended in their documentation/webinar to limit the Range that the compiler would place things into ROM between 0x0000-0x0FFF which should give me 4K to write the bootloader in. However when using that flag I get the linker error

:0:: error: (500) undefined symbols:

I found that if I expand the range to be from 0x0000-0xFFFF then it builds correctly, but currently, my code is fairly simple and only uses 258 bytes and it should easily fit in the space allotted. for some reason, the compiler will not place any code in between the interrupt vectors which end at 0x001C and the address 0x1000, so this nearly 4k region of flash is going to waste. Application memory constraints are already getting tight and I really can't afford this overhead. Any ideas would be helpful. I'm currently using xc8 v2.20.

Here is the relevant section of my map file when building in the range 0x0000-0xFFFF

Machine type is 18F87K22
            Name                               Link     Load   Length Selector   Space Scale
/tmp/xcXmJhLIj.o
            idloc                            200000   200000        8        0       5
            config                           300000   300000        E        0       4
            init                                  0        0        4        0       0
dist/default/production/PIC-18F87K22-BOOTLOADER.X.production.o
            idloc                            200000   200000        8        0       5
            config                           300000   300000        E        0       4
            smallconst                         1000     1000       14      800       0
            text3                              10B8     10B8       3C      80A       0
            text2                              1014     1014       66      80A       0
            text1                              107A     107A       3E      80A       0
            text0                              10F4     10F4       14      80A       0
            cstackCOMRAM                          1        1        A        1       1
            cinit                              1108     1108        E      80A       0

TOTAL       Name                               Link     Load   Length     Space
    CLASS   STACK          

    CLASS   CODE           
            init                                  0        0        4         0
            text3                              10B8     10B8       3C         0
            text2                              1014     1014       66         0
            text1                              107A     107A       3E         0
            text0                              10F4     10F4       14         0
            cinit                              1108     1108        E         0

    CLASS   CONST          

    CLASS   SMALLCONST     
            smallconst                         1000     1000       14         0

    CLASS   MEDIUMCONST    

    CLASS   COMRAM         
            cstackCOMRAM                          1        1        A         1

    CLASS   ABS1           

    CLASS   BIGRAM         

    CLASS   RAM            

    CLASS   BANK0          

    CLASS   BANK1          

    CLASS   BANK2          

    CLASS   BANK3          

    CLASS   BANK4          

    CLASS   BANK5          

    CLASS   BANK6          

    CLASS   BANK7          

    CLASS   BANK8          

    CLASS   BANK9          

    CLASS   BANK10         

    CLASS   BANK11         

    CLASS   BANK12         

    CLASS   BANK13         

    CLASS   BANK14         

    CLASS   BANK15         

    CLASS   SFR            

    CLASS   CONFIG         
            config                           300000   300000        E         4

    CLASS   IDLOC          
            idloc                            200000   200000        8         5

    CLASS   FARRAM         

    CLASS   EEDATA         



SEGMENTS        Name                        Load    Length   Top    Selector   Space  Class

            reset_vec                      000000  000004  000004         0       0  CODE    
            text2                          001014  000102  001116       80A       0  CODE    
            cstackCOMRAM                   000001  00000A  00000B         1       1  COMRAM  
            smallconst                     001000  000014  001014       800       0  SMALLCON
  • Maybe this helps:https://www.microchip.com/forums/m833484.aspx – Mike Aug 04 '20 at 10:58
  • @Mike i read through the entire thread and it seems like the op has a very similar problem, unfortunately it is never resolved. –  Aug 04 '20 at 11:34

0 Answers0