If I want to get the Binary file with export binary file I only see HEX files in the sketch folder. So where is it or do I need to change settings anywhere in the IDE?
I want to allow multiple times of flashing by pressing a momentary switch connected with a digital input.
Once pressed a marker shall be set until flashing is done and reset afterwards allowing to initiate flashing again.
How can I set the eeprom adress 0x1FF from the byte 0xF0 to 0xFF?
My idea is to add a routine in the main loop of the sketch which checks a momentary switch and sets the eeprom value to 0xF0 and executes a software reset as
void softwareReset( uint8_t prescaller) {
// start watchdog with the provided prescaller
wdt_enable( prescaller);
// wait for the prescaller time to expire
// without sending the reset signal by using
// the wdt_reset() method
while (1) {}
void(* resetFunc) (void) = 0; //declare reset function @ address 0
}
I guess setting the EEPROM can be done with EEPROM.write(addr, value);
If I want to get the Binary file with export binary file I only see HEX files in the sketch folder. So where is it or do I need to change settings anywhere in the IDE?
It's theoretically possible to make the Arduino IDE generate the .bin file for Mega 2560, but it would be a lot of work to set that up and it's a very advanced project.
Easier is to just use avr-objcopy as recommended in the documentation of MicroBridge-Arduino-ATMega2560. That documentation assumes you're using the .elf file, which is a bit more difficult to find than the .hex file conveniently saved to the sketch folder by the Arduino IDE's Sketch > Export Compiled Binary feature. You can make the .bin file from the .hex file instead of the .elf file using this command:
pert:
It's theoretically possible to make the Arduino IDE generate the .bin file for Mega 2560, but it would be a lot of work to set that up and it's a very advanced project.
create a new file named platform.local.txt next to platform.txt of arduino avr boards package. for avr there are two possiible locations. the IDE installation folder or the Arduio15 folder in user home folder
~/.arduino15/packages/ on Linux
and %userprofile%\AppData\Local\Arduino15\packages\ on Windows (AppData is a hidden folder).
You can't compile the bootloader using the Arduino IDE. You need to use make following the instructions in the MicroBridge-Arduino-ATMega2560 documentation.
After you've done that, you can flash the bootloader to your Mega 2560 using the Arduino IDE. You'll need an ISP programmer. If you don't have an ISP programmer, you can use a spare Arduino as an "Arduino as ISP" programmer:
Connect the ISP programmer to your Mega 2560.
Tools > Board > Arduino Mega 2560 (DUAL SD Bootloader)
Tools > Programmer > select the appropriate programmer