Hi,

I'm implementing a bootloader that will allow the actual application
code to be updated on the field via USB.


As the bootloader code resides in 0x0000 .. 0x0800 I need to relocate
the actual application to address 0x0800 along with the interrupt
vectors.

I'm targeting PIC18F4550

I set my .lkr as follows:

CODEPAGE   NAME=vectors    START=0x0800         END=0x829
PROTECTED
CODEPAGE   NAME=page       START=0x082A         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

ACCESSBANK NAME=accessram  START=0x0            END=0x5F
DATABANK   NAME=gpr0       START=0x60           END=0xFF
DATABANK   NAME=gpr1       START=0x100          END=0x1FF
DATABANK   NAME=gpr2       START=0x200          END=0x2FF
DATABANK   NAME=gpr3       START=0x300          END=0x3FF
DATABANK   NAME=usb4       START=0x400          END=0x4FF
PROTECTED
DATABANK   NAME=usb5       START=0x500          END=0x5FF
PROTECTED
DATABANK   NAME=usb6       START=0x600          END=0x6FF
PROTECTED
DATABANK   NAME=usb7       START=0x700          END=0x7FF
PROTECTED
ACCESSBANK NAME=accesssfr  START=0xF60          END=0xFFF
PROTECTED


SECTION    NAME=usbram5    RAM=usb5



this seems to relocate most of the code but still some stuff is placed
at 0x0000, as evidenced by the .map file

Map File - Created 12-20-2014  20:46:26

                                 Section Info
                  Section       Type    Address   Location Size(Bytes)
                ---------  ---------  ---------  ---------  ---------
          S_crt0i___entry       code   00000000    program   0x000004
x      code   0x000008    program   0x000004
S_main_ivec_0x2_low_priority_interrupt_service       code   0x000018
program   0x000004
S_main__low_priority_interrupt_service       code   0x00082a    program
0x0007aa



and examinging the hex file confirms above:

:020000040000FA
:04000000B2EF13F058
:0400080082EF0EF085
:0400180015EF04F0EC


My high speed is in asm, so obviously that goes to
wrong address:


ivec_0x1_high_priority_interrupt_service: code 0X000008
 GOTO _high_priority_interrupt_service



but how can I define this so that it
is not absolute but relative to vectors section.


Also my low priority interrupt vectors in main.c look like:

 void low_priority_interrupt_service() __interrupt(2) {


and my main is plain:

 void main(void) {


so why does this not get relocated in the correct
section?

Any ideas of how to best fix this? I probably can
hack this to work but there must better and worse
ways to do this...

br Kusti



This e-mail may contain confidential or privileged information. If you are not 
the intended recipient (or have received this e-mail in error) please notify 
the sender immediately and destroy this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly 
forbidden. We will not be liable for direct, indirect, special or consequential 
damages arising from alteration of the contents of this message by a third 
party or as a result of any virus being passed on or as of transmission of this 
e-mail in general.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to