![]() |
![]() |
Chinese
Version
|
|
Give Your Project the Boot! With flash memory becoming more readily available in microcontrollers, the possibility of software updates in applications can now be more easily realized. This article is a brief outline on how to develop a bootloader for a Microchip PIC processor (16F87x). The same procedure, however, could be applied to many other types of processors (8051, ARM, MSP430, etc.). Before any coding starts, you should first think about how things are going to be positioned in program memory. Since the bootloader needs control after reset, it will need to use the reset vector. Since it would be nice to make it easy to build bootloader compatible programs, it is best if the bootloader is positioned entirely at the start of memory, or, all at the end of memory. On mid-range PICs, the regular interrupt vector is located at address 0x4. If the bootloader was going to be posistioned entirely at the start of memory, it would then have to redirect the interrupt vector to the downloaded program. Since this would add complexity to the code and latency to the vector, the bootloader will be posistioned at the end of memory. The reset vector will still be needed, so this will mean shifting the downloaded program's reset vector elsewhere. The diagram above shows the memory map of a program with and without the bootloader installed. In Figure A, typically the reset vector contains instructions to jump into the main program. As the bootloader needs the reset vector, you must move the downloaded program's reset vector now points to the bootloader code and the downloaded to an address just before the bootlaoder. How it works:
This bootloader is suitable for the following processors: 16F870, 16F871, 16F873, 16F873A, 16F874, 16F874A, 16F876, 16F876A, 16F877, 16F877A. All source code, documentation and a sample download program is included with the latest version of the compiler. There is also further information on HI-TECH Software's online forums. |
|
|
The 10th Floor, Quantum Plaza, No. 27, Zhichun Road, Haidian District, Beijing, 100083, P.R. China |
|
|
Tel: +86-10-82357579, 82357580, 82357576
Fax: +86-10-82357574 |
![]() |
info@mcu-world.com |