Skip to content

Commit ad08320

Browse files
kgillsc1728p9
authored andcommitted
[IntelHex] Adding parsing of extended segment address record.
1 parent 15e4e94 commit ad08320

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

source/daplink/drag-n-drop/intelhex.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,19 @@ hexfile_parse_status_t parse_hex_blob(const uint8_t *hex_blob, const uint32_t he
157157
status = HEX_PARSE_EOF;
158158
goto hex_parser_exit;
159159

160+
case EXT_SEG_ADDR_RECORD:
161+
// Could have had data in the buffer so must exit and try to program
162+
// before updating bin_buf_address with next_address_to_write
163+
memset(bin_buf, 0xff, (bin_buf_size - (uint32_t)(*bin_buf_cnt)));
164+
// figure the start address for the buffer before returning
165+
*bin_buf_address = next_address_to_write - (uint32_t)(*bin_buf_cnt);
166+
*hex_parse_cnt = (uint32_t)(hex_blob_size - (end - hex_blob));
167+
// update the address msb's
168+
next_address_to_write = (next_address_to_write & 0x00000000) | ((line.data[0] << 12) | (line.data[1] << 4));
169+
// Need to exit and program if buffer has been filled
170+
status = HEX_PARSE_UNALIGNED;
171+
return status;
172+
160173
case EXT_LINEAR_ADDR_RECORD:
161174
// Could have had data in the buffer so must exit and try to program
162175
// before updating bin_buf_address with next_address_to_write

0 commit comments

Comments
 (0)