Placing the Entire Code Inside the Boot Section

It is necessary to include the linker options as shown in the following figure to place the entire application code in the Boot section of Flash. The location and size of the Boot section varies with the device being used and fuse settings. Programming the BOOTRST fuse will move the reset vector to the beginning of the Boot section. It is also possible to move all the interrupt vectors to the Boot section. For more information, refer to the interrupt section in the device datasheet.

Figure 1. Adding the Linker Script

The linker miscellaneous option should be defined with the corresponding start address of the bootloader. The Bootloader starting word address of ATmega128 4K bootloader is 0xF000. The linker option should be updated with the byte address Hence, equivalent byte address = 0x1E000. By including the linker script as shown in the preceeding figure, the entire application code will be placed inside the boot section.