RAS
Fork of IAP by
Revision 15:2b4aff19ddc8, committed 2018-09-29
- Comitter:
- pascalreygner
- Date:
- Sat Sep 29 16:01:16 2018 +0000
- Parent:
- 14:0b26f723fa19
- Commit message:
- R
Changed in this revision
IAP.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/IAP.cpp Wed Sep 05 10:20:03 2018 +0000 +++ b/IAP.cpp Sat Sep 29 16:01:16 2018 +0000 @@ -40,7 +40,7 @@ * http://mbed.org/users/okano/notebook/iap-in-application-programming-internal-flash-eras/?page=1#comment-271 */ -//unsigned char user_area[ size ] __attribute__((section(".ARM.__at_0x78000"), zero_init)); +//unsigned char user_area[ USER_FLASH_AREA_SIZE ] __attribute__((section(".ARM.__at_0x78000"), zero_init)); /* * IAP command codes @@ -65,13 +65,14 @@ #endif }; -int IAP::reinvoke_isp( void ) { +int IAP::reinvoke_isp( void ) +{ __disable_irq(); - + IAP_command[ 0 ] = IAPCommand_Reinvoke_ISP; - + iap_entry( IAP_command, IAP_result ); - + return ( (int)IAP_result[ 0 ] ); } @@ -90,11 +91,12 @@ return ( (int)IAP_result[ 1 ] ); // to return the number itself (this command always returns CMD_SUCCESS) } -int *IAP::read_serial( void ) { +int *IAP::read_serial( void ) +{ IAP_command[ 0 ] = IAPCommand_Read_device_serial_number; - + iap_entry( IAP_command, IAP_result ); - + // return ( (int)IAP_result[ 0 ] ); return ( (int *)&IAP_result[ 1 ] ); // to return the number itself (this command always returns CMD_SUCCESS) } @@ -244,10 +246,10 @@ int IAP::write_page( char *source_addr, int target_page ) { int r; - + if ( r = prepare( target_page / (LPC8XX_SCTR_SIZE / LPC8XX_PAGE_SIZE), target_page / (LPC8XX_SCTR_SIZE / LPC8XX_PAGE_SIZE) ) ) return ( r ); - + return ( write( source_addr, (char *)(target_page * LPC8XX_PAGE_SIZE), LPC8XX_PAGE_SIZE ) ); }