arduino / arduino-builder

A command line tool for compiling Arduino sketches
GNU General Public License v2.0
458 stars 114 forks source link

Referencing another platform's core with a different name than it's vendorID #352

Closed PatrickLove closed 4 years ago

PatrickLove commented 4 years ago

I am trying to define a custom board definition for a PCB I made using at ATMega1281. I want to mostly extend the MegaCore package, but with a few modifications mainly to use a different bootloader since I am running at an unsupported clock rate.

I saw on the wiki documentation that it was possible to reference another package's core/variants/platform config, etc. Among other things I set:

boardid.build.core=MegaCore:MCUdude_corefiles
boardid.build.variant=MegaCore:64-pin-avr
boardid.upload.tool=MegaCore:avrdude
boardid.bootloader.tool=MegaCore:avrdude

However this fails claiming MCUdude_corefiles:myvendorid:avr is missing. I then found that if I change the core to boardid.build.core=[anything]:MegaCore it does find the MegaCore package, but build.core.path ends up set to /path/to/MegaCore/platform/cores/MegaCore regardless of what I put in the first position. Since MegaCore has its core folder called MCUdude_corefiles instead, it fails to find any core headers. The loader in the Arduino IDE complains if the first part isn't a package, but even if you set it to a different package id (like arduino:MegaCore) it fails during build trying to include headers (and the log says Using core 'MegaCore' from platform in folder: /path/to/MegaCore/platform/).

It looks to me like arduino-builder is using the second half (core name) for both the referenced package and the name of the core to use within the package, and ignores the actual vendorID. Conveniently this works for the arduino:arduino core since they are the same, but it does not seem to work in general.

After going down this rabbit hole, I think I actually can use arduino:arduino and only reference the MegaCore variants to get what I was trying to achieve, but this seems like it could cause problems in other situations.

PatrickLove commented 4 years ago

Never mind, turns out I wasn't using the latest version. The problem was solved my Arduino install from 1.8.10 to 1.8.12.

matthijskooijman commented 4 years ago

Thanks for reporting, and the followup when you found out it was fixed :-)

For future reference, this was fixed by https://github.com/arduino/arduino-cli/pull/467