File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,11 @@ uint8_t ihx_check_line(char line[]) {
6565
6666 checksum = ihx_data_byte (line , byte_count );
6767
68- if (record_type > 1 )
68+ if (record_type > 0x01 && ( record_type < 0x22 || record_type > 0x25 ) )
6969 return IHX_BAD_RECORD_TYPE ;
7070
71- if (record_type != IHX_RECORD_EOF && (address < USER_CODE_BASE || address > FLASH_SIZE ))
71+ if ((record_type == IHX_RECORD_DATA || record_type == IHX_RECORD_READ ) && \
72+ (address < USER_CODE_BASE || address > FLASH_SIZE ))
7273 return IHX_BAD_ADDRESS ;
7374
7475 sum = 0 ;
Original file line number Diff line number Diff line change 3434#define IHX_RECORD_DATA 0x00
3535#define IHX_RECORD_EOF 0x01
3636
37+ // Custom record types used to implement some extra bootloader functionality.
38+
39+ // Reset record will reset the page erase map which usually ensures each page is only
40+ // erased once, allowing for random writes but preventing overwriting of data already written
41+ // this session.
42+ // :00000022DE
43+ #define IHX_RECORD_RESET 0x22
44+
45+ // Erases all of the user code flash pages
46+ // :00000023DD
47+ #define IHX_RECORD_ERASE_ALL 0x23
48+
49+ // Erases a single page of the user code flash
50+ // :01000024xxyy
51+ // xx - Page number, yy - Checksum
52+ #define IHX_RECORD_ERASE_PAGE 0x24
53+
54+ // Reads back a section of flash in Intel HEX format
55+ // :04xxxx24yyyyzz
56+ // xxxx - Start address, yyyy - Num bytes to read, zz - Checksum
57+ #define IHX_RECORD_READ 0x25
58+
59+
3760uint8_t hex4 (char c );
3861uint8_t hex8 (char s []);
3962uint16_t hex16 (char s []);
You can’t perform that action at this time.
0 commit comments