Minicore (MCUdude) versus Optiboot 8.0 board definition

A program that compiles well under Optiboot 8.0 (by westfw) board definitions for the 32 pin processor (using Preferences/Additional Board Manager url https://github.com/Optiboot/optiboot/releases/download/v8.0/package_optiboot_optiboot-additional_index.json) gives a compile error when MCUdude's Minicore for the 328P is used.

The Optiboot 8.0 board definitions are installed using the Board Manager

The program contains the following qualifiers for compilation for different processors:

#if defined (ESP32) || (ESP8266)
#define ESP
#endif

#if defined (ARDUINO_AVR_LEONARDO)
#define AVR_UNO
#elif defined (ARDUINO_AVR_UNO)
#define AVR_UNO
#elif defined (ARDUINO_AVR_PRO)
#define AVR_UNO
#elif defined (ARDUINO_AVR_NANO)
#define AVR_UNO
#endif

I can find the board definitions under c:/users/username/AppData/Local/Arduino15/packages/Arduino/hardware/avr/1.8.5/boards.txt for Arduino; similar for the Optiboot 8.0 defintions, as well as for the Minicore definitions.

But I do not know how to write a qualifier for the Pro Mini when compiling for Minicore 328P board.

Any help is much appreciated.

Hi @brice3010

When you select Tools > Board > MiniCore > ATmega328 from the Arduino IDE menus, minicore sets the build.board property to AVR_ATmega328:

https://github.com/MCUdude/MiniCore/blob/v2.2.1/avr/boards.txt#L53

328.build.board=AVR_ATmega328

This property is used to define a board identification macro when compiling. For example, you can see the C++ compilation pattern here:

https://github.com/MCUdude/MiniCore/blob/v2.2.1/avr/platform.txt#L60

recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

contains the flag -DARDUINO_{build.board}.

So the macro ARDUINO_AVR_ATmega328 will be defined when compiling for this board.

1 Like

Many thanks @ptillisch!

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.