This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSCNCD263P: How exactly XIP works

Part Number: TMDSCNCD263P
Other Parts Discussed in Thread: SYSCONFIG, UNIFLASH

Tool/software:

Hi Team,

My understanding of XIP (eXecute In Place) is that it fetches and executes the instructions of the final application binary directly from external NOR Flash via the OSPI interface, instruction by instruction.

To understand the implementation details in code, I referred to two examples from the SDK:

  1. SDK_path\examples\drivers\ospi\ospi_flash_xip\am263px-cc

  2. SDK_path\examples\hello_world_xip_fss1\am263px-cc

However, these examples have created a lot of confusion:

  1. In the ospi_flash_xip example, the OSPI instance is configured using SysConfig, and the peripheral is also initialized in the code.

  2. In the hello_world_xip_fss1 example, OSPI is not added in SysConfig, and there is no explicit code initializing OSPI. However, the documentation claims "This example other than just doing the driver and board initialization and prints the string, Hello World! on UART console. It does that while doing the XIP from FSS1 interface."

  3. on the other hand the ospi_flash_xip example just writes some known data to flash, reads it back, and then calculates a CRC to verify if it matches and prints test pass or fail. It's unclear how this is demonstrating XIP functionality.

  4. I referred to the SBL_OSPI_Multicore_elf secondary bootloader example project. In that project, only the OSPI peripheral is initialized in the code—no Flash read/write APIs are used. I flashed the SBL image and the LED blink application image into flash using the uniflash.py script, changed the boot DIP switches to xSPI mode, and the code worked fine—the LED blinked as expected. How XIP is taken care in this?

So my questions are:

  • To implement XIP and execute code directly from flash, are Flash Read/Write APIs really required?

  • Wouldn’t only OSPI Read/Write APIs be sufficient for this purpose?

  • When flashing a .mcelf or .mcelf-xip file into external flash, does the entire image get written to the flash device, or only certain parts or segments? During boot, the RBL (ROM Bootloader) copies the entire SBL into RAM and executes it, which works as expected. But what about the application image? Does the RBL or SBL copy certain segments of the application (such as code, .text, read-only data, .data, etc.) into RAM for execution, or are all these segments kept in external flash, with execution starting directly from the first instruction in flash?

Thanks in advance....

Quick response is much appreciated