Skip to content
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

Use package metadata #509

Open
wants to merge 3 commits into
base: feature/ci-cd-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
- [ ] No new warnings or clippy suggestions have been introduced (see CI or check locally)

## If Adding a new Board
- [ ] Board CI added to `crates.json`
- [ ] Board is properly following "Tier 2" conventions, unless otherwise decided to be "Tier 1"
- [ ] Board `Cargo.toml` includes a `[package.metadata.atsamd.bsp]` with appropriate build and suppport instructions
- [ ] Board is properly following "Tier 2" conventions, unless otherwise decided to be "Tier 1"
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### Adding a new BSP/PAC

The build and release workflows will automatically recognize any new crate added to the repo,
but you will need to add some metadata to the crates's `Cargo.toml`.


```toml
# example of metadata for a BSP
[package.metadata.atsamd]
# also_build (optional): indicate if any additional crates (HAL | PAC | BSP's) should be built
# to properly test this crate
# also_build = ["crate", "crate2"]
Copy link
Contributor

@TDHolmes TDHolmes Oct 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo tree can figure out dependencies, I wonder if we can hook into that functionality to automatically figure out what else to build...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but we don't want to build all dependencies, The whole point of all this is to decouple dependencies and use semver to indicate compatibility so that if you're using a BSP, you'll get a compatible version of PAC/HAL.

This should really be used sparingly. Right now, it's an escape hatch for anything that has to fail release if a dependent package fails to build.

I should probably add documentation to that effect actually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah adding docs along those lines would help explain what this is doing. also this would be mostly applicable to tier 2 BSPs then, right? Mentioning that generality might be good too

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure generally this would apply mostly to tier 2. I think I'm missing the implication about tier 1. Are you thinking that a tier 1 BSP would automatically build other crates?

The build matrix in my head ATM is this: if the change is to a...

  • HAL -> automatically build T1 crates and all PAC's.
  • a PAC -> auto-build dependent T1 crates
  • any BSP -> no auto PAC/HAL

the also_build would be added to the outcome of that.


[package.metadata.atsamd.bsp]

# tier (required)
# see: https://github.com/atsamd-rs/atsamd#how-to-use-a-bsp-ie-getting-started-writing-your-own-code
# for determining what tier your BSP is
tier = 2

# build_command (required)
# used to invoke the appropriate build command for the bsp
build_command = "cargo build --examples --features=unproven"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering what you think about this defaulting to cargo build --examples --all-features? It should work for most boards. feather_m0 has some mutually exclusive pin assignments as features (which can go away once #483 pin aliases macro lands)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of that also as I wrote these up.


[package.metadata.atsamd.pac]
# target (required): the build target, used to configure the runner properly
target = "thumbv6m-none-eabi"
# features to build the pac with
features = ["samd21g", "unproven", "usb"]
```
5 changes: 5 additions & 0 deletions boards/arduino_mkr1000/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]

tier = 2
build_command = "cargo build --examples --features=unproven,usb"
4 changes: 4 additions & 0 deletions boards/arduino_mkrvidor4000/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"
4 changes: 4 additions & 0 deletions boards/arduino_mkrzero/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/arduino_nano33iot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/atsame54_xpro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ rt = ["cortex-m-rt", "atsamd-hal/same54p-rt"]
unproven = ["atsamd-hal/unproven"]
usb = ["atsamd-hal/usb", "usb-device", "usbd-serial"]

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[profile.dev]
incremental = false
codegen-units = 1
Expand Down
4 changes: 4 additions & 0 deletions boards/circuit_playground_express/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/edgebadge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ opt-level = 's'
[package.metadata]
chip = "ATSAMD51J19A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "usb_serial"
required-features = ["usb"]
Expand Down
5 changes: 5 additions & 0 deletions boards/feather_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD21G18A"

# for build and release automation
[package.metadata.atsamd.bsp]
tier =1
build_command = "cargo build --examples --features=unproven,dma,usb,rtic,sdmmc,adalogger"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/feather_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD51J19A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "pwm"
required-features = ["unproven"]
Expand Down
4 changes: 4 additions & 0 deletions boards/gemma_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21E18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/grand_central_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD51P20A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/itsybitsy_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/itsybitsy_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD51G19A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb,use_rtt"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/metro_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=unproven,usb,rtic"

