CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Hex File in wrong place

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
qwerty2002



Joined: 30 Sep 2007
Posts: 5

View user's profile Send private message

Hex File in wrong place
PostPosted: Sun Sep 30, 2007 2:00 am     Reply with quote

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?
qwerty2002



Joined: 30 Sep 2007
Posts: 5

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 2:03 am     Reply with quote

http://rapidshare.com/files/59238200/18F2550_USB_HID_CRC_Oscilloscope.hex.html

Here is the link to the hex file.
Ttelmah
Guest







PostPosted: Sun Sep 30, 2007 2:30 am     Reply with quote

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
Guest








PostPosted: Sun Sep 30, 2007 8:49 pm     Reply with quote

I just used 7000 just cause. I was getting an error saying invalid ORG range, so I was just picking random numbers?
qwerty2002



Joined: 30 Sep 2007
Posts: 5

View user's profile Send private message

PostPosted: Sun Sep 30, 2007 9:24 pm     Reply with quote

#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.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 1:34 am     Reply with quote

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 {}
qwerty2002



Joined: 30 Sep 2007
Posts: 5

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 12:17 pm     Reply with quote

Thanks alot.

Could someone check out my hex file? I think its starting where the bootloader code is, even though I have a ORG statement.

#build(reset=0x800, interrupt=0x808)

#ORG 0x08A9,0x3000 {}

http://rapidshare.com/files/59568343/18F2550_USB_HID_CRC_Oscilloscope.hex.html

Thanks
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 3:50 pm     Reply with quote

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?
qwerty2002



Joined: 30 Sep 2007
Posts: 5

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 6:52 pm     Reply with quote

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!!!
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Oct 02, 2007 1:36 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group