2.3 Steps for Implementing in Other Devices
This firmware can be reused with other AVR devices having specific bootloader segment.
The steps for reusing the code are as follows:
        - Change the following macro
                    available in the 
self_programming.hfile with the available boot segment size of the devie in use.#define BOOTSECTORSIZE 0x2000// 4096 words - Change the following macro
                    available in the 
self_programming.hfile with the location for flash recovery buffer based on the available flash size.#define ADR_FLASH_BUFFER 0xEF00 - Change the flash segment
                    definition available under the project properties window corresponding to the
                    boot memory space and use the attribute BOOTLOADER SECTION to place the desired
                    functions into this segment as shown in the Figure 1-2. This figure shows the memory segment
                    definition for ATmega128. The Bootloader starting word address of ATmega128 4K
                    bootloader is 0xF000.
Similarly update the memory segment definition for the device in use.
 - Ensure that the required BOOTSZ fuse setting is programmed. For ATmega128, it should be 4096W_F000.
 
Implementing in Devices without dedicated Boot Section
While implementing the code for the devices which do not have dedicated boot section, ensure that the following conditions are satisfied,
- For the devices which do not have a dedicated boot section, use the last few pages of the flash as boot section to place the flash write function. The flash write routine consumes approximately 550 bytes of memory. Hence, make sure that the emulated boot section is not less that 550 bytes.
 - Provide the address of the flash write function and address of the recovery flash buffer in such a way that the actual application code is not overwritten.
 
