From 60c749e62d904103a261ae832b325b2d827227af Mon Sep 17 00:00:00 2001 From: klangner Date: Wed, 28 Feb 2024 09:30:36 +0100 Subject: [PATCH] project rename --- Cargo.toml | 7 +- README.md | 216 +------------------------------------------------ src/bin/i2s.rs | 2 +- 3 files changed, 7 insertions(+), 218 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8ffd073..58df39f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,9 @@ [package] -authors = ["the rp-rs team"] -edition = "2018" +authors = ["Krzysztof Langner klangner@gmail.com"] +edition = "2021" readme = "README.md" -name = "rp-pico-sandbox" +name = "rp2040-examples" version = "0.1.0" -resolver = "2" [dependencies] cortex-m = "0.7" diff --git a/README.md b/README.md index c6f8b8a..7800bfc 100644 --- a/README.md +++ b/README.md @@ -1,211 +1,6 @@ -# Project template for rp2040-hal +# Raspberry Pico (RP2040) examples -This template is intended as a starting point for developing your own firmware based on the rp2040-hal. - -It includes all of the `knurling-rs` tooling as showcased in https://github.com/knurling-rs/app-template (`defmt`, `defmt-rtt`, `panic-probe`, `flip-link`) to make development as easy as possible. - -`probe-run` is configured as the default runner, so you can start your program as easy as -```sh -cargo run --release -``` - -If you aren't using a debugger, check out [alternative runners](#alternative-runners) for other options - - -
- -

Table of Contents

-
    -
  1. Requirements
  2. -
  3. Installation of development dependencies
  4. -
  5. Running
  6. -
  7. Alternative runners
  8. -
  9. Roadmap
  10. -
  11. Contributing
  12. -
  13. Code of conduct
  14. -
  15. License
  16. -
  17. Contact
  18. -
-
- - -
-

Requirements

- -- The standard Rust tooling (cargo, rustup) which you can install from https://rustup.rs/ - -- Toolchain support for the cortex-m0+ processors in the rp2040 (thumbv6m-none-eabi) - -- flip-link - this allows you to detect stack-overflows on the first core, which is the only supported target for now. - -- probe-run. Upstream support for RP2040 was added with version 0.3.1. - -- A CMSIS-DAP probe. (J-Link and other probes will not work with probe-run) - - You can use a second Pico as a CMSIS-DAP debug probe by installing the following firmware on it: - https://github.com/majbthrd/DapperMime/releases/download/20210225/raspberry_pi_pico-DapperMime.uf2 - - More details on supported debug probes can be found in [debug_probes.md](debug_probes.md) - -
- - -
-

Installation of development dependencies

- -```sh -rustup target install thumbv6m-none-eabi -cargo install flip-link -# This is our suggested default 'runner' -cargo install probe-run -# If you want to use elf2uf2-rs instead of probe-run, instead do... -cargo install elf2uf2-rs --locked -``` - -
- - - -
-

Running

- -For a debug build -```sh -cargo run -``` -For a release build -```sh -cargo run --release -``` - -If you do not specify a DEFMT_LOG level, it will be set to `debug`. -That means `println!("")`, `info!("")` and `debug!("")` statements will be printed. -If you wish to override this, you can change it in `.cargo/config.toml` -```toml -[env] -DEFMT_LOG = "off" -``` -You can also set this inline (on Linux/MacOS) -```sh -DEFMT_LOG=trace cargo run -``` - -or set the _environment variable_ so that it applies to every `cargo run` call that follows: -#### Linux/MacOS/unix -```sh -export DEFMT_LOG=trace -``` - -Setting the DEFMT_LOG level for the current session -for bash -```sh -export DEFMT_LOG=trace -``` - -#### Windows -Windows users can only override DEFMT_LOG through `config.toml` -or by setting the environment variable as a separate step before calling `cargo run` -- cmd -```cmd -set DEFMT_LOG=trace -``` -- powershell -```ps1 -$Env:DEFMT_LOG = trace -``` - -```cmd -cargo run -``` - -
- -
-

Alternative runners

