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

what is a bootloader ?

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



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

what is a bootloader ?
PostPosted: Wed Oct 15, 2008 9:41 am     Reply with quote

Can someone tell me
1.) What is a boot loader ?
2.) What does it do ?
3.) When do we have to use it ?
4.) How to use it ?
5.) Are PICs initially programmed with boot loader or do we have to do it ourselves after buying a PIC ?

Some A to Z tutorial would be great. Smile

and if i use ICSP like business card programmer to program a PIC do i have to program PIC with boot loader first or can i simply connect ICSP to pic and program it?


I'm new to PIC Embarassed
Thanks
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 12:23 pm     Reply with quote

For a more detailed description, I would suggest you google or wikipedia it. Both should have more info than this.

1-2) A bootloader is a small program placed in a microcontroller that allows it to startup and look for a particular condition to determine if it needs to have code loaded to it. This program will contain code that will direct it to start monitoring say a serial port for it to download code from. It will download the code from the host and program itself. Once completed, it should restart and run the new code...unless it sees it is in the download condition. Then it would try to download again. This allows the engineer to have one programmed device placed in multiple designs, and once the product is built, the correct code for the given product can be loaded to it.

For example: I have a PIC that I use on 10 different designs, that all require different operating code. Instead of ordering 10 different programmed devices, I can order 1 programmed device. Build my 10 different assemblies, and once they reach the test area, I could say load test code to them. Go through test, then reload them with current production code at the latest revision. Using such a scheme allows you to ship the current latest and greatest code. This also opens up the possibility to do field upgrades. The customer could connect the device to their laptop, set a jumper (To create the code load condition), then load new upgraded code to it. There are several ways to do it, the jumper way is just one.

3) Depends on your design. If you want your product to have that capability or not.

4) Use the search function in this forum, and look for bootloader. Also look at the examples in your PICC directory. Sorry for such a vague answer, but it really is the only way.

5) No, they do not come with one loaded. You can either load one yourself via the ICSP pins, or if can afford it, you can have the devices preprogrammed at a programming center.

Lastly...If you load a bootloader, you can do it one time for that device, then as you are developing your code, you can use just a serial port to load new versions of code to it. Google it. Let google be your friend.
Good luck.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 12:51 pm     Reply with quote

ECACE wrote:
For a more detailed description, I would suggest you google or wikipedia it. Both should have more info than this.

1-2) A bootloader is a small program placed in a microcontroller that allows it to startup and look for a particular condition to determine if it needs to have code loaded to it. This program will contain code that will direct it to start monitoring say a serial port for it to download code from. It will download the code from the host and program itself. Once completed, it should restart and run the new code...unless it sees it is in the download condition. Then it would try to download again. This allows the engineer to have one programmed device placed in multiple designs, and once the product is built, the correct code for the given product can be loaded to it.

For example: I have a PIC that I use on 10 different designs, that all require different operating code. Instead of ordering 10 different programmed devices, I can order 1 programmed device. Build my 10 different assemblies, and once they reach the test area, I could say load test code to them. Go through test, then reload them with current production code at the latest revision. Using such a scheme allows you to ship the current latest and greatest code. This also opens up the possibility to do field upgrades. The customer could connect the device to their laptop, set a jumper (To create the code load condition), then load new upgraded code to it. There are several ways to do it, the jumper way is just one.

3) Depends on your design. If you want your product to have that capability or not.

4) Use the search function in this forum, and look for bootloader. Also look at the examples in your PICC directory. Sorry for such a vague answer, but it really is the only way.

5) No, they do not come with one loaded. You can either load one yourself via the ICSP pins, or if can afford it, you can have the devices preprogrammed at a programming center.

Lastly...If you load a bootloader, you can do it one time for that device, then as you are developing your code, you can use just a serial port to load new versions of code to it. Google it. Let google be your friend.
Good luck.


thanks but i have some more questions Question .

how to make my circuit to compatible with boot loader jumper method(any schematic?)
did you mean by "if you load a bootloader, you can do it one time for that device" that i can program a boot loader to a PIC only one time and after that i have to buy new pic if i want to change bootloader?

what is the different between ICSP and boot loader? i mean we can program a pic without removing it from circuit using ICSP and what i understand from your answer is that boot loader does same thing.

do i need special circuit and software to upgrade a PIC through boot loader? or can i do it through ICSP or a any other programmer and using current programming software(WinPIC) i use? Embarassed
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 12:52 pm     Reply with quote

Just to help on finding posts, this thread has some good posts by ckeilstra on technical aspects of bootloaders:
http://www.ccsinfo.com/forum/viewtopic.php?t=32558
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 12:54 pm     Reply with quote

PCM programmer wrote:
Just to help on finding posts, this thread has some good posts by ckeilstra on technical aspects of bootloaders:
http://www.ccsinfo.com/forum/viewtopic.php?t=32558

thanks.can you check my above post?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 1:04 pm     Reply with quote

No. I just wanted to give the link.
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 1:06 pm     Reply with quote

PCM programmer wrote:
No. I just wanted to give the link.

ok
ECACE



Joined: 24 Jul 2006
Posts: 94

View user's profile Send private message

PostPosted: Wed Oct 15, 2008 1:15 pm     Reply with quote

Definitely read the posts at the link PCM sent.

Go to your PICC/Examples/bootloader.c file. Look at main(). It is looking for a high/low condition at one pin to determine if it should go into bootload or not. you would tie that pin or whichever one you want to use in your design to +5 via a 4.7K resistor. when the jumper is in place then, it ties the I/O pin to ground. When the jumper is removed, the I/O line would be high. This is probably the easiest way to do it.

A bootloader is just a small program that gives the processor enough intelligence to look at one pin to determine if it is in boot load or not. If it is, then it looks to the serial port for code to load into itself. If it does not see that condition, then it jumps out of bootloader mode and tries to go to operating code.

ICSP is what is used to program the PIC initially. At your desk you can connect your PIC with either bootloader code or operating code. If you have a bootloader in you pic, it is like the picture below. The loader always exists in the PIC. On startup it checks to see if a given condition has been met or not. If it has, then it goes into bootloader mode where it tries to download code If it has not been met, then it goes on to operating code.

Code section of PIC
---------------------------------------------------------
bootloader | Operating code
---------------------------------------------------------

The bootloader can load and program the PIC from a host (Your PC) via serial port. In this case, you would just send the hex file down via any terminal program. This would be just via serial port.
The ICSP is for programing the whole pic with a given code. You could use the ICSP to load either bootloader or Operating code, but you probably wouldn't load both. To program via the ICSP you need PIC specific programs and hardware to program the PIC with. Bootloaders allow you to reprogram your devices via a serial port. But the first time through you would have to program them with a bootloader via ICSP. You don't have to use the bootloader. It is a nice function to add to your products for future upgrades. It probably is not the best place for a beginner to start out. you need to google it to get a better feel for what exactly a bootloader is.
_________________
A HW Engineer 'trying' to do SW !!! Run!!!
asmallri



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

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

PostPosted: Wed Oct 15, 2008 8:47 pm     Reply with quote

Quote:
how to make my circuit to compatible with boot loader jumper method(any schematic?)


There are multiple ways to invoke a bootloader. One way is to have the bootloader cheap the state of an input pin when the PIC is reset. Based on the state of the pin, the bootloader will stay in bootloader mode waiting for code to be installed into the PIC or it will jump to the user code if present.

Quote:
did you mean by "if you load a bootloader, you can do it one time for that device" that i can program a boot loader to a PIC only one time and after that i have to buy new pic if i want to change bootloader?


No. You program a bootloader into a PIC via ISCP. If at some future time you want to replace the existing bootloader with another bootloader you can either reprogram the PIC with a new bootloader or, in special cases, it is possible to use the bootloader to bootload a new bootloader!! However this would generally be a two step process - bootload a temporary bootloader into a different area of program memory, jump to this new bootloader and then use it to bootload another bootloader into the original location of the first bootloader. I had to use this technique once to replace a bootloader for remote devices 1000s of km away to recover from a bootloader timing bug.

Quote:
what is the different between ICSP and boot loader? i mean we can program a pic without removing it from circuit using ICSP and what i understand from your answer is that boot loader does same thing.


ICSP requires some external device (could be another PIC on the same PCB) to program the target PIC via the PIC's external ISCP pins. A bootloader is a piece of code that you have installed via ICSP. Once the PIC is reset the bootloader code then handles self programming of the PIC. In other words no external device is required to drive programming pins on the PIC.

Quote:
do i need special circuit and software to upgrade a PIC through boot loader?

You do not usually require special hardware unless your bootloader was specially built to do so. For example a bootloader could be used to read an external EEPROM to compare a "key" with information passed to the bootloader to prevent unauthorized attempts at loading code to a PIC.

You do need some application to send you code to the PIC. This could be as simple as Hyperterm to use a bootloader that loads via a serial interface, it could be a special program running on a PC to bootload via an Ethernet interface or it might via a standard intel hex file or binary image stored on an SD card.

Quote:
or can i do it through ICSP or a any other programmer and using current programming software(WinPIC) i use? Embarassed


If you were using ICSP then you do not need a bootloader. ICSP means you are using an external device to program the PIC via external programming control lines whereas the bootloader is code you have previously installed on the PIC enableing the PIC to self program
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
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