I was wondering if anyone solved that problem and successfully managed to pass on extra option to the compiler. My problem is quite similar, on MPLABv5.15 with XC8v2.10:
For a bootloader on a PIC16F876 I need to keep some memory free at the beginning (bootloader goes at the end) except for the reset vector obviously. By setting the ROM ranges to something like default,-4-FFF
I'm able to keep this area free except for one psect (named end_init) which is at 0x4 in Flash memory.
By looking at the generated map file, I can see the argument -pintentry=04h,init, end_init
meaning that the end_init psect will follow right after the interrupt code (which is not present, so end_init goes right at 0x4)
According to XC8 manual (section 4.8.6
), the solution is simply to pass on an extra option like -L-pend_init=
in the extra linker options (this field is showed in section 126.96.36.199
). But it doesn't work.
The .map file isn't modified (I don't know if it's normal, since it's supposed to be an extra option for the linker only), and even if I can see this extra option passed on to the linker via the command line, nothing changes and this psect remains at 0x4.
I tried to pass this option to the other additional option fields (linker, compiler and even general, out of curiosity and despair) and to change the extra command to -L-pend_init=CODE
but nothing happened so far...
I link the manual here, for simplicity: http://ww1.microchip.com/downloads/en/devicedoc/50002053g.pdf
Thanks in advance !