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: verification.cpp
- Revision:
- 34:eaca33d3e632
- Parent:
- 30:e0d7524661ca
- Child:
- 35:0b434ef4af49
--- a/verification.cpp Wed Sep 25 04:00:04 2013 +0000 +++ b/verification.cpp Thu Sep 26 11:51:03 2013 +0000 @@ -94,6 +94,11 @@ } +#define LINE_BYTES 44 +#define N_OF_LINES 4 +#define READ_SIZE (LINE_BYTES * N_OF_LINES) + + int verify_uucoded_data( FILE *fp, int *read_size_p ) { char command_str[ STR_BUFF_SIZE ]; @@ -104,7 +109,7 @@ char *br; int error_flag = 0; - flash_reading_size = 176; + flash_reading_size = READ_SIZE; initialize_uud_table(); @@ -155,9 +160,7 @@ void get_binary_from_uucode_str( char *b, int size ) { -#define N 4 - - char s[ N ][ STR_BUFF_SIZE ]; + char s[ N_OF_LINES ][ STR_BUFF_SIZE ]; char ss[ STR_BUFF_SIZE ]; long checksum = 0; int line_count = 0; @@ -167,7 +170,8 @@ while ( retry_count-- ) { - for ( int i = 0; i < N; i++ ) +// for ( int i = 0; i < N_OF_LINES; i++ ) + for ( int i = 0; i < ((READ_SIZE < size) ? N_OF_LINES : ((size - 1) / LINE_BYTES) + 1) ; i++ ) get_string( s[ i ] ); get_string( ss );