View previous topic :: View next topic |
Author |
Message |
shital
Joined: 19 Jul 2005 Posts: 8
|
# ORG Problem |
Posted: Tue Jul 19, 2005 7:32 am |
|
|
I am using the bootloader and Quick Programmer P1618QP to download a c file for 18F6621 pic microcontroller. The boot block is from 0x0000 to 0x0800.
When I use # org 0x0800 the compiler gives me an error message INVALID ORG RANGE. Is there a solution to this?
Code: |
# org 0x0800
void main(void)
|
|
|
|
Ttelmah Guest
|
|
Posted: Tue Jul 19, 2005 9:52 am |
|
|
Look at how it is done in the example files, bootload.c, and bootloader.h.
#ORG, _must_ have an 'end' address, as well as a start address. You can only use it with a single variable, where you have already defined a segment, and put the extra code after this.
So the syntax to move 'main' (remember it'll still put the reset vector at address 0, and the interrupt vector code just above this - if you need to move these, the #build command is needed) is:
#ORG 0x800, getenv("PROGRAM_MEMORY")-1 DEFAULT
This will then ensure that this becomes the 'default' location for the remaining code as well.
Best Wishes |
|
|
shital
Joined: 19 Jul 2005 Posts: 8
|
|
Posted: Wed Jul 20, 2005 8:26 am |
|
|
Thank You for your reply
I tried using #ORG 0x800, getenv("PROGRAM_MEMORY")-1 DEFAULT
before main but the compiler gives me the following error messages.
-- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 00000-0FBFE (0000 used)
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 0FC00-0FC1E (0000 used) Priv
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Segment at 0FC20-0FFFE (0000 used)
--- Info 300 "C:\V3\test.c" Line 4018(40,41): More info: Attempted to create: 00800-0FFFE for #org
*** Error 126 "C:\V3\test.c" Line 4018(40,41): Invalid ORG range
Can you help please? |
|
|
shital
Joined: 19 Jul 2005 Posts: 8
|
still having org problems |
Posted: Wed Jul 20, 2005 8:43 am |
|
|
I tried using a start addr and end addr and used # org like it is used in bootloader.c
#org 0x40,0x7F
void main(void)
{
if(!input(PIN_B5))
load_program();
}
#org default
void load_program(void)
{
int i;
i = 1;
return;
}
but I still get an error message as follows when I try to compile.
main
Seg 00040-0007E, 0040 left, need 00CC
0000
*** Error 71 "C:\trial\test.c" Line 4148(0,1): Out of ROM, A segment or the program is too large. I tried increasing the org range but i still get the same error.
I am using the PIC18f6621 and actually want to start my main at 800h and my interrupt code at 808h and 818h. The reset vector can be at 0.
I am trying to use the Quick Programmer P1618QP to download the code. |
|
|
|