

Therefore, under this scheme, the bootloader cannot erase the main application, as it may need to access the C library code. Remember that if you build a combined main and bootloader application, the two portions share the same copy of the C library code, by default residing in the main application area. You will also have to manage any bootloader interrupt vectors yourself. Replace myarea with any name you choose and replace the address range with the address range of your choice.

Then in the Build Options - Target “Other Options” edit box, enter: If you want to put certain code functions in a separate “bootloader” region, you can use the “ #pragma text:myarea” extension to allocate a function in your own area. This allows the same interrupt handler pragma to be used in your source code whether it is a normal or bootloader application. The IDE generates the -bvector:0x? switch to the linker to relocate the vector absolute area to high memory. if the target device has more than 64K bytes of flash, the checkbox “Use ELPM” is automatically selected.Ĥ. A non-standard Startup File is used to enable vector relocation to the bootloader region by modifying the IVSEL register and setting the RAMPZ to the location of the bootloader page. The following defines tell the bootloader firmware where application entry points are to be expected. The starting address for the program is moved to the start of the bootloader area, leaving space for the interrupt vectors.Ģ. The IDE does the following for standalone bootloader by generating appropriate compiler flags:ġ. Select the boot size you wish to use in Build Options - Target. You can either build a bootloader as a standalone application or have a single application that contains both the main code and the bootloader code. Some of the newer megadevices support bootloader applications.
