Add to 11U68 11E68

Dependencies:   DirectoryList MODSERIAL mbed

Fork of ika_shouyu_poppoyaki by Tedd OKANO

Revision:
38:cb95bfe0546a
Parent:
34:eaca33d3e632
Child:
39:f68f9fa1e88e
--- a/isp.cpp	Thu Sep 26 12:58:51 2013 +0000
+++ b/isp.cpp	Fri Sep 27 14:48:17 2013 +0000
@@ -46,7 +46,11 @@
     }
 
     data_size   = file_size( fp );
-    last_sector = data_size / tpp->sector_size;
+    
+    if ( !data_size )
+        return ( ERROR_DATA_SIZE_ZERO );
+        
+    last_sector = (data_size - 1) / tpp->sector_size;
 
     if ( crp_check( fp ) ) {
         printf( "  the CRP is enabled in the data source file\r\n" );