RAS
Fork of IAP by
Diff: IAP.cpp
- Revision:
- 14:0b26f723fa19
- Parent:
- 12:91ac1391a13b
- Child:
- 15:2b4aff19ddc8
--- 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)