mikroBootloader


This program was written to be used with one of mikroElektronika's compilers.
All values in base 10

Index

What is a bootloader
Supported PICs
How to use mikroBootloader
Version history

What is a bootloader

Took from document AN732 by Microchip
The PIC16F87X family of microcontrollers has the ability to write to their own program memory. This feature allows a small bootloader program to receive and write new firmware into memory. In its most simple form, the bootloader starts the user code running, unless it finds that new firmware should be downloaded. If there is new firmware to be downloaded, it gets the data and writes it into program memory. There are many variations and additional features that can be added to improve reliability and simplify the use of the bootloader.

Features
The more common features a bootloader may have are listed below:
• Code at the Reset location.
• Code elsewhere in a small area of memory.
• Checks to see if the user wants new user code to be loaded.
• Starts execution of the user code if no new user code is to be loaded.
• Receives new user code via a communication channel if code is to be loaded.
• Programs the new user code into memory.
OPERATION
The boot code begins by giving the computer to connect to him in 5 sec. If not, it starts running the existing user code. If there is new user code to be downloaded, the boot code receives and writes the data into program memory. There are many ways that this can be done, as well as many ways to ensure reliability and ease of use.

Integrating User Code and Boot Code
The boot code almost always uses the Reset location and some additional program memory. It is a simple piece of code that does not need to use interrupts; therefore, the user code can use the normal interrupt vector at 0x0004. The boot code must avoid using the interrupt vector, so it should have a program branch in the address range 0x0000 to 0x0003. The boot code must be programmed into memory using conventional programming techniques, and the configuration bits must be programmed at this time. The boot code is unable to access the configuration bits, since they are not mapped into the program memory space.

Supported PICs

1.  All PICs that have Flash write option.

How to use mikroBootloader

1. Load the PIC with the HEX file with the same file number using conventional programming techniques.
   eg. For PIC16F877A use p16f877a.hex

2. Start mikroBootloader by double clicking on bootloader.exe

3. Click on "Setup Port" and select the COM port that will be used.
   Make sure the BAUD is set to 9600KBPs
   
4. Click on "Open file" and select the HEX file you would like to upload.

5. Since the bootcode in the PIC only gives the computer 4-5 sec to connect, you 
   should RESET the PIC and then click on the "Connect" button within 4-5 sec.
   
6. The last line in the history window should now read "Connected"

7. To start the upload, just click on the "Start Bootloader" button.

8. If the bootloader finishes successfuly reset your PIC to start the program.



Version History

   v 1.0.0   24 February 2005
        First release
   v 2.0.0   26 June 2007
        Corrected problems with HEX files greater than 64K  
   Info: http://www.mikroe.com	
         http://www.mikroe.com/forum
   
   
Credits: Anton Rieckert < anton.rieckert@gmail.com >