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
Revision 51:981107d4e84f, committed 2015-07-05
- Comitter:
- okano
- Date:
- Sun Jul 05 01:41:12 2015 +0000
- Parent:
- 50:57ad8e04f063
- Child:
- 52:afd15e54142f
- Commit message:
- comment added; indent adjusted
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
target_table.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jul 04 05:29:32 2015 +0000 +++ b/main.cpp Sun Jul 05 01:41:12 2015 +0000 @@ -2,8 +2,8 @@ * Sample of ISP operation for NXP MCUs * * @author Tedd OKANO - * @version 1.1.2 - * @date Jan-2015 + * @version 1.2 + * @date Jul-2015 * * This program programs MCU flash memory through UART. It uses * "In-System Programming (ISP)" interface in target MCU (NXP LPC micro- @@ -17,7 +17,12 @@ * (This program not just copies the binary but also insert 4 byte checksum at * address 0x1C.) * - * This program supports LPC1114, LPC81x, LPC82x and LPC1768/1769. + * This program supports LPC1114, LPC81x, LPC82x, LPC1768/1769 and LPC11U68/LPC11E68. + * + * All detailed history is available in code publishing page. + * Please find it on + * https://developer.mbed.org/users/okano/code/ika_shouyu_poppoyaki/shortlog + * Thank you for all feedbacks and controbutes! */ #include "mbed.h"
--- a/target_table.cpp Sat Jul 04 05:29:32 2015 +0000 +++ b/target_table.cpp Sun Jul 05 01:41:12 2015 +0000 @@ -3,6 +3,7 @@ #define SECTOR_SIZE_VALIABLE4Kx16_AND_32KxN 1 #define SECTOR_SIZE_VALIABLE4Kx24_AND_32KxN 2 + target_param target_table[] = { { "unknown ttarget", 0xFFFFFFFF, 1024, 4096, 4096, UUENCODE, 0x10000200 }, { "LPC1114FN28(FDH28)/102", 0x0A40902B, 4096, 32768, 4096, UUENCODE, 0x10000200 }, @@ -42,30 +43,31 @@ int find_sector( int data_size, target_param *tpp ) { -int result; + int result; + switch ( tpp->sector_size ) { case SECTOR_SIZE_VALIABLE4Kx16_AND_32KxN : if ( data_size <= (4096 * 16) ) { - result = ( data_size / 4096 ); + result = ( data_size / 4096 ); } else { data_size -= (4096 * 16); - result = ( (data_size / (4096 * 8)) + 16 ); + result = ( (data_size / (4096 * 8)) + 16 ); } break; case SECTOR_SIZE_VALIABLE4Kx24_AND_32KxN : if ( data_size <= (4096 * 24) ) { - result = ( data_size / 4096 ); + result = ( data_size / 4096 ); } else { data_size -= (4096 * 24); - result = ( (data_size / (4096 * 12)) + 24 ); + result = ( (data_size / (4096 * 12)) + 24 ); } - break; - - + break; + + default : result = ( data_size / tpp->sector_size ); //break; } - return (result); + return (result); }