Build flags for supporting alternate hardware configuration#1
Open
Build flags for supporting alternate hardware configuration#1
Conversation
Owner
Author
|
An alternate design consideration, for the default europi configuration, we could instead add a build flag constraint that will only build that file when no other EuroPi board is specified. Say for example we had the other board configurations Considering that we can easily automate build tasks in VSCode, I don't think this is necessary to do for the purpose of avoiding specifying |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When DIY EuroPi modules use different GPIO pin configurations, we want to be able to easily support those different configurations without requiring a separate fork. This can be solved using the Go feature build constraints along with separate gpio configuration files with build constraint headers.
For example, we can define two files 1)
board.gofor the official hardware configuration and 2)board_rmx.gofor the smd remix by @luisgongod. The first line of the file will be// go:build europiand// go:build europi_rmxrespectively.With that in place, the EuroPiGo firmware can be build using the command:
or
In order to use this in VSCode, we will need to make a few adjustments to the VSCode settings.
Add "-tags europi" to tasks.json (or "-tags europi_rmx")
{ "version": "2.0.0", "tasks": [ { "label": "tinygo flash", "type": "shell", "command": "tinygo flash -tags europi --target pico -opt 1 ${workspaceRoot}/examples/clockwerk", "group": { "kind": "build", "isDefault": true }, "problemMatcher": [] } ] }Add the build constraint flag to
settings.json(either "europi" or "europi_rmx"):Now you can build and flash the firmware for either hardware configuration!