1.6.1 Single Application Image Memory Map

Overview

This simplest memory map of a bootloader is the single application enabled bootloader model shown below. It divides the code space into two spaces. The first space contains the bootloader code and the second will contain the application image. A map of two memory spaces are shown below.

Figure 1-10.  Single Image Memory Map

Looking in more detail at the above memory map, the bootloader space is where the bootloader image resides including the IVT and AIVT. The bootloader space can only be modified by programming a new bootloader.

The second memory space is the where the application code resides. The application code includes the remapped interrupt vectors. The application image is downloaded using an external host to send the new image over the communication protocol selected. With this single application image model, there is only a single application image that is erased and reprogrammed when a new image is loaded. So if the download process fails, the application can become corrupted and the device has no fall back  

Finally, the last page of the physical flash is where the device flash configuration words are located. The configuration values are programmed when the bootloader is programmed. The bootloader will not modify these values or perform any flash operation on this page of flash.

Configuring the Bootloader for a Single Application Image  

The bootloader configuration screen shown below is for the basic Single Partition Configuration Screen. Notice that there is only a single Application Image and this location will be used for both the Executable and Download location. The maximum size of this image is the amount of the flash not used for the bootloader.

Figure 1-11.  Partition Config Screen Single

Defining the Size of the Bootloader

Defining the size of the bootloader mainly involves determining the size of the bootloader today plus any spare space needed to accommodate new features in the future. It's very important to provide for this extra space before finalizing size of this space. If you need to change size of the allocated bootloader flash memory space in the future, the start of the application would need to change and then the location of the Remapped Interrupt Vector Table will change. Changing the size of space allocated to the bootloader will also change the start of the application space and the location of the AIVT. These last two changes then mean that this application will not work with older bootloaders. Once the size of the flash allocated for the bootloader is determined, the rest of the flash memory can be allocated to the application and the Remapped Interrupt Vector Tables as shown above.

Finally, the size of the bootloader needs to align to the page size of the device. For devices with page sizes of 512 instructions(1024 words), the page size needs to be modulus 0x400. Likewise, for devices with page sizes of 1024 instructions(2048 words), the page size needs to be modulus 0x800.

The user can determine the actual current size of the bootloader by looking at the map file of the current project, but this value will have no guard space in it. It is the actual size of the flash used by the bootloader today. Also, the value used in the GUI must be modulus page size.