View previous topic :: View next topic |
Author |
Message |
darryl
Joined: 16 Dec 2005 Posts: 2
|
ORG errors with bootloader |
Posted: Fri Dec 16, 2005 2:27 pm |
|
|
I'm having some odd problems since updating my compiler. I am using a bootload based on the example code which came with the compiler. My target is a PIC18F6720.
The following code use to work fine in my main application. Now it causes an "Invalid ORG Range" error. I've tried changing a number of things but to no avail.
Has anybody come across this before?
Code: |
#define LOADER_END 0xfFF
#define LOADER_SIZE 0xdff
#ifndef _bootloader
#define VERSION_HIGH ((FIRMWARE_VERSION)>>8)
#define VERSION_LOW ((FIRMWARE_VERSION)&0xff)
#if defined(__PCM__)
#build(reset=LOADER_END+1, interrupt=LOADER_END+5)
#elif defined(__PCH__)
#build(reset=LOADER_END+2, interrupt=LOADER_END+8)
#endif
#org 0, LOADER_END {}
#endif
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Dec 16, 2005 2:40 pm |
|
|
Quote: | The following code use to work fine in my main application.
Now it causes an "Invalid ORG Range" error. |
1. Were you using a different PIC for the code that worked ?
If so, what PIC were you using ?
2. Did you change compiler versions ? What was your old version
and what is your current version ? |
|
|
darryl
Joined: 16 Dec 2005 Posts: 2
|
|
Posted: Mon Dec 19, 2005 3:06 pm |
|
|
1) we've always been using the same PIC 18F6720
2) It use to work fine on previous compiler versions 3.191, 3.202, 3.204, but does not now work on our current version 3.241. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Dec 19, 2005 3:57 pm |
|
|
If I take your code and drop it into a test program, it compiles with
no errors with PCH vs. 3.241.
Code: | #include <18F6720.H>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#define LOADER_END 0xfFF
#define LOADER_SIZE 0xdff
#ifndef _bootloader
#define VERSION_HIGH ((FIRMWARE_VERSION)>>8)
#define VERSION_LOW ((FIRMWARE_VERSION)&0xff)
#if defined(__PCM__)
#build(reset=LOADER_END+1, interrupt=LOADER_END+5)
#elif defined(__PCH__)
#build(reset=LOADER_END+2, interrupt=LOADER_END+8)
#endif
#org 0, LOADER_END {}
#endif
//=============================================
void main(void)
{
while(1);
} |
|
|
|
Howard
Joined: 19 Dec 2005 Posts: 2
|
ORG_errors with bootloader |
Posted: Mon Dec 19, 2005 11:05 pm |
|
|
If you try the following code it causes the problem. It appears to be related to using interupts. Remove the interrupt and it compiles properly using PCH ver 3.241
Code: | #include <18F6720.H>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#define LOADER_END 0xfFF
#define LOADER_SIZE 0xdff
#ifndef _bootloader
#define VERSION_HIGH ((FIRMWARE_VERSION)>>8)
#define VERSION_LOW ((FIRMWARE_VERSION)&0xff)
#if defined(__PCM__)
#build(reset=LOADER_END+1, interrupt=LOADER_END+5)
#elif defined(__PCH__)
#build(reset=LOADER_END+2, interrupt=LOADER_END+8)
#endif
#org 0, LOADER_END {}
#endif
int i;
#INT_RTCC
void rtc_code() {
i++;
}
//=============================================
void main(void)
{
while(1);
} |
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Dec 20, 2005 1:17 am |
|
|
To get it to compile with PCH vs. 3.241, I had to increase the value
shown in bold below to 9. I'm not sure how this will affect your
program. You'll have to look at the .LST file.
Quote: | #if defined(__PCM__)
#build(reset=LOADER_END+1, interrupt=LOADER_END+5)
#elif defined(__PCH__)
#build(reset=LOADER_END+2, interrupt=LOADER_END+9)
#endif |
|
|
|
agrj
Joined: 26 Sep 2003 Posts: 48
|
|
Posted: Tue Dec 27, 2005 1:51 pm |
|
|
It worked for me.
thanks!! |
|
|
|