Dependencies:   FreescaleIAP mbed

Files at this revision

API Documentation at this revision

Comitter:
tony63
Date:
Tue Dec 12 07:52:22 2017 +0000
Commit message:
Programa de ejemplo para leer y escribir en la flash de la FRDMKL25Z; los datos se escriben y lee del arreglo "data[]"

Changed in this revision

FreescaleIAP.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r e8a8f8351b80 FreescaleIAP.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FreescaleIAP.lib	Tue Dec 12 07:52:22 2017 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/Sissors/code/FreescaleIAP/#ab8a833a25eb
diff -r 000000000000 -r e8a8f8351b80 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 12 07:52:22 2017 +0000
@@ -0,0 +1,27 @@
+/*
+Programa de ejemplo para leer y escribir en la flash de la FRDMKL25Z
+los datos se escriben y lee del arreglo "data[]"
+
+*/
+#include "mbed.h"
+#include "FreescaleIAP.h"
+Serial pc(USBTX, USBRX);
+ 
+int main() {
+    int address = flash_size() - SECTOR_SIZE;           //Write in last sector
+    
+    int *data = (int*)address;
+    pc.printf("Starting\r\n"); 
+    erase_sector(address);
+    int numbers[10] = {0, 1, 10, 100, 1000, 10000, 1000000, 10000000, 100000000, 1000000000};
+    program_flash(address, (char*)&numbers, 40);        //10 integers of 4 bytes each: 40 bytes length
+    pc.printf("Resulting flash: \r\n");
+    for (int i = 0; i<10; i++)
+        pc.printf("%d\r\n", data[i]);
+    
+    pc.printf("Done\r\n\n");
+        
+ 
+    while (true) {
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r e8a8f8351b80 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 12 07:52:22 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600
\ No newline at end of file