Skip to content

Custom platform packages per build environment #1367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ivankravets opened this issue Feb 15, 2018 · 10 comments
Closed

Custom platform packages per build environment #1367

ivankravets opened this issue Feb 15, 2018 · 10 comments
Milestone

Comments

@ivankravets
Copy link
Member

ivankravets commented Feb 15, 2018

Would be good to have an option which will allow overriding built-in dev/platform packages or providing a new one. Proposition is to add platform_packages option to platformio.ini. For example,

[env:myenv]
platform = ...
framework = ...
board = ...
platform_packages =
  pkg_with_spec_version@<4.5
  git_pkg@http://github.com/...

Later, custom packages could be used in pair with http://docs.platformio.org/en/latest/projectconf/advanced_scripting.html

@boneskull
Copy link

Ivan, if I was going to implement, where would I start?

@boneskull
Copy link

Insofar as "custom tooling", I'm seeing the Custom Uploader docs, but they don't make a distinction between "uploading firmware" and "uploading something else". In other words, pio run -t upload vs. pio run -t uploadfs.

In my original post, the tool mentioned is for uploading a filesystem. It's also worth mentioning that I need two separate tools to upload two separate filesystems.

@ivankravets
Copy link
Member Author

@alexwhittemore
Copy link

Is it safe to bet based on the lack of documentation that no such functionality has made it to the point of release yet? For example, I'm trying to add support for a custom SAMD board, using the Arduino framework. As far as I can tell, I'll have to fork platformio-pkg-framework-arduinosam and add a custom arduino "variant" for my board specifics, then also fork platform-atmelsam and add a "board.json" describing the board to PlatformIO. Then in platformio.ini I can add the repository URL of the custom platform.

Is all of that still necessary, as of now?

@ivankravets
Copy link
Member Author

@alexwhittemore you can put "variant" folder to ~/.platformio/packages/framework-atmelsam

As for the "board.json", please create "boards" folder in a project and put your "board.json" here.

@alexwhittemore
Copy link

If I do that, however, it'll get clobbered by mainline package updates, no? And even if the update mechanism doesn't clear out untracked changes, that method seems like it's got low portability for replicating environments across multiple developers. That vs, say, having a "packages/framework-atmelsam/..." directory inside the project that gets considered, but tracked under the project's git repo.

Maybe there's not a super duper clean way to accomplish this and that's why it's not included yet. But if board.json can be covered by existing mechanisms, maybe doing something similar for the framework side is reasonable. And either way, I'd LOVE to see official documentation on the best way to accomplish this as of the current most recent release, since it's pretty opaque as-is.

@ivankravets
Copy link
Member Author

@alexwhittemore do you have any ideas on how to better resolve this issue?

@alexwhittemore
Copy link

Not exactly, no, but I do have ideas for documentation.

My perfect situation would be to add a ‘boards/myboard.json’ and a ‘variants/myvariant’ dir, but there are a bunch of reasons that it’d be a bad hack at best. How would PIO know which framework it was for? Is the directory structure the same for frameworks besides Arduino? Etc.

I think the “correct” solution is to add documentation about how to do just this, for example, for the Arduino framework. For instance, searching for “add a board” led me on a long journey to finally figure out that, for example, “framework version” can be a full url to a git repo.

I’m happy to have a go at writing that up if there’s some kind of infrastructure for documentation PRs? It’ll probably require a bit of post processing given I’m far from a PIO expert.

@ivankravets
Copy link
Member Author

See docs https://docs.platformio.org/en/latest/projectconf/section_env_general.html

@alexwhittemore
Copy link

This is really excellent, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants