Writing data to execute-in-place SPI Flash from the running program (LPC-Link2)

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by dhfcghf6 on Mon Dec 28 01:51:46 MST 2015

How to write/update/read data to execute-in-place SPI Flash from the running program?

Our target is LPC-Link2, which has LPC4370(flashless) MCU and one SPI Flash on it. 
Since LPC4370 is a flashless part, the code is stored in the SPI Flash. 
So, I think the code for SPI Flash updating should be relocated to, and then run in IRAM. 

I'm using another LPC-Link2 as a debugger attached to the target LPC-Link2. 

IDE is LPCXpresso 7.7.2. 

(Q-1) Is there any working example for LPC-Link2?

I've found some discussions but they seem to be obsolete.
For example:

Winbond W25Q80BV Support spifilib LPCLink2 Board (Wed, 2014-08-06)

Run-Time Self-Programming in LPC4370 SPIFI MODE (Tue, 2014-04-29)

I couldn't find any relocation example in the latest LPCOpen.

LPCOpen Software Development Platform (LPC43xx packages)
v2.12 for LPC-Link 2 (LPC4370) board (05/15/2014)

(Q-2) Where is "The page below" referred in p. 35 of LPCSPIFILIB document? 

The API Documentation of SPIFI Library contains a reference to the way how to relocate library code to another memory. 
But I couldn't find it. 

In "SPIFI Library" web page
there is a link to API Documentation [pdf]  (version: Thu Jan 22 2015 17:46:11)

At the bottom of p. 35, there is the following description:

"If you are using a SPIFI FLASH device as a execute-in-place memory for your LPC device, you can’t use the SPIFI library if it’s located in SPIFI FLASH.
To use the library in this case, the library needs to be relocated to another memory (like IRAM) and the functions executed from there.
The page below describes how to setup and use the library in this type of system.
Copyright (C) 2014 NXP Semiconductors. All rights reserved. "

I would like to know where is "The page below" referred from this paragraph.
The last line of the paragraph ("Copyright (C) 2014 NXP Semiconductors. All rights reserved.") is linked to Section 4.9 (p. 33) which is blank.

(Q-3) Modification of debug launch configuration necessary with SPIFI Library relocation? 

When the SPIFI Library is relocated to IRAM, is it necessary to modify debug launch configuration for LPC-Link2 debugger?

Running code from RAM (Mon, 2014-02-17)
"But note that if you are using LPC-Link2 as your debug probe and want to download to RAM, then you will need to modify the debug launch configuration"

How to build and debug LPC-Link 2 LPCXpresso IRAM only projects? (Mon, 2014-01-20)