uint8_t sum;
rec->status = IHX_BROKEN;
+ rec->len = 0;
+ rec->type = 0xff;
-
- while ((c = my_getchar(0)) != ':')
+ while ((c = my_getchar(0)) != ':') {
if (c == 0x03)
- return -1;
+ return -1; /* Control-C */
+ if (c == 0x04) {
+ rec->status = IHX_OK;
+ return 0; /*Control-D, EOF */
+ }
+ }
if ((c = get_hexbyte()) < 0) /* Start code */
return -1;
uint32_t address_low = address_max;
command_ret_t rcode = CMD_RET_FAILURE;
ihex_t rec;
+ bool firstrec = true;
(void) cmdtp; (void) flag;
if (argc > 1)
offset = strtol(argv[1], NULL, 16);
+ printf_P(PSTR("Waiting for Intel Hex Records...\n"));
+
while (ihex_get_record(&rec) > 0 &&
rec.status == IHX_OK &&
rec.type != 1 ) {
switch (rec.type) {
case 0: /* Data record */
+ if (firstrec) {
+ printf_P(PSTR("Loading: 0x....."));
+ firstrec = false;
+ }
if (rec.len) {
uint32_t addr = base_address + rec.address + offset;
if (addr < address_low)
// debug("low: 0x%.5lX, high: 0x%.5lX, max: 0x%.5lX, addr: 0x%.5lX, len: %d\n",
// address_low, address_high, address_max, addr, rec.len);
-
+ printf_P(PSTR("\b\b\b\b\b%.5lX"), addr);
if (addr < address_max) {
uint32_t tmplen = address_max - addr;
if (rec.len > tmplen)
break;
}
- printf_P(PSTR("Data loaded: "));
+
+ for (uint_fast8_t i=0; i<100; ++i) {
+ /* flush input buffer */
+ while (my_getchar(0) > 0)
+ ;
+ udelay(1000);
+ }
+
+
+ printf_P(PSTR("\nData loaded: "));
if (address_low >= MIN(address_high, address_max))
printf_P(PSTR("None.\n"));
else