- -If you don't have a debug probe or if you want to do interactive debugging you can set up an alternative runner for cargo. - -Some of the options for your `runner` are listed below: - -* **Loading a UF2 over USB** - *Step 1* - Install [`elf2uf2-rs`](https://github.com/JoNil/elf2uf2-rs): - - ```console - $ cargo install elf2uf2-rs --locked - ``` - - *Step 2* - Make sure your .cargo/config contains the following - - ```toml - [target.thumbv6m-none-eabi] - runner = "elf2uf2-rs -d" - ``` - - The `thumbv6m-none-eabi` target may be replaced by the all-Arm wildcard - `'cfg(all(target_arch = "arm", target_os = "none"))'`. - - *Step 3* - Boot your RP2040 into "USB Bootloader mode", typically by rebooting - whilst holding some kind of "Boot Select" button. On Linux, you will also need - to 'mount' the device, like you would a USB Thumb Drive. - - *Step 4* - Use `cargo run`, which will compile the code and started the - specified 'runner'. As the 'runner' is the elf2uf2-rs tool, it will build a UF2 - file and copy it to your RP2040. - - ```console - $ cargo run --release --example pico_pwm_blink - ``` - -* **Loading with picotool** - As ELF files produced by compiling Rust code are completely compatible with ELF - files produced by compiling C or C++ code, you can also use the Raspberry Pi - tool [picotool](https://github.com/raspberrypi/picotool). The only thing to be - aware of is that picotool expects your ELF files to have a `.elf` extension, and - by default Rust does not give the ELF files any extension. You can fix this by - simply renaming the file. - - This means you can't easily use it as a cargo runner - yet. - - Also of note is that the special - [pico-sdk](https://github.com/raspberrypi/pico-sdk) macros which hide - information in the ELF file in a way that `picotool info` can read it out, are - not supported in Rust. An alternative is TBC. - -
- - - -## Roadmap - -NOTE These packages are under active development. As such, it is likely to -remain volatile until a 1.0.0 release. - -See the [open issues](https://github.com/rp-rs/rp2040-project-template/issues) for a list of -proposed features (and known issues). - -## Contributing - -Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. - -The steps are: - -1. Fork the Project by clicking the 'Fork' button at the top of the page. -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) -3. Make some changes to the code or documentation. -4. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -5. Push to the Feature Branch (`git push origin feature/AmazingFeature`) -6. Create a [New Pull Request](https://github.com/rp-rs/rp-hal/pulls) -7. An admin will review the Pull Request and discuss any changes that may be required. -8. Once everyone is happy, the Pull Request can be merged by an admin, and your work is part of our project! - -## Code of Conduct - -Contribution to this crate is organized under the terms of the [Rust Code of -Conduct][CoC], and the maintainer of this crate, the [rp-rs team], promises -to intervene to uphold that code of conduct. - -[CoC]: CODE_OF_CONDUCT.md -[rp-rs team]: https://github.com/orgs/rp-rs/teams/rp-rs +Based on template: https://github.com/rp-rs/rp2040-project-template ## License @@ -215,9 +10,4 @@ Apache-2.0 licence when you re-use this code. See `MIT` or `APACHE2.0` for more information on each specific licence. Any submissions to this project (e.g. as Pull Requests) must be made available -under these terms. - -## Contact - -Raise an issue: [https://github.com/rp-rs/rp2040-project-template/issues](https://github.com/rp-rs/rp2040-project-template/issues) -Chat to us on Matrix: [#rp-rs:matrix.org](https://matrix.to/#/#rp-rs:matrix.org) +under these terms. \ No newline at end of file diff --git a/src/bin/i2s.rs b/src/bin/i2s.rs index 7d2fb4f..6652e41 100644 --- a/src/bin/i2s.rs +++ b/src/bin/i2s.rs @@ -16,7 +16,7 @@ use panic_probe as _; use rp_pico as bsp; #[allow(unused_imports)] use num_traits::float::Float; -use rp_pico_sandbox::oscillator::{Oscillator, Square}; +use rp2040_examples::oscillator::{Oscillator, Square}; // Sound sample rate