I'm trying to make use of the optiboot timeout, 8 seconds, and I can't identify the changes that need to be made to compile the new bootloader.
I am working with an arduino nano and I want to perform OTA with an HC 05, I manage to generate the DTR signal but I estimate that the waiting time for the data of the new program is very short.
Can someone give me a hand, thank you very much in advance!
Please study the documentation provided by the Optiboot project:
If you still have questions or problems after you compile by following those, come back with specific questions and detailed information about what you tried and what happened when you tried it, the forum members will help you out.
Hello, your comments have been very helpful, I have made some progress and learned, but I have the following error when compiling, I can't find information on the web. Can you give me a hand please.
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
You need a newer avr-gcc than WinAVR (which is over 12y old.)
The version packaged with Arduino is fine. You'll still need "Make" from winAVR or a separate download, though
Hello, thank you very much everyone, it seems that thanks to your help I have managed to advance a little, I have a different error.
make atmega328 LED_START_FLASHES=0 TIMEOUT=8
avr-gcc (GCC) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
BAUD RATE CHECK: Desired: 115200, Real: 117647, UBRRL = 16, Difference=2.1%
avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328p -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=0 -DWDTTIME=8 -Wl,-Tlink_optiboot.ld -Wl,--relax -nostartfiles -o optiboot_atmega328.elf optiboot.o
c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: optiboot_atmega328.elf section .text' will not fit in region text'
c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: section .version LMA [0000000000007ffe,0000000000007fff] overlaps section .text LMA [0000000000007e00,0000000000008001]
c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: region text' overflowed by 0 bytes c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/avr5\libgcc.a(_copy_data.o): in function __do_copy_data':
/root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2405: undefined reference to __data_end' c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: /root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2406: undefined reference to __data_start'
c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: /root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2407: undefined reference to __data_start' c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: /root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2408: undefined reference to __data_load_start'
c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: /root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2409: undefined reference to __data_load_start' c:/avr-gcc/bin/../lib/gcc/avr/11.1.0/../../../../avr/bin/ld.exe: /root/gcc-11.1.0/obj-avr/avr/avr5/libgcc/../../../../libgcc/config/avr/lib1funcs.S:2420: undefined reference to __data_end'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:694: optiboot_atmega328.elf] Error 1
Hello, thank you very much everyone, it seems that thanks to your help I have managed to advance a little, I have a different error.
I entered Makefile and found this, it doesn't help me at all, since I don't understand it.
I appreciate any kind of help to solve this new problem, thank you very much!
WinAVR is v4.3.3, the latest "toolchain" from Microchip is v5.4.0, and Arduino ships with 7.3.0
section .text' will not fit in region text
Part of what makes Optiboot maintenance so exciting is that since it's a dozen or so instructions from "not fitting in 512 bytes", it's subject to "minor" changes in the compiler causing it to get too big. One has to go and look for new optimization settings, or minor re-arrangements of code, to try to fix things.
There were "major" changes in gcc between v10 and v11, almost resulting in the loss of avr support entirely.
And I haven't looked at versions beyond v7 at all.
in function __do_copy_data': ... undefined reference to `__data_start'
That's particularly troubling, since using "-nostartfiles" is supposed to cause __do_copy_data/etc to be omitted. Sigh.
I'll have to take a look...