Ika Shouyu Poppoyaki - LPC82x supported
Fork of ika_shouyu_poppoyaki by
Revision 35:0b434ef4af49, committed 2013-09-26
- Comitter:
- okano
- Date:
- Thu Sep 26 12:56:01 2013 +0000
- Parent:
- 34:eaca33d3e632
- Child:
- 36:44a2eacb7549
- Commit message:
- added: warning/error by compile option settings
Changed in this revision
--- a/_user_settings.h Thu Sep 26 11:51:03 2013 +0000 +++ b/_user_settings.h Thu Sep 26 12:56:01 2013 +0000 @@ -33,3 +33,23 @@ #endif // MBED_ISP___USER_SETTINGS__ + + + +//////////////////////////// +// FOLLOWING IS MESSAGE THAT WILL BE SHOWN WHEN COMPILE THIS CODE +// you can edit next lines if you want remove error/warning message +/////////////////////////// + +#if defined( ENABLE_WRITING ) && defined( ENABLE_VERIFYING ) + #define WHAT_WAS_DONE "written and verified" +#elif defined( ENABLE_WRITING ) && !defined( ENABLE_VERIFYING ) + #define WHAT_WAS_DONE "written" + #warning "ENABLE_VERIFYING" in "_user_setting.h" is disabled. No verification will be performed. +#elif !defined( ENABLE_WRITING ) && defined( ENABLE_VERIFYING ) + #define WHAT_WAS_DONE "verified" + #warning "ENABLE_WRITING" in "_user_setting.h" is disabled. No writing will be performed. +#else + #error both "ENABLE_WRITING" and "ENABLE_VERIFYING" are disabled ("in user_setting.h"). The program need to execute nothing +#endif +
--- a/command_interface.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/command_interface.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -4,7 +4,7 @@ #include "_user_settings.h" -int try_and_check( char *command, char *expected_return_str, int mode ) +int try_and_check( char *command, char *expected_return_str ) { char rtn_str[ STR_BUFF_SIZE ]; int result = 1; @@ -15,14 +15,14 @@ get_string( rtn_str ); print_result( result = strcmp( expected_return_str, rtn_str ) ); - if ( result && !mode ) - error( "command failed\r\n" ); +// if ( result && !mode ) +// error( "command failed\r\n" ); return ( result ); } -int try_and_check2( char *command, char *expected_return_str, int mode ) +int try_and_check2( char *command, char *expected_return_str ) { char rtn_str[ STR_BUFF_SIZE ]; int result = 1; @@ -34,8 +34,8 @@ get_string( rtn_str ); print_result( result = strcmp( expected_return_str, rtn_str ) ); - if ( result && !mode ) - error( "command failed\r\n" ); +// if ( result && !mode ) +// error( "command failed\r\n" ); return ( result ); } @@ -70,7 +70,7 @@ sprintf( command, "%d\n", checksum ); - return ( try_and_check( command, "OK", 0 ) ); + return ( try_and_check( command, "OK" ) ); } @@ -79,11 +79,11 @@ char command_str[ STR_BUFF_SIZE ]; sprintf( command_str, "P 0 %d\r\n", last_sector ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( 1 ); *(command_str) = 'E'; - return ( try_and_check( command_str, "0", 0 ) ); + return ( try_and_check( command_str, "0" ) ); }
--- a/command_interface.h Thu Sep 26 11:51:03 2013 +0000 +++ b/command_interface.h Thu Sep 26 12:56:01 2013 +0000 @@ -1,8 +1,8 @@ #define STR_BUFF_SIZE 64 -int try_and_check( char *command, char *expected_return_str, int mode ); -int try_and_check2( char *command, char *expected_return_str, int mode ); +int try_and_check( char *command, char *expected_return_str ); +int try_and_check2( char *command, char *expected_return_str ); void print_command( char *command ); void print_result( int r ); int send_RAM_transfer_checksum( int checksum );
--- a/main.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/main.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -30,6 +30,9 @@ LocalFileSystem local( "local" ); +#define SUMMARY_MESSAGE_FAIL "** The data could not be " WHAT_WAS_DONE " :(" +#define SUMMARY_MESSAGE_SUCCESS "** The data has been " WHAT_WAS_DONE " successflly :)" + int main() { int err; @@ -40,8 +43,8 @@ printf( "\r\n %s\r\n\r\n", err ? - "** The data could not be written :(" : - "** The data has been written successflly :)" + SUMMARY_MESSAGE_FAIL : + SUMMARY_MESSAGE_SUCCESS ); if ( err ) @@ -52,11 +55,11 @@ start_target_in_normal_mode( TARGET_OPERATION_BAUD_RATE ); printf( " ** The program in flash has been started!!\r\n" ); - + #endif printf( " (now the mbed is working in \"serial through mode\")\r\n\r\n" ); - + start_success_indicator(); usb_serial_bridge_operation(); // doesn't return. infinite loop in this function }
--- a/target_handling.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/target_handling.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -19,25 +19,25 @@ while ( retry_count-- ) { reset_target( ENTER_TO_ISP_MODE ); - if ( !try_and_check( "?", "Synchronized", 0 ) ) + if ( !try_and_check( "?", "Synchronized" ) ) break; } if ( !retry_count ) return ( NULL ); - try_and_check2( "Synchronized\r\n", "OK", 0 ); - try_and_check2( "12000\r\n", "OK", 0 ); - try_and_check2( "U 23130\r\n", "0", 0 ); - try_and_check2( "A 0\r\n", "0", 0 ); + try_and_check2( "Synchronized\r\n", "OK" ); + try_and_check2( "12000\r\n", "OK" ); + try_and_check2( "U 23130\r\n", "0" ); + try_and_check2( "A 0\r\n", "0" ); - try_and_check( "K\r\n", "0", 0 ); + try_and_check( "K\r\n", "0" ); get_string( str_buf0 ); get_string( str_buf1 ); printf( " result of \"K\" = %s %s\r\n", str_buf0, str_buf1 ); - try_and_check( "J\r\n", "0", 0 ); + try_and_check( "J\r\n", "0" ); get_string( str_buf0 ); printf( " result of \"J\" = %s\r\n", str_buf0 );
--- a/verification.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/verification.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -65,7 +65,7 @@ sprintf( command_str, "R %ld %ld\r\n", read_size, size ); // try_and_check( command_str, "0", MODE_SILENT ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_READ_COMMAND ); get_binary( br, 1 ); @@ -130,7 +130,7 @@ } sprintf( command_str, "R %ld %ld\r\n", read_size, size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_READ_COMMAND ); get_binary_from_uucode_str( br, size );
--- a/writing.cpp Thu Sep 26 11:51:03 2013 +0000 +++ b/writing.cpp Thu Sep 26 12:56:01 2013 +0000 @@ -60,7 +60,7 @@ } sprintf( command_str, "W %ld %ld\r\n", ram_start, transfer_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_WRITE_COMMAND ); for ( int i = 0; i < lines_per_transfer; i++ ) { @@ -85,11 +85,11 @@ checksum = 0; sprintf( command_str, "P %d %d\r\n", total_size / sector_size, total_size / sector_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_PREPARE_COMMAND ); sprintf( command_str, "C %d %d %d\r\n", total_size, ram_start, flash_writing_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_COPY_COMMAND ); total_size += size; @@ -125,18 +125,18 @@ } sprintf( command_str, "W %ld %ld\r\n", ram_start, flash_writing_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_WRITE_COMMAND ); put_binary( b, flash_writing_size ); put_string( "\r\n" ); sprintf( command_str, "P %d %d\r\n", total_size / sector_size, total_size / sector_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_PREPARE_COMMAND ); sprintf( command_str, "C %d %d %d\r\n", total_size, ram_start, flash_writing_size ); - if ( try_and_check( command_str, "0", 0 ) ) + if ( try_and_check( command_str, "0" ) ) return ( ERROR_AT_COPY_COMMAND ); total_size += size; @@ -198,7 +198,7 @@ int post_writing_process( target_param *tpp ) { if ( tpp->write_type == UUENCODE ) - return ( try_and_check( "G 0 T\r\n", "0", 0 ) ); + return ( try_and_check( "G 0 T\r\n", "0" ) ); else return ( 0 ); }