![]() |
LPCOpen Platform
v1.03
LPCOpen Platform for NXP LPC Microcontrollers
|
Example description
This example demonstrates programming of the SPI flash using the SPIFI interface. The program will run in the SPIFI flash and will relocate the programmer to iram when the SPI flash is being programmed. The program can be run in two ways, the first and the default is having USE_SPIFI_LIB defined so that the code makes use of the functions provided by the spifi_*.lib and the functions in the lib will be relocated to IRAM before execution, the second one is having USE_SPIFI_LIB not defined which will make direct calls to the boot ROM function pointers and will not use any library calls hence no relocation will be done as the code directly executes from the Boot ROM area.
By default the program writes 256 bytes of data starting from hex 00 to hex FF to SPIFI_WRITE_SECTOR_OFFSET
UART needs to be setup prior to running the example as the example produces the output to the UART console. If LED1 is ON then the programming is successful, if LED2 is ON then the programming has failed.
Special connection requirements
There are no special connection requirements for this example.
Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4
LPC18xx/43xx example quickstart for IAR EWARM
LPC18xx/43xx example quickstart for Code Red Xpresso
Supported boards and board setup:
Hitex 1850 evaluation boards
Hitex 4350 evaluation boards
Keil 1857 evaluation boards
Keil 4357 evaluation boards
NGX 1830 Xplorer boards
NGX 4330 Xplorer boards
Submitting LPCOpen issues:
Community support for LPCOpen
Functions | |
| static int | verify_spifi_data (const uint8_t *buff, int size) |
| static void | prepare_write_data (uint8_t *buff, int size) |
| int | main (void) |
| Main entry point. | |
Variables | |
| static uint8_t | data_buffer [PROG_SIZE] |
| static SPIFIobj | spifi_obj |
| #define spifi_rom_init | ( | x | ) |
Definition at line 74 of file flash_config.h.
| #define SPIFI_WRITE_SECTOR_ADDRESS (SPIFLASH_BASE_ADDRESS + SPIFI_WRITE_SECTOR_OFFSET) |
Definition at line 72 of file flash_config.h.
| #define SPIFI_WRITE_SECTOR_OFFSET 0x40000 |
Offset of the sector to which the data to be written
Definition at line 71 of file flash_config.h.
| #define USE_SPIFI_LIB |
Macro that enables calling of spifi functions using the library, disabling this will directly call the functions in boot rom using bootROM function pointers.
Definition at line 44 of file flash_config.h.
| int main | ( | void | ) |
|
static |
|
static |