diff --git a/Cargo.toml b/Cargo.toml index 103e7ae..16292d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,17 +2,14 @@ # TODO fix `authors` and `name` if you didn't use `cargo-generate` authors = ["{{authors}}"] name = "{{project-name}}" -edition = "2018" +edition = "2021" version = "0.1.0" -[workspace] -members = ["testsuite"] - [dependencies] -defmt = "0.3.0" -defmt-rtt = "0.3.0" -panic-probe = { version = "0.3.0", features = ["print-defmt"] } -cortex-m = "0.7" +cortex-m = { version = "0.7", features = ["critical-section-single-core"] } +defmt = "0.3" +defmt-rtt = "0.4" +panic-probe = { version = "0.3", features = ["print-defmt"] } # TODO select the correct rtic backend rtic = { version = "2.0.0-alpha.1", features = [ "correct-rtic-backend" ] } # TODO enter your HAL here diff --git a/README.md b/README.md index 14b8154..4f532a3 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,10 @@ For the nRF52840 you'll want to use the [`nrf52840-hal`]. +nrf52840-hal = "0.16.0" ``` +⚠️ Note for RP2040 users ⚠️ + +You will need to not just specify the `rp-hal` HAL, but a BSP (board support crate) which includes a second stage bootloader. Please find a list of available BSPs [here](https://github.com/rp-rs/rp-hal-boards#packages). + #### 6. Import your HAL Now that you have selected a HAL, fix the HAL import in `src/lib.rs` @@ -165,6 +169,12 @@ $ echo $? 0 ``` +If you're running out of memory (`flip-link` bails with an overflow error), you can decrease the size of the device memory buffer by setting the `DEFMT_RTT_BUFFER_SIZE` environment variable. The default value is 1024 bytes, and powers of two should be used for optimal performance: + +``` console +$ DEFMT_RTT_BUFFER_SIZE=64 cargo rb hello +``` + #### (10. Set `rust-analyzer.linkedProjects`) If you are using [rust-analyzer] with VS Code for IDE-like features you can add following configuration to your `.vscode/settings.json` to make it work transparently across workspaces. Find the details of this option in the [RA docs]. diff --git a/src/lib.rs b/src/lib.rs index f181f6a..e22eaf7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ +#![no_main] #![no_std] -use core::sync::atomic::{AtomicUsize, Ordering}; - use defmt_rtt as _; // global logger // TODO adjust HAL import diff --git a/testsuite/Cargo.toml b/testsuite/Cargo.toml deleted file mode 100644 index 06834a5..0000000 --- a/testsuite/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -# TODO fix `authors` if you didn't use `cargo-generate` -authors = ["{{authors}}"] -name = "testsuite" -publish = false -edition = "2021" -version = "0.1.0" - -[lib] -harness = false - -[[test]] -name = "test" -harness = false - -[dependencies] -{{project-name}} = { path = ".." } -cortex-m = "0.7" -cortex-m-rt = "0.7" -defmt = "0.3.0" -defmt-rtt = "0.3.0" -defmt-test = "0.3.0" -panic-probe = { version = "0.3.0", features = ["print-defmt"] } - diff --git a/testsuite/src/lib.rs b/testsuite/src/lib.rs deleted file mode 100644 index d4dd9ce..0000000 --- a/testsuite/src/lib.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![no_std] -#![cfg_attr(test, no_main)] - -use {{crate_name}} as _; // memory layout + panic handler - -#[defmt_test::tests] -mod tests {} diff --git a/testsuite/tests/test.rs b/testsuite/tests/test.rs deleted file mode 100644 index b26f3bf..0000000 --- a/testsuite/tests/test.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![no_std] -#![no_main] - -use {{crate_name}} as _; // memory layout + panic handler - -// See https://crates.io/crates/defmt-test/0.1.0 for more documentation (e.g. about the 'state' -// feature) -#[defmt_test::tests] -mod tests { - use defmt::{assert, assert_eq}; - - #[test] - fn assert_true() { - assert!(true) - } - - #[test] - fn assert_eq() { - assert_eq!(24, 42, "TODO: write actual tests") - } -}