LowPowerLab Forum

Hardware support => Moteino => Topic started by: underwater on November 27, 2016, 04:08:12 PM

Title: Compiling DualOptiBoot bootloader
Post by: underwater on November 27, 2016, 04:08:12 PM
I searched on this forum about the issue and tried several ways to compile dualoptiboot but still could not succeed. Here is step by step what i did and which results I got;

step1. downloading arduino ide 1.5.6 r2 windows installation (operating system is windows 8.1)
step1.1 after the arduino installation end, I went to the folder ''C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot''
step1.2 I downloaded dualoptiboot zip archieve from git repository (https://github.com/LowPowerLab/DualOptiboot)
step1.3 I unarchieved the zip file and copied ''Makefile'' and ''optiboot.c'' files to the folder in step1.1
step1.4 I opened windows command prompt in administrator mode and went to the folder in step1.1
step1.5 I run command ''omake'' and get the error;

''c:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot>..\..\. .\tools\avr\utils\bin\make OS=windows ENV=arduino atmega328
The system cannot find the path specified.

step1.6 I edit ''omake.bat'' changing the line from ''..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino %*'' to ''..\..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino %*''
step1.7 run command ''omake'' again and get different error as;

c:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot>..\..\. .\..\tools\avr\utils\bin\make OS=windows ENV=arduino process_begin: CreateProcess(NULL, ../../../tools/avr/bin/avr-gcc -g -Wall -Os - fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DVIRTUAL_BOOT -E bau dcheck.c -o baudcheck.tmp.sh, ...) failed. make (e=2): The system cannot find the file specified. make: [baudcheck] Error 2 (ignored) baudcheck.tmp.sh: baudcheck.tmp.sh: No such file or directory make: [baudcheck] Error 127 (ignored) ../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-spl it-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L  -DBAUD_RATE=1152 00 -DLED_START_FLASHES=3      '-DVIRTUAL_BOOT'   -c -o optiboot.o optiboot.c process_begin: CreateProcess(NULL, ../../../tools/avr/bin/avr-gcc -g -Wall -Os - fno-inline-small-functions -fno-split-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L -DBAUD_RATE=115200 -DLED_START_FLASHES=3 -DVIRTUAL_BOOT -c -o optiboot.o optiboot.c, ...) failed. make (e=2): The system cannot find the file specified. make: *** [optiboot.o] Error 2


step2. downloading arduino ide 1.0.6 windows installation
(as Felix advices 1.0.6, mentioning on his posts several times saying him personally finding newer Arduino versions annoying and some things are damaged)
step2.1 uninstall arduino ide 1.5.6 r2
step2.2 remove and delete all files c:\program files (x86)\arduino
step2.3 after the arduino 1.0.6 installation end, I went to the folder ''C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot''
step2.4 I copied 'Makefile'' and ''optiboot.c'' files from DualOptiBoot zip archieve to the folder in step2.3
step2.5 I opened windows command prompt in administrator mode and went to the folder in step2.3
step2.6 I run command ''omake atmega328'' and get the error;

c:\Program Files (x86)\Arduino\hardware\arduino\bootloaders\optiboot>..\..\..\to ols\avr\utils\bin\make OS=windows ENV=arduino atmega328 avr-gcc: baudcheck.c: No such file or directory avr-gcc: no input files make: [baudcheck] Error 1 (ignored) baudcheck.tmp.sh: baudcheck.tmp.sh: No such file or directory make: [baudcheck] Error 127 (ignored) ../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-spl it-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L  -DBAUD_RATE=1152 00 -DLED_START_FLASHES=3        -c -o optiboot.o optiboot.c optiboot.c:317:2: warning: #warning BAUD_RATE error greater than -2% optiboot.c: In function 'CheckFlashImage': optiboot.c:544: error: 'PB3' undeclared (first use in this function) optiboot.c:544: error: (Each undeclared identifier is reported only once optiboot.c:544: error: for each function it appears in.) optiboot.c:544: error: 'PB5' undeclared (first use in this function) make: *** [optiboot.o] Error 1

step2.7 I edit optiboot.c file and went to the line around 544 then changed ''PB3'' to ''PINB3'' and ''PB5'' to ''PINB5''
step2.8 I run command ''omake atmega328'' again and a windows crash window appears saying ''ld.exe has stopped working'' (you can find the screenshot attached) with the output on command prompt window as;

c:\Program Files (x86)\Arduino\hardware\arduino\bootloaders\optiboot>..\..\..\to ols\avr\utils\bin\make OS=windows ENV=arduino atmega328 avr-gcc: baudcheck.c: No such file or directory avr-gcc: no input files make: [baudcheck] Error 1 (ignored) baudcheck.tmp.sh: baudcheck.tmp.sh: No such file or directory make: [baudcheck] Error 127 (ignored) ../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-spl it-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L  -DBAUD_RATE=1152 00 -DLED_START_FLASHES=3        -c -o optiboot.o optiboot.c optiboot.c:317:2: warning: #warning BAUD_RATE error greater than -2% ../../../tools/avr/bin/avr-gcc -g -Wall -Os -fno-inline-small-functions -fno-spl it-wide-types -mshort-calls -mmcu=atmega328p -DF_CPU=16000000L  -DBAUD_RATE=1152 00 -DLED_START_FLASHES=3      -Wl,--section-start=.text=0x7c00 -Wl,--section-sta rt=.version=0x7ffe -Wl,--relax -nostartfiles -nostdlib -o optiboot_atmega328.elf optiboot.o make: *** [optiboot_atmega328.elf] Error 1 rm optiboot.o optiboot_atmega328.elf


Can you please guide me how to deal with compiling DualOptiBoot bootloader?

best regards,
Mirac

Title: Re: Compiling DualOptiBoot bootloader
Post by: underwater on November 28, 2016, 04:16:11 AM
The reason I want to compile dualoptiboot is that I need bootloader with 8mhz crystal.
Title: Re: Compiling DualOptiBoot bootloader
Post by: Felix on November 28, 2016, 10:20:12 AM
You probably are missing make in your ENV PATH.
It's usually in this directory: ...arduinoIDE\hardware\tools\avr\utils\bin\
Add that to your PATH and try again.
Title: Re: Compiling DualOptiBoot bootloader
Post by: underwater on December 04, 2016, 03:50:41 PM
Hello Felix, I tried your suggestion it did not work..
I have been trying to deal with the problem for days. I am now trying to compile on a linux machine with the latest gcc package.
Now, I am getting error attached.
When I searched on google, It seems to be about mapping. But I could not find a solution.

Title: Re: Compiling DualOptiBoot bootloader
Post by: perky on December 04, 2016, 05:09:38 PM
Have you included <avr/eeprom.h>?
Mark.
Title: Re: Compiling DualOptiBoot bootloader
Post by: underwater on December 05, 2016, 07:23:41 AM
Hello Mark, thanks for your reply.
Yes, I had.
Title: Re: Compiling DualOptiBoot bootloader
Post by: perky on December 05, 2016, 08:24:38 AM
Well that's interesting as 'undefined reference to eeprom_write_byte' implies it hasn't! Can you compile optiboot.c by itself? Are you sure the paths have been set up properly so that the avr releated functions are being included and compiled correctly?
Mark.
Title: Re: Compiling DualOptiBoot bootloader
Post by: underwater on December 05, 2016, 08:27:26 AM
Yes, i can compile optiboot.c without any problem.
Title: Re: Compiling DualOptiBoot bootloader
Post by: perky on December 05, 2016, 08:39:46 AM
OK. If you can compile it standalone then all's well with the syntax and it at least has a prototype to work with, but the linker can't find the function itself. You'll get similar errors for example if you include a header file with a prototype but don't have the corresponding c file in the project, the file will compile standalone but will fail to link with an undefined reference error. I'd check the paths for the libraries are set up properly.
Mark.
Title: Re: Compiling DualOptiBoot bootloader
Post by: J6B on October 29, 2017, 09:28:52 AM
Hi,

I'm getting the same error than you :
optiboot.c:544: error: 'PB3' undeclared (first use in this function)
...

Did you solved the problem?

Thanks