platformio / platform-atmelsam

Atmel SAM: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelsam
Apache License 2.0
79 stars 107 forks source link

Add changes that allow use of a portable variants file #74

Closed Timvrakas closed 4 years ago

Timvrakas commented 4 years ago

This is what I've been using to load portable variants files. You maintain a folder variant in the project directory, and set env.Append(OVERRIDE_VARIANT=True) in a script, which activates this code. I'm not sure how to implement this as an option in platformio.ini, which would be more intuitive. Open for feedback!

Tim

yyachim commented 4 years ago

This appears to be what I've been looking for. Do you have an example project configured to use this?

Timvrakas commented 4 years ago

Yes, see https://github.com/stanford-ssi/olympus-quail The relevant aspects boil down to:

let me know if you have any questions, Tim

yyachim commented 4 years ago

That is very helpful. Thank you!

ivankravets commented 4 years ago

How about if we add support for board_build.variants_dir? Then you can create in your project custom_variants and later use in platformio.ini:

[env:myenv]
board_build.variant = feather0custom
board_build.variants_dir = custom_variants

It will automatically find custom_variants in a project root. A relative path is OK.

Timvrakas commented 4 years ago

That sounds good to me. I'll take a look at implementing it.

valeros commented 4 years ago

Hi @Timvrakas ! I've added the feature with custom variants. Could you please retest with the latest atmelsam platform? (Also, keep in mind that the upload process for adafruit boards (based on samd21) has been modified in the dev branch).

[env:adafruit_feather_m0]
platform = https://github.com/platformio/platform-atmelsam.git
board = adafruit_feather_m0
framework = arduino
board_build.variant = feather0custom
board_build.variants_dir = custom_variants

Thanks!

Timvrakas commented 4 years ago

Awesome, it looks like it works! For anyone interested, my project now looks like this: https://github.com/stanford-ssi/olympus-quail/commit/eebde2d8b049af9956f5535ddcebfebb1631b643

Thanks a lot for the help folks!