From a6f7480034697fe5f48667ca978fea9eedcaa066 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 7 Mar 2013 22:09:41 +0100 Subject: Mega2560 bootloader: use avr library functions for writing into EEPROM --- bootloaders/stk500v2/stk500boot.c | 19 +- bootloaders/stk500v2/stk500boot_v2_mega2560.hex | 871 +++++++++++++----------- 2 files changed, 471 insertions(+), 419 deletions(-) mode change 100755 => 100644 bootloaders/stk500v2/stk500boot.c (limited to 'bootloaders') diff --git a/bootloaders/stk500v2/stk500boot.c b/bootloaders/stk500v2/stk500boot.c old mode 100755 new mode 100644 index 104ab3b..e7494df --- a/bootloaders/stk500v2/stk500boot.c +++ b/bootloaders/stk500v2/stk500boot.c @@ -1020,24 +1020,15 @@ int main(void) } else { - //* issue 543, this should work, It has not been tested. - #if (defined(EEARL) && defined(EEARH) && defined(EEMWE) && defined(EEWE) && defined(EEDR)) + //* issue 543, this should work, It has not been tested. uint16_t ii = address >> 1; /* write EEPROM */ - do { - EEARL = ii; // Setup EEPROM address - EEARH = (ii >> 8); + while (size) { + eeprom_write_byte((uint8_t*)ii, *p++); address+=2; // Select next EEPROM byte ii++; - - EEDR = *p++; // get byte from buffer - EECR |= (1<