View previous topic :: View next topic |
Author |
Message |
qwerty2002
Joined: 30 Sep 2007 Posts: 5
|
Hex File in wrong place |
Posted: Sun Sep 30, 2007 2:00 am |
|
|
I have a bootloader PICDEM FS USB demo board that has the 18F4550. This bootloader requires that user code range from 800h to 7FFFh. The other parts are for EEPROM and other things. Can someone check my hex file i.e. import into MPLAB to make sure its right. I used the ORG statement to start my code at 7000h. I have a feeling its not in the right spot because my program does not work.
Does anyone have a bootloader like mine? |
|
![](templates/subSilver/images/spacer.gif) |
qwerty2002
Joined: 30 Sep 2007 Posts: 5
|
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun Sep 30, 2007 2:30 am |
|
|
If the user code needs to start at 800, then you need to use the _build_ statement, to put the boot vector at this address, and an ORG statement to put the main code up there as well. If the start is 800, why on earth use an ORG of 7000.....
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sun Sep 30, 2007 8:49 pm |
|
|
I just used 7000 just cause. I was getting an error saying invalid ORG range, so I was just picking random numbers? |
|
![](templates/subSilver/images/spacer.gif) |
qwerty2002
Joined: 30 Sep 2007 Posts: 5
|
|
Posted: Sun Sep 30, 2007 9:24 pm |
|
|
#build(memory=0x7000:0x7FFF)
#build(reset=0x800:0x807, interrupt=0x808:0x8A6)
Does this look good? I left out the ORG I don't think its doing anything. |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Oct 01, 2007 1:34 am |
|
|
qwerty2002 wrote: | #build(memory=0x7000:0x7FFF)
#build(reset=0x800:0x807, interrupt=0x808:0x8A6)
| The memory directive is only used when you have external memory chips. And I would remove the end addresses for the reset and interrupt vectors, this makes life easier on you.
Also make sure you have in the beginning of your program a #org statement telling the compiler to reserve the memory up to 0x800 for the bootloader.
Code: | #build(reset=0x800, interrupt=0x808)
#org 0, 0x800 {} |
|
|
![](templates/subSilver/images/spacer.gif) |
qwerty2002
Joined: 30 Sep 2007 Posts: 5
|
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Oct 01, 2007 3:50 pm |
|
|
Quote: | #ORG 0x08A9,0x3000 {} | Please read the manual. Here you are telling the compiler _not_ to use the memory from 0x08A9 to 0x3000, just the opposite of what you want to achieve.
Have you tried my code? Did that work? |
|
![](templates/subSilver/images/spacer.gif) |
qwerty2002
Joined: 30 Sep 2007 Posts: 5
|
|
Posted: Mon Oct 01, 2007 6:52 pm |
|
|
Thank you so much. I did read the CCS manual and I was misinterpreting it. I thought that the memory address in ORG was for the code. I.E. saying in this segment don't allow the bootloader code.
I got it now!!!
It does work!!! |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Oct 02, 2007 1:36 am |
|
|
qwerty2002 wrote: | Thank you so much. I did read the CCS manual and I was misinterpreting it. I thought that the memory address in ORG was for the code. I.E. saying in this segment don't allow the bootloader code. | Your initial assumption was right, with the ORG statement you do reserve a memory region for program code, but the addition of '{}' changes the ORG statement to reserve an empty region.
Happy to hear you have it working now. |
|
![](templates/subSilver/images/spacer.gif) |
|