Hi List,

I'm coding some firmware for a pic18f2550 device with sdcc, using the 
bootloader firmware provided by microchip.

The bootloader occupies 0x0 - 0x7FF, and expects the reset/interrupt vectors 
to be at 0x800, 0x808, etc.

But sdcc/gplink seem to hardcode their location to 0x00, 0x08, 0x18.

I tried using a modified linker script with:

-----------------
...
CODEPAGE   NAME=boot       START=0x0            END=0x7FF          PROTECTED
CODEPAGE   NAME=vectors    START=0x800          END=0x829          PROTECTED
CODEPAGE   NAME=page       START=0x82A          END=0x7FFF
...
------------------

Which works only partially: The code is put into 0x82A..0x7FFF just fine, but 
the vectors are still inside the boot page.

The only way I found to work arround that is to use #pragma code inside the 
source, like:

-------------------
#pragma code high_isr_proxy 0x808
void high_isr_proxy(void) __naked interrupt 1 {
   __asm goto _high_isr __endasm;
}

#pragma code low_isr_proxy 0x818
void low_isr_proxy(void) __naked interrupt 2 {
   __asm goto _low_isr __endasm;
}

void high_isr(void) shadowregs interrupt {
...
}

void low_isr(void) shadowregs interrupt {
....
}
----------------------

Which seems to Do The Right Thing(tm) for interrupts, but for the startup code 
I only could get it to work by linking a customized crt0i.c, with:

------------
/* prototype for the startup function */
#pragma code _entry 0x800
void _entry (void) __naked __interrupt 0;
------------
added.


While this works for now, I'd rather find a posibility to control the location 
of the isr vectors entirely with the linker script, so the same source could 
be used with and without a bootloader, by simply changing the .lkr file used.

Did I miss some option for sdcc/gplink, or is that currently not possible?

I'm using "sdcc 2.6.0 #4294 (Jul 23 2006)" and "gplink-0.13.3 alpha".

Thanks in advance,
/Ernst

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to