Internal error: out of range error when building custom bootloader


i'm attempting build custom bootloader arduino mega2560 arduino ide 1.8.0 under windows 7.

in platform.txt i've appended ",--section-start=.text=0x3e000" compiler.c.elf.flags, should put bootloader in last 8k of 256k flash.

when verify application following warnings:

code: [select]

c:\program files (x86)\arduino\hardware\arduino\avr\cores\arduino/main.cpp:47: warning: internal error: out of range error

c:\program files (x86)\arduino\hardware\arduino\avr\cores\arduino/main.cpp:47: warning: internal error: out of range error


this behavior reproduceable empty sketch, modification being additional linker option.

code: [select]

void setup() {
  // put setup code here, run once:

}

void loop() {
  // put main code here, run repeatedly:

}


the linker command below:

code: [select]

"c:\program files (x86)\arduino\hardware\tools\avr/bin/avr-gcc" -w -os -g -flto -fuse-linker-plugin -wl,--gc-sections,--section-start=.text=0x3e000,--relax -mmcu=atmega2560  -o "c:\users\username\appdata\local\temp\arduino_build_249361/sketch_jan05a.ino.elf" "c:\users\username\appdata\local\temp\arduino_build_249361\sketch\sketch_jan05a.ino.cpp.o" "c:\users\username\appdata\local\temp\arduino_build_249361/core\core.a" "-lc:\users\username\appdata\local\temp\arduino_build_249361" -lm


the line linker complaining main.cpp is:

code: [select]

if (serialeventrun) serialeventrun();


serialeventrun declared weak symbol.

without "--section-start=.text=0x3e000", sketch compiled without warnings. also, relocating .text section anywhere upto 0x20000 allows sketch compiled without warnings.

any ideas on how avoid warnings? there wrong way trying compile bootloader?

i still don't understand reason linker error, however, able work around commenting out following line in main.cpp

code: [select]
if (serialeventrun) serialeventrun();


Arduino Forum > Using Arduino > Programming Questions > Internal error: out of range error when building custom bootloader


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor