What is bootloader

Thread Starter

rakeshm55

Joined Oct 19, 2010
68
What is bootloader for a microcontroller say MSP430...

Is it a program permanently embedded into the microcontroller inorder to fuse user specified codes into the flash..

I have noticed that bootloader in invoked by applying specific reset sequence .... does that mean that once above sequence is applied the reset vector will be different from normal reset vector location...

please help
 

debjit625

Joined Apr 17, 2010
790
Is it a program permanently embedded into the microcontroller in order to fuse user specified codes into the flash..
Yes.
I have noticed that boot loader in invoked by applying specific reset sequence .... does that mean that once above sequence is applied the reset vector will be different from normal reset vector location...
Normally in any mcu the reset vector is the address where the memory starts, but in some mcu we have more reset vectors where the program can jump directly any time the reset is called by hardware method or software method. For example if your boot loader in your mcu is from memory location 0000H to 0010H,and your mcu have only one reset vector i.e.. 0000H (default reset vector), than if your boot loader loads a program into the flash memory and while running ,the program calls for a reset then it will jump to 0000H ,where the boot loader starts...so the boot loader will be called but the logic your program just want to start the program again not the boot loader so, many mcu have different reset vectors for different use. Your program will use a reset vector greater than 0000H so that whenever your program calls for reset , it restarts the program not the boot loader.

EDIT:
This is the wrong place you posted ,it should be posted at Embedded Systems and Microcontrollers section.

Good Luck
 
Last edited:

t06afre

Joined May 11, 2009
5,934
A bootloader is small program inside the micro controller. That manages downloading code from an external source. Most often Rs232 or USB. The boot loader concept is used on the arduino and PIC-AXE. The bootloader is the poor mans programmer device. The problem using a bootloader is the day you fry your micro. Then it will chicken or the egg causality dilemma once again. Unless you have a programmer to load the boot loader program into your micro, you will not be able to do anything with your micro. As micros do not come with a preloaded bootloader from the factory
 

ErnieM

Joined Apr 24, 2011
8,377
I just completed some work on a PIC32 bootloader. Generally, a bootloader is the first code that runs on a reset. It needs a trigger to perform one of two actions:

A) Jump to some other pre-loaded application program in a predefined starting location.

B) Load program code and save it to (flash) memory, then do A.

Thus the microcontroller that uses the bootloader has to be capable of changing it's own program memory.

Further complications in building these things entails custom link scripts to place the application code at the correct place.

It's not a beginners task, unless you have a package that comes with a bootloader and instructions on how to create code the bootloader can use.
 

MrChips

Joined Oct 2, 2009
30,810
Some micros require a two-stage loading process using what is called a bootloader (or bootstrap loader) followed by a binary loader.

The bootloader is hard coded in the ROM of the MCU and cannot be destroyed. It is usually a simple procedure to read bytes from a serial port (SCI, SPI or USB) and load these bytes into SRAM. These bytes that are being load constitute the binary loader. The bootloader may perform very little or no error checking.

The binary loader can be written by the user but usually is supplied by the software development company that provides the IDE (integrated development environment) package. The purpose of the binary loader is to provide more comprehensive error checking to ensure the integrity of the downloading of the final target application program. Usually, the entire process of loading the application program into FLASH is transparent to the user, that is, the user is not aware of the different processes happening behind the scene.

(btw, if you fry your micro there is no other option anyway but to throw it away.)
 

ftsolutions

Joined Nov 21, 2009
48
There are quite a number of MCUs which come pre-programmed with their own bootloaders in ROM (or even flash) from the factory. Freescale MC56F8xxx and NXP LPC2xxx ARM microcontrollers are but a few examples of the many. A JTAG type of programming/debugging device is the best way to go, but many have gotten started with microcontroller programming simply by using the native bootloader in the chip to load their application code. It is not easy to debug, nor is it time efficient though.
 

ErnieM

Joined Apr 24, 2011
8,377
While as a developer you should always have a proper device programmer on hand, that is not a good option for field reprogramming when you need to let your customers re-flash their devices.

Thus a bootloader has its best use in the field.
 
Top