forked from esp-rs/esp-hal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the
qa-test
package (esp-rs#2558)
* Teach `xtask` about the `qa-test` package * Create the `qa-test` package and move some examples to it * Check `qa-test` package in CI * Add `README.md`
- Loading branch information
1 parent
c6404fe
commit 2472e36
Showing
18 changed files
with
159 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[alias] | ||
esp32 = "run --release --features=esp32 --target=xtensa-esp32-none-elf" | ||
esp32c2 = "run --release --features=esp32c2 --target=riscv32imc-unknown-none-elf" | ||
esp32c3 = "run --release --features=esp32c3 --target=riscv32imc-unknown-none-elf" | ||
esp32c6 = "run --release --features=esp32c6 --target=riscv32imac-unknown-none-elf" | ||
esp32h2 = "run --release --features=esp32h2 --target=riscv32imac-unknown-none-elf" | ||
esp32s2 = "run --release --features=esp32s2 --target=xtensa-esp32s2-none-elf" | ||
esp32s3 = "run --release --features=esp32s3 --target=xtensa-esp32s3-none-elf" | ||
|
||
[target.'cfg(target_arch = "riscv32")'] | ||
runner = "espflash flash --monitor" | ||
rustflags = [ | ||
"-C", "link-arg=-Tlinkall.x", | ||
"-C", "force-frame-pointers", | ||
] | ||
|
||
[target.'cfg(target_arch = "xtensa")'] | ||
runner = "espflash flash --monitor" | ||
rustflags = [ | ||
# GNU LD | ||
"-C", "link-arg=-Wl,-Tlinkall.x", | ||
"-C", "link-arg=-nostartfiles", | ||
|
||
# LLD | ||
# "-C", "link-arg=-Tlinkall.x", | ||
# "-C", "linker=rust-lld", | ||
] | ||
|
||
[env] | ||
ESP_LOG = "info" | ||
|
||
[unstable] | ||
build-std = ["alloc", "core"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
name = "qa-test" | ||
version = "0.0.0" | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
publish = false | ||
|
||
[dependencies] | ||
cfg-if = "1.0.0" | ||
embassy-executor = { version = "0.6.0", features = ["task-arena-size-12288"] } | ||
embassy-time = "0.3.2" | ||
embedded-graphics = "0.8.1" | ||
embedded-hal-async = "1.0.0" | ||
esp-alloc = { path = "../esp-alloc" } | ||
esp-backtrace = { path = "../esp-backtrace", features = ["exception-handler", "panic-handler", "println"] } | ||
esp-hal = { path = "../esp-hal" } | ||
esp-hal-embassy = { path = "../esp-hal-embassy" } | ||
esp-println = { path = "../esp-println", features = ["log"] } | ||
lis3dh-async = "0.9.3" | ||
ssd1306 = "0.8.4" | ||
|
||
[features] | ||
esp32 = ["esp-backtrace/esp32", "esp-hal/esp32", "esp-hal-embassy/esp32", "esp-println/esp32"] | ||
esp32c2 = ["esp-backtrace/esp32c2", "esp-hal/esp32c2", "esp-hal-embassy/esp32c2", "esp-println/esp32c2"] | ||
esp32c3 = ["esp-backtrace/esp32c3", "esp-hal/esp32c3", "esp-hal-embassy/esp32c3", "esp-println/esp32c3"] | ||
esp32c6 = ["esp-backtrace/esp32c6", "esp-hal/esp32c6", "esp-hal-embassy/esp32c6", "esp-println/esp32c6"] | ||
esp32h2 = ["esp-backtrace/esp32h2", "esp-hal/esp32h2", "esp-hal-embassy/esp32h2", "esp-println/esp32h2"] | ||
esp32s2 = ["esp-backtrace/esp32s2", "esp-hal/esp32s2", "esp-hal-embassy/esp32s2", "esp-println/esp32s2"] | ||
esp32s3 = ["esp-backtrace/esp32s3", "esp-hal/esp32s3", "esp-hal-embassy/esp32s3", "esp-println/esp32s3"] | ||
|
||
embassy-generic-timers = ["embassy-time/generic-queue-8"] | ||
|
||
[profile.release] | ||
debug = 2 | ||
lto = "fat" | ||
codegen-units = 1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# `qa-test` | ||
|
||
This package contains a number of binary applications intended for manual/quality-assurance testing. | ||
|
||
Each device has its own unique set of peripherals, and as such not every test will run on every device. We recommend building and flashing the tests using the `xtask` method documented below, which will greatly simplify the process. | ||
|
||
To check if a device is compatible with a given test, check the metadata comments above the imports, which will list all supported devices following the `//% CHIPS:` designator. If this metadata is not present, then the test will work on any device supported by `esp-hal`. | ||
|
||
As previously stated, we use the [cargo-xtask] pattern for automation. Commands invoking this tool must be run from the root of the repository. | ||
|
||
[cargo-xtask]: https://github.com/matklad/cargo-xtask | ||
|
||
## Building Tests | ||
|
||
You can build all examples for a given device using the `build-examples` subcommand: | ||
|
||
```shell | ||
cargo xtask build-examples qa-test esp32 | ||
``` | ||
|
||
Note that we must specify which package to build the tests for, since this repository contains multiple packages. | ||
|
||
## Running Tests | ||
|
||
You can also build and then subsequently flash and run an test using the `run-example` subcommand. With a target device connected to your host system, run: | ||
|
||
```shell | ||
cargo xtask run-example qa-test esp32c6 hello_world | ||
``` | ||
|
||
Again, note that we must specify which package to build the test from, plus which test to build and flash to the target device. | ||
|
||
## Adding Tests | ||
|
||
If you are contributing to `esp-hal` and would like to add an test, the process is generally the same as any other project. | ||
|
||
One major difference in our case is the metadata comments which state the compatible devices and required features for an test. Both of these designators are optional; if `//% CHIPS:` is omitted then all devices considered to be supported, and if `//% FEATURES:` is omitted then no features are enabled at build time. | ||
|
||
To demonstrated, in `src/bin/embassy_hello_world.rs` you will see the following: | ||
|
||
```rust | ||
//% CHIPS: esp32 esp32c2 esp32c3 esp32c6 esp32h2 esp32s2 esp32s3 | ||
//% FEATURES: embassy esp-hal-embassy/integrated-timers | ||
``` | ||
|
||
Another thing to be aware of is the GPIO pins being used. We have tried to use pins available the DevKit-C boards from Espressif, however this is being done on a best-effort basis. | ||
|
||
In general, the following GPIO are recommended for use, though be conscious of whether certain pins are used for UART, strapping pins, etc. on some devices: | ||
|
||
- GPIO0 | ||
- GPIO1 | ||
- GPIO2 | ||
- GPIO3 | ||
- GPIO4 | ||
- GPIO5 | ||
- GPIO8 | ||
- GPIO9 | ||
- GPIO10 |
This file contains 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
7 changes: 3 additions & 4 deletions
7
...in/embassy_i2c_bmp180_calibration_data.rs → ...in/embassy_i2c_bmp180_calibration_data.rs
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,7 @@ pub enum Package { | |
EspWifi, | ||
Examples, | ||
HilTest, | ||
QaTest, | ||
XtensaLx, | ||
XtensaLxRt, | ||
} | ||
|
This file contains 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