Code to load a LPC1114 over tx/rx. I have only tested with a 1114 chip but it should work with other LPC uControllers
Dependencies: DirectoryList MODSERIAL mbed
Fork of ika_shouyu_poppoyaki by
Diff: writing.cpp
- Revision:
- 35:0b434ef4af49
- Parent:
- 30:e0d7524661ca
- Child:
- 41:74b9ff21098f
diff -r eaca33d3e632 -r 0b434ef4af49 writing.cpp --- 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 ); }