[[example]]
name = "usb_echo"
required-features = ["usb", "unproven"]
Expand Down
4 changes: 4 additions & 0 deletions boards/metro_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ opt-level = 3
[package.metadata]
chip = "ATSAMD51J19A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/p1am_100/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ debug = true
lto = true
opt-level = "s"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/pfza_proto1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ opt-level = "s"
# for cargo flash
[package.metadata]
chip = "ATSAME54P20A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/pygamer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ opt-level = 's'
[package.metadata]
chip = "ATSAMD51J19A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=unproven,usb,math"

[[example]]
name = "usb_serial"
required-features = ["usb"]
Expand Down
4 changes: 4 additions & 0 deletions boards/pyportal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ opt-level = "s"
# for cargo flash
[package.metadata]
chip = "ATSAMD51J20A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/qt_py_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ rt = ["cortex-m-rt", "atsamd-hal/samd21e-rt"]
unproven = ["atsamd-hal/unproven"]
use_semihosting = []
usb = ["atsamd-hal/usb", "usb-device", "usbd-serial"]

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"
4 changes: 4 additions & 0 deletions boards/samd11_bare/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ debug = true
[package.metadata]
chip = "ATSAMD11C14A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=unproven,rt,use_semihosting"

[[example]]
name = "adc"
required-features = ["unproven", "rt", "use_semihosting"]
Expand Down
4 changes: 4 additions & 0 deletions boards/samd21_mini/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/serpente/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21E18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/sodaq_one/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"

[profile.dev]
incremental = false
codegen-units = 1
Expand Down
4 changes: 4 additions & 0 deletions boards/sodaq_sara_aff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ use_semihosting = []
# for cargo flash
[package.metadata]
chip = "ATSAMD21J18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven"
4 changes: 4 additions & 0 deletions boards/trellis_m4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD51G19A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=keypad-unproven"

[[example]]
name = "neopixel_accel"
required-features = ["adxl343"]
Expand Down
4 changes: 4 additions & 0 deletions boards/trinket_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21E18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "blinky_basic"

Expand Down
4 changes: 4 additions & 0 deletions boards/wio_lite_mg126/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ use_semihosting = []
[package.metadata]
chip = "ATSAMD21G18A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=unproven,usb"

[[example]]
name = "pwm"
required-features = ["unproven"]
Expand Down
4 changes: 4 additions & 0 deletions boards/wio_terminal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ opt-level = "s"
[package.metadata]
chip = "ATSAMD51P19A"

[package.metadata.atsamd.bsp]
tier = 1
build_command = "cargo build --examples --features=usb"

[[example]]
name = "blinky"

Expand Down
4 changes: 4 additions & 0 deletions boards/xiao_m0/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ opt-level = "s"
# for cargo flash
[package.metadata]
chip = "ATSAMD51P19A"

[package.metadata.atsamd.bsp]
tier = 2
build_command = "cargo build --examples --features=usb"
4 changes: 4 additions & 0 deletions pac/atsamd11c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv6m-none-eabi"
features = ["samd11c", "unproven"]
4 changes: 4 additions & 0 deletions pac/atsamd11d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv6m-none-eabi"
features = ["samd11d", "unproven"]
4 changes: 4 additions & 0 deletions pac/atsamd21e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv6m-none-eabi"
features = ["samd21e", "unproven", "usb"]
4 changes: 4 additions & 0 deletions pac/atsamd21g/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv6m-none-eabi"
features = ["samd21g", "unproven", "usb"]
4 changes: 4 additions & 0 deletions pac/atsamd21j/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv6m-none-eabi"
features = ["samd21j", "unproven", "usb"]
4 changes: 4 additions & 0 deletions pac/atsamd51g/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv7em-none-eabihf"
features = ["samd51g", "unproven", "usb"]
4 changes: 4 additions & 0 deletions pac/atsamd51j/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ optional = true

[features]
rt = ["cortex-m-rt/device"]

[package.metadata.atsamd.pac]
target = "thumbv7em-none-eabihf"
features = ["samd51j", "unproven", "usb"]
Loading