I use MightyCore when I am using an ATMega1284. I love the options of setting BOD, MHz, Bootloader, etc. I would love to use those options for the ATMEGA328 as well. And this is where I am confused. The github for MightyCore states in the readme a list of "Supported microcontrollers" which matches my board options when compiling. The 328 is NOT on that list! However, looking at the directory on my computer (...\MightyCore\hardware\avr\2.0.4\bootloaders\optiboot_flash\bootloaders)
I see a whole lot more CPUs listed than in the readme on github. I DO see the ATMEGA328!
So, I am confused as to why MightyCore includes the bootloaders for so many CPUs, but "doesn't support" them?
Having looked into it a bit deeper, it would seem to me that one could simply add additional entries into the \packages\MightyCore\hardware\avr\2.0.4\boards.txt and the additional CPUs would "magically" appear in the Boards option when compiling.
Is it that simple? Any hints on where else entries may need to be made? Is this doable?
Thanks for any suggestions, even if it is "you are an idiot" because I am naive enough to think this is doable at all.
Thanks @MCUDude for creating MightyCore in the first place!
the bootloaders folder is linked to the optiboot_flash repository which is shared between MCUdude's cores.
@mrburnette Atmega328p is in MiniCore and ATMega2560 in MegaCore
To supplement Juraj's answer, I'll share a link to the excellent MiniCore, which provides the equivalent configurability for the family of AVR chips including ATmega328:
As with MightyCore, MiniCore also uses the shared collection of Optiboot bootloader builds maintained in the MCUdude/optiboot_flash
repository.
It is not necessary because it has already been done in the other MCUdude AVR platforms (including MegaCore).
That said, you can indeed add additional boards to MightyCore. Even if not necessary, if this is something you are interested in, I say go ahead and give it a try. I think it is very fun to play around with the Arduino boards platform framework. There is a technical reference for it here:
https://arduino.github.io/arduino-cli/latest/platform-specification/
I think you will find it useful to look at some existing boards platforms. Here are some more simple platforms that make good introductory references:
If you only wanted to make a variant of the configuration of one of the existing entries in boards.txt
, then it would be a quick copy/paste in boards.txt
, restart Arduino IDE and there you would see a new board in the Tools > Board > MightyCore menu just as you guessed.
However, adding support for a chip like ATmega328 would require more work. The pin mapping for each board is defined in a "core variant". For example, here you see the variant name configured for the ATmega1284 board:
https://github.com/MCUdude/MightyCore/blob/v2.1.3/avr/boards.txt#L77-L86
# Pinouts
1284.menu.pinout.standard=Standard pinout
1284.menu.pinout.standard.build.variant=standard
1284.menu.pinout.standard.build.bootloader_led=B0
1284.menu.pinout.bobuino=Bobuino pinout
1284.menu.pinout.bobuino.build.variant=bobuino
1284.menu.pinout.bobuino.build.bootloader_led=B7
1284.menu.pinout.sanguino=Sanguino pinout
1284.menu.pinout.sanguino.build.variant=sanguino
1284.menu.pinout.sanguino.build.bootloader_led=B0
Unfortunately the amazing configurability of MightyCore makes it not the best choice to learn about the Arduino boards platform framework. The variant is configured by the build.variant
property. In a more simple board definition, there would be only one property, something like this:
1284.build.variant=standard
but MightyCore allows you to adjust the configuration of the board using "custom board options", which produce the additional menus in Arduino IDE such as Tools > Pinout when you select a MightyCore board from the Tools > Board menu. The selection in that menu determines which of the build.variant
properties you see above are used (e.g., if you select Tools > Pinout > Bobuino pinout, the bobuino
variant will be used.
The Arduino build system uses the core variant from the folder with a name matching the value of the build.variant
property. So if the property is set to bobuino
, then this core variant will be compiled:
The pin mappings from the core variants included with MightyCore are applicable to the ATmega1284 family of chips, but wouldn't work for an ATmega328, so you would have to add a core variant to the platform in addition to your ATmega328 board definition in boards.txt
. Something like this:
Thank you! That information should suffice to get what I want. All I was after was being able to select MHz, BOD, etc. for the 328. It seems the easiest way then is to just install MiniCore and use that for the 328. If that doesn't work, you have supplied ample info that I should be able to come up with what I need! That info is very much appreciated!
How DOES one give Karma in this newer forum version?
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.