This secondary bootloader enables code execution from OSPI PSRAM by transferring the XIP image (the image ending with the .mcelf_xip extension) from the OSPI NOR Flash to the OSPI PSRAM. By dynamically switching between the OSPI NOR Flash and OSPI PSRAM, this example also demonstrates how different sections are loaded to different memory regions such as the OSPI PSRAM.
Perform the following steps to enable code execution from OSPI PSRAM using SBL OSPI PSRAM:
- After building the example, use the offsets specified in default_sbl_ospi_psram.cfg to flash the .mcelf.hs_fs and the .mcelf_xip images.
- After flashing the binaries in UART boot mode, power off the EVM, switch to the OSPI boot mode, and power on the EVM.
Note: Use the offsets specified in the .cfg file, because the offset at which the XIP image is written must match the XIP_FLASH_OFFSET defined in the main.c file of the SBL OSPI PSRAM example.
When the OSPI_SW_SEL is driven high, the following memory layout of the OSPI PSRAM is visible to the CPU in DAC mode:
When the OSPI_SW_SEL is driven low, the following memory layout of the OSPI NOR Flash is visible to the CPU in DAC mode:
Note: The memory region defined for OSPI PSRAM must always be marked as "Cached" and the memory region for OSPI NOR Flash must be marked as "Strongly Ordered" if Flash writes are being performed in the memory region.