Attached demo is sample project to show how to erase and program LPC54018JxM’s internal flash(embedded 2MB/4MB W25Q Flash) through SPIFI0 interface.
As we know LPC54018JxM:XIP(Run-time instruction) and data fetches from SPIFI flash. SPIFI commands using the SPIFI CMD register are not allowed while fetching instructions (XIP mode) or data from SPIFI flash. Code required for sending SPIFI commands that use the SPIFI CMD register must be located in on-chip SRAM.
In order to run code from on-chip SRAM, the KEIL scatter file was modified, placed the SPIFI program code into internal RAM at 0x20000000. At startup, there is a automatism to load the code into the RAM.
The demo is based on SDK_2.6.0_LPC54018M\boards\lpcxpresso54s018m\demo_apps\hello_world_qspi_xip