View previous topic :: View next topic |
Author |
Message |
misperry
Joined: 03 Mar 2009 Posts: 40
|
Lock Memory for Boot Loader |
Posted: Mon May 18, 2009 3:27 pm |
|
|
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
|
|
Posted: Mon May 18, 2009 3:38 pm |
|
|
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
|
|
Posted: Mon May 18, 2009 4:10 pm |
|
|
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
|
|
Posted: Tue May 19, 2009 12:10 am |
|
|
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
|
|
Posted: Tue May 19, 2009 7:55 am |
|
|
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? |
|
|
|