### Run Embedded Application Source: https://github.com/knurling-rs/app-template/blob/main/README.md Compiles and runs the 'hello.rs' example application using probe-rs. ```console $ cargo rb hello Finished `dev` profile [optimized + debuginfo] target(s) in 0.01s Running `probe-rs run --chip nrf52840_xxaa --log-format=oneline target/thumbv6m-none-eabi/debug/hello` Erasing ✔ 100% [####################] 8.00 KiB @ 15.79 KiB/s (took 1s) Programming ✔ 100% [####################] 8.00 KiB @ 13.19 KiB/s (took 1s) Finished in 1.11s Hello, world! $ echo $? 0 ``` -------------------------------- ### Memory Configuration Example Source: https://github.com/knurling-rs/app-template/blob/main/README.md An example of a memory configuration file (memory.x) used for linking embedded projects. ```text MEMORY { FLASH : ORIGIN = 0x00000000, LENGTH = 1024K RAM : ORIGIN = 0x20000000, LENGTH = 256K } ``` -------------------------------- ### Install cargo-generate Source: https://github.com/knurling-rs/app-template/blob/main/README.md Installs cargo-generate, a tool used to scaffold projects from templates. ```bash cargo install cargo-generate ``` -------------------------------- ### Install flip-link Source: https://github.com/knurling-rs/app-template/blob/main/README.md Installs the flip-link tool, a dependency for managing embedded project linking. ```bash cargo install flip-link ``` -------------------------------- ### Initialize Project with app-template Source: https://github.com/knurling-rs/app-template/blob/main/README.md Generates a new embedded project using the app-template from GitHub. ```bash cargo generate \ --git https://github.com/knurling-rs/app-template \ --branch main \ --name my-app ``` -------------------------------- ### Configure Compilation Target Source: https://github.com/knurling-rs/app-template/blob/main/README.md Sets the compilation target for the project in .cargo/config.toml. This example targets Cortex-M4F. ```toml # .cargo/config.toml [build] target = "thumbv7em-none-eabihf" # Cortex-M4F (with FPU) ``` -------------------------------- ### Configure probe-rs Chip Source: https://github.com/knurling-rs/app-template/blob/main/README.md Sets the target chip for probe-rs in the .cargo/config.toml file. This example uses nRF52840_xxAA. ```toml # .cargo/config.toml runner = ["probe-rs", "run", "--chip", "nRF52840_xxAA", "--log-format=oneline"] ``` -------------------------------- ### Import HAL in Source Source: https://github.com/knurling-rs/app-template/blob/main/README.md Imports the specified Hardware Abstraction Layer (HAL) crate in the main source file (src/lib.rs). ```rust // my-app/src/lib.rs use nrf52840_hal as _; // memory layout ``` -------------------------------- ### Add Target Architecture Source: https://github.com/knurling-rs/app-template/blob/main/README.md Adds the specified compilation target architecture to rustup. ```bash rustup target add thumbv7em-none-eabihf ``` -------------------------------- ### Run Unit Tests with Cargo Source: https://github.com/knurling-rs/app-template/blob/main/README.md Executes unit tests for the library crate using the `cargo test --lib` command. This command compiles the library and runs tests, including those for private APIs. ```console $ cargo test --lib Compiling example v0.1.0 (./knurling-rs/example) Finished `test` profile [optimized + debuginfo] target(s) in 0.15s Running unittests src/lib.rs (target/thumbv6m-none-eabi/debug/deps/example-2b0d0e25d141bf57) Erasing ✔ 100% [####################] 8.00 KiB @ 15.99 KiB/s (took 1s) Programming ✔ 100% [####################] 8.00 KiB @ 13.33 KiB/s (took 1s) Finished in 1.10s (1/1) running `it_works`... all tests passed! ``` -------------------------------- ### Configure rust-analyzer Linked Projects Source: https://github.com/knurling-rs/app-template/blob/main/README.md Adds a configuration to `.vscode/settings.json` to enable rust-analyzer to work transparently across workspaces by linking project Cargo.toml files. ```json { "rust-analyzer.linkedProjects": [ "Cargo.toml", "firmware/Cargo.toml" ] } ``` -------------------------------- ### Add HAL Dependency Source: https://github.com/knurling-rs/app-template/blob/main/README.md Adds the nrf52840-hal crate as a dependency in Cargo.toml for the nRF52840 microcontroller. ```toml # Cargo.toml [dependencies] nrf52840-hal = "0.14.0" ``` -------------------------------- ### Run Integration Tests with Cargo Source: https://github.com/knurling-rs/app-template/blob/main/README.md Executes integration tests located in the `tests` directory using the `cargo test --test ` command. The argument must match the test file name. ```console $ cargo test --test integration Compiling example v0.1.0 (./knurling-rs/example) Finished `test` profile [optimized + debuginfo] target(s) in 0.10s Running tests/integration.rs (target/thumbv6m-none-eabi/debug/deps/integration-aaaff41151f6a722) Erasing ✔ 100% [####################] 8.00 KiB @ 16.03 KiB/s (took 0s) Programming ✔ 100% [####################] 8.00 KiB @ 13.19 KiB/s (took 1s) Finished in 1.11s (1/1) running `it_works`... all tests passed! ``` -------------------------------- ### Adjust RTT Buffer Size Source: https://github.com/knurling-rs/app-template/blob/main/README.md Sets the DEFMT_RTT_BUFFER_SIZE environment variable to reduce the device memory buffer size if memory overflow occurs. ```console $ DEFMT_RTT_BUFFER_SIZE=64 cargo rb hello ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.