Optiboot / optiboot

Small and Fast Bootloader for Arduino and other Atmel AVR chips
Other
1.09k stars 401 forks source link

Cannot compile optiboot in Atmel Studio7 for atmega328pb (please help...) #234

Closed focussing closed 6 years ago

focussing commented 6 years ago

My situation:

atmega328pb: TARGET = atmega328pb
atmega328pb: MCU_TARGET = atmega328pb
atmega328pb: CFLAGS += $(COMMON_OPTIONS) $(UART_CMD)
atmega328pb: AVR_FREQ ?= 16000000L
atmega328pb: LDSECTIONS  = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe
atmega328pb: $(PROGRAM)_atmega328pb.hex
atmega328pb: $(PROGRAM)_atmega328pb.lst

Build FAILED. ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========


- to me it lookes that the 328pb device is not recognized... what am I doing wrong?
WestfW commented 6 years ago

For recent chips, Atmel/Microchip is adding them via something they call "packs." To compile for 328pb, you'll need to add something like:

atmega328pb: CFLAGS += -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328pb"
atmega328pb: CFLAGS += -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"

This is pretty awful, which is why the current 328pb build actually compiles for an ordinary 328p instead. Of course, this also means that the current source doesn't actually support 328pb "natively", so you'll get new errors even after you use the above modifications. But they won't be as overwhelmingly mysterious...

I'll check whether there is some better solution for this.

focussing commented 6 years ago

It works! Thank you very much. I need the second uart of the 328pb so cannot use the 328p, that's why I really need this.

There is a bug in the solution's Build Events Post-build command line. It should be like this cp ../bootloaders/optiboot/*.hex . otherwise the build fails.

Also the following error occurs:

C:\develop\optiboot\AtmelStudio\makefile(515,1): error: recipe for target 'baudcheck' failed
        avr-gcc -g -Wall -Os -fno-split-wide-types -mrelax -mmcu=atmega328pb -DF_CPU=16000000L  -DBAUD_RATE=115200 -DLED_START_FLASHES=3    -DLED=B2  -DUART=1 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\gcc\dev\atmega328pb" -I "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.209\include"   -c -o optiboot.o optiboot.c
        process_begin: CreateProcess(NULL, bash baudcheck.tmp.sh, ...) failed.
        make (e=2): Het systeem kan het opgegeven bestand niet vinden.
        make: [baudcheck] Error 2 (ignored)

I don't know how to fix this. Copying the baudcheck.c file to the "studio" directory does not help.

WestfW commented 6 years ago

Some of this might be fixed by https://github.com/Optiboot/optiboot/commit/70bd967c3cc5e242f09cb4849e2ce396bfc60fe7 (assuming that the 328pb avr-gcc stuff is installed.) The actual request for official support of 32pb and the 2nd UART I've created a new issue for: https://github.com/Optiboot/optiboot/issues/238