arduino / Arduino

Arduino IDE 1.x
https://www.arduino.cc/en/software
Other
14.11k stars 7k forks source link

mega2560 bootloader doesn't support eeprom writes or erases [imported] #543

Closed cmaglie closed 11 years ago

cmaglie commented 11 years ago

This is Issue 543 moved from a Google Code project. Added by 2011-05-18T17:09:42.000Z by tweakne...@gmail.com. Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Defect, Priority-Medium

Original description

What steps will reproduce the problem?

  1. avrdude -e
  2. avrdude -U eeprom:r:-:h

What is the expected output? What do you see instead? Should be all 0xff, isn't actually erased.

  1. avrdude -U eeprom:w:blah.eep

What is the expected output? What do you see instead? Should succeed, fails verification.

This is because the stk500v2 bootloader on the 8u2 chip on the arduino mega 2560 board has these pretty useful functions either defined out, or as a noop.

Please provide any additional information below.

At line 804, (case CMD_CHIP_ERASE_ISP:) in https://github.com/arduino/Arduino/blob/master/hardware/arduino/bootloaders/stk500v2/stk500boot.c you can see that chip erase is a NOOP. I think this should at least return something indicating that it wasn't done, not that it succeeded.

At line 858 in the same file,

if (!defined(AVR_ATmega1280) && !defined(AVR_ATmega2560) && !defined(AVR_ATmega2561))

You can see that the code for programming the EEPROM on the megas is simply defined out. if that code doesn't work on the megas, it should be replaced with code that does.

cmaglie commented 11 years ago

Please look at the pullrequest here https://github.com/arduino/Arduino/pull/1183

The updated hex bootloader is available here:

https://github.com/cmaglie/Arduino/blob/mega2560-bootloader/hardware/arduino/bootloaders/stk500v2/stk500boot_v2_mega2560.hex

Please check it out and report here https://github.com/arduino/Arduino/pull/1183 success or failures. Thank you!

C