3.2 Configuring Application for Use with Bootloader
When a bootloader is used, the user application must be located after the
BOOT area. Using BOOTSIZE fuse setting 0x02
as an example, the BOOT
area will have a size of 1024 bytes (2 x 512 bytes). Because the code section is
word-aligned, the start address of the application code will be
0x200
.
For the AVR GCC linker script to know where in the Flash to put the compiled application
code, the .text
code section must be configured to correspond with the
location of the application code section. This relocation is done by utilizing the
following linker option:
-Wl,--section-start=.text=0x200
In AtmelStudio 7.0, the relocation can be done in Project Properties
(Alt+F7) → Toolchain → AVR/GNU Linker → Memory Settings by
adding .text=0x200
to the FLASH segment, as shown in the figure
below.
In MPLAB X, the relocation can be done in File → Project Properties→
Conf → Avr GCC → avr-ld → Memory Settings by adding
.text=0x200
to the FLASH segment, as shown in the figure below.