Using SPM Instructions

The Flash memory may be programmed using the Store Program Memory (SPM) instruction. On devices containing the Self Programming feature the program memory is divided into two main sections: (1) Application Flash Section and (2) Boot Flash Section.

On devices with boot block, the SPM instruction has the ability to write to the entire Flash memory, but can only be executed from the Boot section. Executing SPM from the Application section will have no effect. On the smaller devices that do not have a boot block, the SPM instruction can be executed from the entire flash memory.

During Flash write to the Boot section the CPU is always halted. However, most devices may execute code (read) from the Boot section while writing to the Application section. It is important that the code executed while writing to the Application section do not attempt to read from the Application section. If this happens the entire program execution may be corrupted.

The size and location of these two memory sections are depending upon device and fuse settings. Some devices have the ability to execute the SPM instruction from the entire Flash memory space.