SPRUJ55D September 2023 – July 2025 AM263P2 , AM263P2-Q1 , AM263P4 , AM263P4-Q1
The boot placement in the flash is controlled by the below MMRs present in MSS_CTRL:
For documentation ease, the MSS_OSPI_BOOT_CONFIG_SEG_BOOT_SEG[19:0] will be referred to as _boot_segment_. and the MSS_OSPI_BOOT_CONFIG_MASK_BOOT_SIZE [19:0] will be referred to as _boot_mask_. The FSS boot region (Region 1) can be defined as a 4KB through 128MB block. Which 4KB through 128MB region of the 128M Byte is defined by the _boot_segment_ register. These _boot_segment_ bits replace the required number of bits of the 32-bit internal address based on segment size (determined by _boot_mask) when reading or writing region 1. The _boot_mask_ determines which bits are replaced. Since minimum boot region granularity is 4KB, the FSS boot region 1 only specifies 20 bits of address, the upper 20 bits of a 32-bit internal address will be derived from the _boot_segment_ and _boot_mask_ registers. The _boot_segment_ will replace the upper 20 bits of the internal address based on segment size derived from _boot_mask_ which will determine the bits to be replaced.
This allows the boot sector to be placed anywhere within the translated flash space. In addition, this can be used to implement FOTA swap feature which requires CPU address map to remain the same while the firmware in flash is swapped to a different copy. Figure FSS Region 1 Remapping explains this concept in more detail. Typically, when the image binary is created, it is usually linked to load and run from a fixed address. For example, CPU could be executing from firmware A in flash while firmware B is being written (FOTA update). When swap to firmware B is required, SOC can reconfigure _boot_segment_ and _boot_mask_ to point to firmware B in flash while CPU still uses same address map as firmware A. This allows CPU address map to remain the same as previous firmware.
Figure 13-150 FSS Region 1 RemappingThe maximum memory region allocated for External memory Region in SoC is 128 MBytes. This 128 MBytes is addressable with lower 27 bits [26:0]. Hence the five upper address bits[31:27] are used by SoC to identify that it is FSS Data Region 1. Since the minimum granularity is 4KB the lower 12 address bits is taken as it is and not address translated. The Upper [31:12] address bits aligns to _boot_segment_ and _boot_mask_ bits [19:0].
Pseudo Code for address remapping
Example 1: Assume Image A is Primary Boot Image of size ( <=16MB ) located at 0x8000_0000 and Image B is located at offset of 16MB of flash (0x8100_0000). So in this case any access to 0x8000_0000 should be mapped to 0x8100_0000
Hence _boot_segment_ value should be = 0x1000 and _boot_mask_ = 0xFF000 as seen in Figure 13-151
Hence any access to address 0x8000_0000 will be remapped to address 0x8100_0000. In other words the image at location 0x8100_0000 ' before boot_segment & boot_mask configuration' as seen in memory browser will be seen at location 0x8000_0000 ( by ROM / memory browser) 'after boot_segment & boot_mask configuration' .
| Required offset in flash(before ECCMaddress translation | _boot_mask | _boot_segment | Effective offset(before ECCM address Translation) |
|---|---|---|---|
| 4KB (minimum granularity) | 0xFFFFF | 0x00001 | 0x0000_1000 |
| 8KB | 0xFFFFF | 0x00002 | 0x0000_2000 |
| 128KB | 0xFFFE0 | 0x00020 | 0x0002_0000 |
| 64MB | 0xFC000 | 0x04000 | 0x0400_0000 |
Example 2: Consider the scenario where flash total size is 128KB, ECCM is enabled, 16-byte MAC is enabled, and boot segment size (determined by _boot_segment_) is 16KB. For this scenario, the highest address the _boot_segment_ can be placed is address 0xFB12. Most time the boot sector will be set to zero, but this is not required.