RAS

Fork of IAP by Tedd OKANO

Files at this revision

API Documentation at this revision

Comitter:
pascalreygner
Date:
Wed Sep 05 10:20:03 2018 +0000
Parent:
13:f04b3719759d
Child:
15:2b4aff19ddc8
Commit message:
Ras

Changed in this revision

IAP.cpp Show annotated file Show diff for this revision Revisions of this file
IAP.h Show annotated file Show diff for this revision Revisions of this file
--- a/IAP.cpp	Sun Aug 26 06:09:29 2018 +0000
+++ b/IAP.cpp	Wed Sep 05 10:20:03 2018 +0000
@@ -35,8 +35,6 @@
 #define     USER_FLASH_AREA_START_STR( x )      STR( x )
 #define     STR( x )                            #x
 
-unsigned char user_area[ USER_FLASH_AREA_SIZE ] __attribute__((section( ".ARM.__at_" USER_FLASH_AREA_START_STR( USER_FLASH_AREA_START ) ), zero_init));
-
 /*
  *  Reserve of flash area is explained by Igor. Please refer next URL
  *    http://mbed.org/users/okano/notebook/iap-in-application-programming-internal-flash-eras/?page=1#comment-271
@@ -188,25 +186,15 @@
 int IAP::writeFlashAd(char *data,int numSecteur,int numBlock)
 {
     prepare(numSecteur, numSecteur );
-    int r = write( data, sector_start_adress[ numSecteur]+MEM_SIZE*numBlock, MEM_SIZE );
+    int r = write( data, sector_start_adress[ numSecteur]+FLASH_MEM_SIZE*numBlock, FLASH_MEM_SIZE );
     return(r);
 }
 
 void IAP::readFlashAd(char *data,int numSecteur,int numBlock)
 {
-    memcpy( data, sector_start_adress[ numSecteur]+MEM_SIZE*numBlock, MEM_SIZE );
+    memcpy( data, sector_start_adress[ numSecteur]+FLASH_MEM_SIZE*numBlock, FLASH_MEM_SIZE );
 }
-#define FLASH_NBBLOCK 128          // nb blocks dans un secteur
 
-void IAP::copyFlashSector(int numSecteurSrc,int numSecteurDest)
-{
-    char data[MEM_SIZE];
-    eraseFlashSector(numSecteurDest);
-    for (int numBlock =0; numBlock<FLASH_NBBLOCK; numBlock++) {
-        readFlashAd(data, numSecteurSrc,numBlock);
-        writeFlashAd(data, numSecteurDest,numBlock);
-    }
-}
 // ************ Fin Ajout PR 22/8/2018 ***********************************
 
 #if defined(TARGET_LPC11UXX)
--- a/IAP.h	Sun Aug 26 06:09:29 2018 +0000
+++ b/IAP.h	Wed Sep 05 10:20:03 2018 +0000
@@ -35,7 +35,7 @@
 
 #include    "mbed.h"
 
-#define     MEM_SIZE                      256   
+#define     FLASH_MEM_SIZE                      256   
 
 # define TARGET_LPC1488
 #if defined(TARGET_LPC176X) || defined(TARGET_LPC1488)
@@ -459,7 +459,6 @@
     void eraseFlashSector(int numSecteur);
     int writeFlashAd(char *data,int numSecteur,int numBlock);
     void readFlashAd(char *data,int numSecteur,int numBlock);
-    void copyFlashSector(int numSecteurSrc,int numSecteurDest);
 
 #if defined(TARGET_LPC11UXX)