Description
Hi community
We are trying to create the binary with bootloader of an arduino sketch using Arduino IDE 1.8.13 and upload it to an ATSAMD21G18A microprocessor (Arduino Zero) via Atmel Studio 7.0.2397.
It seems to us that the merger that fuses bootloader with sketch code that was fixed in 1.8.13 (arduino/arduino-builder#286, #744) does not work for larger sketches.
The following two sketches have been uploading via IDE and executed successfully.
However, if the binary is uploaded via Atmel Studio, only the small, first sketch works.
10992 bytes sketch, works when uploaded with IDE or Atmel as binary.with_bootloader.bin:
const char hello[13] PROGMEM = "hello world!";
void setup() {
SerialUSB.begin(115200);
}
void loop() {
SerialUSB.println(hello);
delay(1000); // wait for a second
}
60976 bytes sketch, works when uploaded with IDE, does not work when uploaded via Atmel as binary.with_bootloader.bin:
const char hello[50000] PROGMEM = "hello world!";
void setup() {
SerialUSB.begin(115200);
}
void loop() {
SerialUSB.println(hello);
delay(1000); // wait for a second
}
Without understanding the merging code, maybe this has to do with some maximum size assumptions https://github.com/arduino/arduino-cli/pull/744/files#diff-b0aa01210cafc5319fbc95159b62da0fR72.
Activity
rikba commentedon Oct 2, 2020
As a workaround we can upload the bootloader.hex and program.hex successively.
facchinm commentedon Oct 5, 2020
@rikba thanks for the report. It looks like the hex merger is maxing out on its own at 65536 bytes (16 bit).
@cmaglie should we add a test in
arduino-cli
for this? The last sketch shows the problem perfectly.cmaglie commentedon Oct 5, 2020
yes this is more an issue for arduino-cli (since the builder is now based on it), I'm moving the issue over there.
Correctly handle 8086 extended record
Correctly handle 8086 extended record
Correctly handle 8086 extended record
ubidefeo commentedon Mar 18, 2021
While trying to explain a user how not to lose the bootloader when uploading using programmer I bumped into an issue after burning a compiled sketch with bootloader on an Arduino Micro.
#155 (comment)
Programming goes through (using
arduinoisp
) but then the board's LED breaths (like in bootloader mode) and then starts blinking regularly even thought he Sketch has no blink.The board becomes visible to IDE/IDE 2/CLI but attempting to upload using the bootloader bricks it and a new program action is required.
Also uploading the sketch
with_bootloader
took a considerable amount of time, so I checked the file size and of course it does not add upThe compiled sketch (no bootloader) is 11K, and the one with bootloader is 88 :(
cmaglie commentedon Mar 22, 2021
In the comment that you linked I see that you compiled a
BlinkMe
sketch and after that, you uploaded theBlinkMe.ino.with_bootloader.hex
so you have actually uploaded a BlinkMe + bootloader. AFAICT this is the expected outcome...The big size of the
ino.with_boorloader.hex
may just be an artifact of the.hex
: since the bootloader is in the upper area of the flash you got an .hex file that fills all the 32KB of flash BTW the most part in the middle will be just filled with "empty" space (in this case 0xFF).ubidefeo commentedon Mar 30, 2021
@cmaglie
makes sense now, but this still persists on an Arduino Micro
12 remaining items