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.

Dependencies:   mbed IAP

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/

Revision:
7:e140563d4aad
Parent:
6:2357a04a16ff
Child:
8:7d4d4edcb133
diff -r 2357a04a16ff -r e140563d4aad main.cpp
--- a/main.cpp	Tue Mar 10 04:27:11 2015 +0000
+++ b/main.cpp	Wed Aug 15 07:42:33 2018 +0000
@@ -44,6 +44,7 @@
  *        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.
+ *        revision 3.1.2.1 15-Aug-2018  added: just minor feature in "memdump()" function
  */
 
 #include    "mbed.h"
@@ -62,7 +63,6 @@
 #endif
 
 void    memdump( char *p, int n );
-int     isprint( int c );
 
 IAP     iap;
 
@@ -167,20 +167,25 @@
 }
 
 
+#include    <ctype.h>
+
 void memdump( char *base, int n )
 {
     unsigned int    *p;
+    char            s[17]   = { '\x0' };
 
     printf( "  memdump from 0x%08X for %d bytes", (unsigned long)base, n );
 
     p   = (unsigned int *)((unsigned int)base & ~(unsigned int)0x3);
 
     for ( int i = 0; i < (n >> 2); i++, p++ ) {
-        if ( !(i % 4) )
-            printf( "\r\n  0x%08X :", (unsigned int)p );
+        if ( !(i % 4) ) {
+            printf( " : %s\r\n  0x%08X :", s, (unsigned int)p );
 
+            for ( int j = 0; j < 16; j++)
+                s[ j ]  = isgraph( (int)(*((char *)p + j)) ) ? (*((char *)p + j)) : ' ';
+        }
         printf( " 0x%08X", *p );
     }
-
-    printf( "\r\n" );
+    printf( " : %s\r\n", s );
 }