Board manager - 2 types of board in one package?

I have some custom boards that I want users to be able to add to the IDE via package manager.

I have looked at the format of the json file and the archive, and I think I see how to do this. However, I have two types of board, one based on ATmega328p, and one based on ATtiny85 (derived from Dave Mellis's attiny package).

I would like my users to be able to add just one board manager URL and get all the boards in one package. I could set up the variants directories and a single boards.txt file. However the platform.txt for the two types of boards is different (as per Mellis). Must I have two json files, two packages, two board manager classes to be able to do this?


You can set properties in your boards.txt that are used in platform.txt. This allows the same platform.txt to behave differently depending on which board is selected. This is already done in any standard package, for example:
Arduino AVR Boards boards.txt has

is then used as {build.mcu} in platform.txt:

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}"

It's not limited to standardized properties such as build.mcu. You can create any properties you like. This should allow you to use a single platform.txt for both boards.

Ok, thanks, I’ll look deeper into that.