New In LPCXpresso IDE v8.20 is support for SPIFI flash programming on the LPC407x and LPC408x MCUs.
The NXP LPC40xx series of MCUs support the connection of external SPIFI flash devices to expand the storage provided by the MCU's internal Flash. New in LPCXpresso IDE v8.20 is support for programming these SPIFI flash devices via a new LPC40xx Generic SPIFI flash driver.
There are a two issues that limit the use of SPIFI flash on these parts:
- The LPC40xx MCU can only be configured to boot from internal flash and not from external SPIFI flash.
- On the LPC40xx, SPIFI flash is mapped to address 0x28000000. However the Cortex M4 architecture does not support the use of hardware breakpoints at addresses above 0x20000000. This limitation makes debugging code located in SPIFI flash impractical.
In consequence although execute in place (XIP) is supported on these parts, for practical purposes SPIFI flash is generally only suitable for storage of data.
Generic SPIFI Flash Driver
A single generic flash driver : "LPC40xx_SPIFI_GENERIC.cfx" can be specified to program any supported SPIFI flash device. Similar to the 'LPC18_43_SPIFI_GENERIC.cfx", this LPC40xx generic driver is built using LPCOpen lpcspifilib and supports programming the same set of SPIFI flash devices.
Supplied with LPCXpresso IDE is a project to create this flash driver. The readme file within this project lists the supported SPIFI flash devices.
The LPC40xx MCU does not support SPIFI flash devices larger than 16MB.
During a programming operation, the flash driver will interrogate the SPIFI flash device to identify its configuration. If the device is recognised, its size and name will be reported in the LPCXpresso IDE Debug log - as below:
inspected v.2 External Flash Device on SPI LPC40xx_SPIFI_GENERIC.cfx
image 'LPC40xx Generic SPIFI Jun 2 2016 17:48:51'
flash variant 'MX25L6435E' detected (8MB = 128*64K at 0x28000000)..
If required, the project memory configuration can then be edited to match the reported device size.
Although the flash driver now reports the size and location of the SPIFI device, the IDE's view of the world is determined by the project memory configuration settings. It remains the users responsibility to ensure these setting match the actual device in use.
To assist the configuration (or creation) of projects containing SPIFI flash, LPCXpresso IDE is supplied with a set of 'memconfig' xml files describing a range of different LPC40xx SPI flash sizes. To make use of these files...
For a given project select:
- C/C++ Build -> MCU Settings
- Browse to e.g. C:\nxp\LPCXpresso_8.x..xxx\lpcxpresso\Wizards\MemConfigs
- and select the appropriate sized file e.g. LPC40xx_SPIFI_8MB.xml, click OK.
This will create a new SPIFI flash region at 0x28000000 of length 8MB and assign the LPC40xx_SPIFI_GENERIC.cfx to the region.
Multi flash projects
Due to the requirement to boot the MCU from internal flash, projects created to utilise SPIFI flash will typically span both flash devices. Attached is an example project targeting the LPC4088 that demonstrates how this might be done.
Also see the FAQ Configuring projects to span multiple flash devices for a comprehensive description of multi flash projects.
For more information
- See: LPCXpresso IDE v8.x User Guide chapter : "Memory Editor and User Loadable Flash Driver mechanism"
- And the following FAQs:
Original Attachment has been moved to: LPC4088_multiple_flash.zip