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 support@ccsinfo.com

Bootloader isn't writing the ID Bytes

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



Joined: 06 Dec 2005
Posts: 59

View user's profile Send private message

Bootloader isn't writing the ID Bytes
PostPosted: Wed Aug 25, 2010 6:17 am     Reply with quote

v4.014
18F2685

Dear,

I use the loader.c example for a bootloader.
It works fine for the program code but it doesn't write the ID bytes at address 0x200000...0x200007. I tried it with code protection on and off.

This piece of code makes restrictions for the bootloader area and for
addresses above 0x300000 but not for the required ID location at 0x200000...0x200007, that is below 0x300000.
Code:

#if defined(__PCM__)
} else if ((addr < LOADER_ADDR || addr > LOADER_END) && addr < 0x2000){
#elif defined(__PCH__)
} else if ((addr < LOADER_ADDR || addr > LOADER_END) && addr <
0x300000){
#endif

Has someone an idea what to do that the bootloader writes the ID bytes, too?

Best regards
nilsener
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Aug 26, 2010 12:53 am     Reply with quote

Step 1. Select a PIC capable of writing the config bits.

Step 2. Modify the bootloader to write to the config space.

Step 3. Bootloader user code that writes to the config bits.

Then - in 90% plus examples where a bootloader allows the fuse setting of the applicaton to be used and where the wrong fuse settings were written to the PIC: The bootloader will no longer function, so recover the unit from the field, erase and reprogram the PIC with the bootloader.

Hint in general you should not allow a bootloader to rewrite the fuses.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
nilsener



Joined: 06 Dec 2005
Posts: 59

View user's profile Send private message

PostPosted: Thu Aug 26, 2010 1:16 am     Reply with quote

Hello asmallri,

Thanks for reply, but what I need is not to rewrite the fuses but the ID bytes at address 0x200000...0x200007. In my application I have the program checksum at this location. I use:

Code:

#ID CHECKSUM_PROGRAM


After bootloading new software, there is another program checksum that must be written to the ID bytes. I must do it because my application is checking itself by using the program checksum. If checksum is wrong it results in an error message to the user.
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