Open awonak opened 2 years ago
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 europi_rmx
and europi_xl
. We could add the following build constraint to the default europi configuration: //go:build !(europi_rmx || europi_xl)
. With that added, we can build the firmware without specifying any build tags when building for the default hardware configuration.
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 -tags europi
for default hardware.
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.go
for the official hardware configuration and 2)board_rmx.go
for the smd remix by @luisgongod. The first line of the file will be// go:build europi
and// go:build europi_rmx
respectively.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")
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!