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

Lock Memory for Boot Loader

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



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

Lock Memory for Boot Loader
PostPosted: Mon May 18, 2009 3:27 pm     Reply with quote

Hello, I am programming a 16F886 and I need to be able to lock the first 100bytes of memory for the bootloader that I am using. I was wondering how to do this with the CCS C compiler. I am using tinybootloader. If anyone needs any other information please let me know.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Mon May 18, 2009 3:38 pm     Reply with quote

Consult the datasheet to learn about availaible lock ranges. 256 words is the smallest. Instead of utilizing write protection by fuses, it may be a (slightly less safe) solution to block an exact number of 16-word erase blocks in the bootloader operation against erase/write.
misperry



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

PostPosted: Mon May 18, 2009 4:10 pm     Reply with quote

Thanks for the reply.

The tiny bootloader take 100 words. However, I am not so good with the whole assembly language. I am getting better but am still sort of a noob to it. However, I have programmed in C and C++ for years. But I have the code for the bootloader and I just need to know where the loader lies so I can use #org or something similar to lock that section so that when the main program is flashed to the chip it doesn't write over the bootloader. Let me know if I need to post the bootloader source.

Thanks again for the help
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue May 19, 2009 12:10 am     Reply with quote

So you don't want to lock the code, just reserve the locations. That works in the same way, as documented with the CCS bootloaders. The occupied area can be seen from the *.lst file.
misperry



Joined: 03 Mar 2009
Posts: 40

View user's profile Send private message

PostPosted: Tue May 19, 2009 7:55 am     Reply with quote

Hey there. That is great thanx for the information. I found something on the forum at this location:
http://www.ccsinfo.com/forum/viewtopic.php?t=27214

It explains how to lock a certin set of words. However, I have now a new problem. When the PIC boots it hesitates for a bit and then runs the main program, which is just the led blink program (simple), and durring that time of hesitation I can load code to the chip via the bootloader. I want to be able to load code at anytime without having to do it in a split second when the chip starts up. Now, I thought that I would just use the RTS line to drive the MCLEAR pin so that it would reset the chip uppon sending the new code to it so that it will line up with that small window of opportunity. However, when I do so the chip does not care whether the MCLEAR Pin is tied to a high or not. It still runs the code. This is weird since the MCLEAR should act as a reset switch but it doesn't.

Any thoughts?
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