![](/media/cache/profiles/795c7a7a5ec6b460ec00c5841019b9e9.jpg.50x50_q85.jpg)
Sample code for how to erase/write LPC1768, LPC11U24, LPC1114, LPC812 and LPC824 internal flash memory. This program uses IAP call of MCU's ROM routines. The IAP library also supports read/write of EEPROM in LPC11U24.
Sample code for how to erase/write LPC1768, LPC11U24, LPC1114, LPC812 and LPC824 internal flash memory. This program uses IAP call of MCU's ROM routines.
No filesystem interface available. This program is just an interface to flash erasing and writing. User need manage where to store the data in the flash area.
This IAP library supports read/write of EEPROM in LPC11U24.
More information available in
http://mbed.org/users/okano/notebook/iap-in-application-programming-internal-flash-eras/
Diff: main.cpp
- Revision:
- 6:2357a04a16ff
- Parent:
- 5:806960ca964e
- Child:
- 7:e140563d4aad
--- a/main.cpp Fri Jan 16 08:00:33 2015 +0000 +++ b/main.cpp Tue Mar 10 04:27:11 2015 +0000 @@ -43,6 +43,7 @@ * revision 3.0 09-Jan-2015 LPC812 and LPC824 support added * revision 3.1 13-Jan-2015 LPC1114 support added * revision 3.1.1 16-Jan-2015 Target MCU name changed for better compatibility across the platforms + * revision 3.1.2 10-Mar-2015 merged with pull requests. reinvoke_isp() added and modified read_serial() to return a pointer. */ #include "mbed.h" @@ -69,10 +70,20 @@ int main() { char mem[ MEM_SIZE ]; // memory, it should be aligned to word boundary + int *serial_number; int r; printf( "\r\n\r\n=== IAP: Flash memory writing test ===\r\n" ); - printf( " device-ID = 0x%08X, serial# = 0x%08X, CPU running %dkHz\r\n", iap.read_ID(), iap.read_serial(), SystemCoreClock / 1000 ); + printf( " device-ID = 0x%08X\r\n", iap.read_ID() ); + + serial_number = iap.read_serial(); + + printf( " serial# =" ); + for ( int i = 0; i < 4; i++ ) + printf( " %08X", *(serial_number + i) ); + printf( "\r\n" ); + + printf( " CPU running %dkHz\r\n", SystemCoreClock / 1000 ); printf( " user reserved flash area: start_address=0x%08X, size=%d bytes\r\n", iap.reserved_flash_area_start(), iap.reserved_flash_area_size() ); printf( " read_BootVer=0x%08X\r\r\n", iap.read_BootVer() );