Trying to compile code to use on a PIC16 with a bootloader placed on the lower 0x800 addresses.
$ sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.9.0 #5416 (Feb 3 2010) (UNIX)
$ sdcc -mpic16 -p18f2550 --ivt-loc=0x800 --link="gplink -s mylinkerscript.lkr" main.c
CODEPAGE NAME=boot START=0x0 END=0x7FF PROTECTED
CODEPAGE NAME=page START=0x800 END=0x7FFF
CODEPAGE NAME=idlocs START=0x200000 END=0x200007 PROTECTED
CODEPAGE NAME=config START=0x300000 END=0x30000D PROTECTED
CODEPAGE NAME=devid START=0x3FFFFE END=0x3FFFFF PROTECTED
CODEPAGE NAME=eedata START=0xF00000 END=0xF000FF PROTECTED
Looking at main.lst, high priority interrupt vector has been placed at 0x808 address and low priority interrupt vector at 0x818 (as expected).
$ gpdasm -p18f2550 main.hex | head -8
000000: ef1c goto 0xa38
000800: b09e btfsc 0x9e, 0, 0
000802: efb0 goto 0x960
000806: 0010 retfie 0
000808: ef28 goto 0xa50
We can see that there is code placed at 0x000 address. I think this is because crt0i is already compiled and "_entry (void) __naked __interrupt 0" has been hard placed at 0x0000.
- Maybe crt0i should be recompiled when a non-default linker script is used
- Or, trying to avoid recompilation, ¿could "_entry (void) __naked __interrupt 0" be placed at ivt-loc (symbolic) and be finally resolved by linker (or something similar)? I don't even know if this is possible.
Thanks a lot for this great project
Log in to post a comment.