LowPowerLab Forum

Hardware support => Moteino => Topic started by: LukaQ on February 15, 2017, 08:08:46 AM

Title: Compiling bootloader [Solved: you need WinAVR, in cmd type make atmega328]
Post by: LukaQ on February 15, 2017, 08:08:46 AM
I haven't found any solution so I hope to get answer here.

As I found, I have to use old 1.0.5-r2 version, where I go to \hardware\arduino\bootloaders\optiboot\ and make backup of folder
Then I overwrite with  optiboot.c and makefile from LowPowerLabs Github, DualOptiboot.

Then I would need to run Admin CMD in that folder: make atmega328, but of course that doesn't work
'make' is not recognized as an internal or external command,...
You have to run omake. In my case, it points to correct files.

But still, I get same error as user on this forum did, but wasn't answered how to compile.

I get this error:
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 -E baudcheck.c -o baudcheck.tmp.sh, ...) failed.
make (e=2): The system cannot find the file specified.
make: [baudcheck] Error 2 (ignored)
process_begin: CreateProcess(NULL, sh baudcheck.tmp.sh, ...) failed.
make (e=2): The system cannot find the file specified.
make: [baudcheck] Error 2 (ignored)
../../../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        -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 -c -o optiboot.o optiboot.c, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [optiboot.o] Error 2

Which are those file, that can't be found? It couldn't find because avr-gcc was avr-gcc-4.3.2 before I renamed it.. >:(
So how do I compile correct way?
Title: Re: Compiling bootloader
Post by: Felix on February 15, 2017, 08:11:56 AM
You have to install WinAVR (https://sourceforge.net/projects/winavr/).
Make sure that make is added to your SYSTEM PATH (setup does it for you). Also backup your SYSTEM PATH before this install just in case something goes wrong.
Then you go in the directory of DualOptiboot and run make atmega328 which should give you the necessary bootloader HEX output which you then burn with your ISP programmer.
Title: Re: Compiling bootloader
Post by: LukaQ on February 15, 2017, 08:29:40 AM
Quote from: Felix on February 15, 2017, 08:11:56 AM
You have to install WinAVR (https://sourceforge.net/projects/winavr/).
Make sure that make is added to your SYSTEM PATH (setup does it for you). Also backup your SYSTEM PATH before this install just in case something goes wrong.
Then you go in the directory of DualOptiboot and run make atmega328 which should give you the necessary bootloader HEX output which you then burn with your ISP programmer.
I do have WinAVR. By SYSTEM PATH you probably mean under win7 computer>properties>advance system settings>environment variables where under path it has :
\WinAVR\utils\bin;
\WinAVR\bin;

Among other things, from other programs..

So then doing to folder with that makefile and optiboot.c and pin_defs.h
I also had to move then boot.h and stk500.h for arduino

baudcheck.c is not needed?
Title: Re: Compiling bootloader
Post by: LukaQ on February 15, 2017, 10:58:14 AM
I'm happy to report, it all worked.
I will do tutorial, just to have everything in one place, i'm sure somebody else will find it useful.

The only thing that is bugging me is OTA program itself, if I have two HW transmitters close, I get a lot of time "is programer connected to comxx"

Title: Re: Compiling bootloader
Post by: Felix on February 15, 2017, 11:02:11 AM
Great, you can post any updates here in the forum...
RE the message - that usually means your programmer Moteino is not responding to the handshake. Having radios in close proximity should not really have any side effects like this, maybe something else could be causing this
Title: Re: Compiling bootloader
Post by: LukaQ on February 15, 2017, 11:11:49 AM
Initializing...
COM11 opened @ 115200
Set TargetID to 111...Target set ok!
Wait for handshake...COM-port read timeout!
Handshake NOT ok! Check TargetID and try again.
Programming aborted.

this is what comes up, radios have antennas in save orientation, 1-2 feet one above other. If one has antenna turned on its side 90°, which shouldn't work, but probably does because of reflections of walls. If I grab antenna or stand between radios (I will assume that I lower signal by doing that), it starts to program right away. Then 1s it takes 1s to read flash and it is ready and works