├── .gitignore ├── uart-test ├── .gitignore ├── Cargo.toml ├── src │ └── lib.rs └── Cargo.lock ├── boards ├── xiao_m0 │ ├── .gitignore │ ├── memory.x │ ├── .cargo │ │ └── config.toml │ ├── .vscode │ │ ├── tasks.json │ │ └── launch.json │ ├── Cargo.toml │ ├── src │ │ ├── swdio_pin.rs │ │ └── main.rs │ └── Cargo.lock ├── xiao_rp2040 │ ├── .gitignore │ ├── run-with-picotool.sh │ ├── .cargo │ │ └── config.toml │ ├── memory.x │ ├── README.ja.md │ ├── README.md │ ├── Cargo.toml │ ├── src │ │ └── main.rs │ └── Cargo.lock └── rpi_pico │ ├── .gitignore │ ├── build.rs │ ├── .cargo │ └── config.toml │ ├── memory.x │ ├── Cargo.toml │ ├── README.ja.md │ ├── README.md │ ├── src │ └── main.rs │ └── Cargo.lock ├── rust-dap ├── Cargo.toml ├── src │ ├── lib.rs │ ├── cursor.rs │ └── interface.rs └── Cargo.lock ├── README.ja.md ├── rust-dap-rp2040 ├── Cargo.toml ├── build.rs ├── src │ ├── lib.rs │ ├── pio │ │ └── mod.rs │ ├── swdio_pin.rs │ ├── util.rs │ └── line_coding.rs ├── link.ram.x └── Cargo.lock ├── README.md ├── .github └── workflows │ └── CI.yml └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | .vscode -------------------------------------------------------------------------------- /uart-test/.gitignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /boards/xiao_m0/.gitignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /boards/xiao_rp2040/.gitignore: -------------------------------------------------------------------------------- 1 | /target -------------------------------------------------------------------------------- /boards/rpi_pico/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .vscode/ -------------------------------------------------------------------------------- /boards/xiao_rp2040/run-with-picotool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | elf2uf2-rs "$1" && picotool load "$1.uf2" && picotool reboot 4 | exit $? -------------------------------------------------------------------------------- /boards/rpi_pico/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | #[cfg(feature = "defmt")] 3 | { 4 | println!("cargo:rustc-link-arg=-Tdefmt.x"); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /boards/xiao_rp2040/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "thumbv6m-none-eabi" 3 | 4 | [target.thumbv6m-none-eabi] 5 | runner = "elf2uf2-rs -d" 6 | #runner = "./run-with-picotool.sh" 7 | rustflags = [ 8 | "-C", "link-arg=-Tlink.ram.x", "-C", "link-arg=--nmagic", 9 | ] -------------------------------------------------------------------------------- /boards/xiao_m0/memory.x: -------------------------------------------------------------------------------- 1 | MEMORY 2 | { 3 | /* Leave 8k for the default bootloader on the Seeeduino XIAO */ 4 | FLASH (rx) : ORIGIN = 0x00000000 + 8K, LENGTH = 256K - 8K 5 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K 6 | } 7 | _stack_start = ORIGIN(RAM) + LENGTH(RAM); -------------------------------------------------------------------------------- /uart-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "uart-test" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | serialport = "4.0" 10 | rand = "0.6" -------------------------------------------------------------------------------- /boards/xiao_m0/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "thumbv6m-none-eabi" 3 | 4 | [target.thumbv6m-none-eabi] 5 | runner = "hf2 elf" 6 | #runner = "probe-run --chip atsamd21g18a" 7 | rustflags = [ 8 | "-C", "link-arg=-Tlink.x", "-C", "link-arg=--nmagic", 9 | ] 10 | -------------------------------------------------------------------------------- /boards/rpi_pico/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "thumbv6m-none-eabi" 3 | 4 | [target.thumbv6m-none-eabi] 5 | runner = "elf2uf2-rs -d" 6 | #runner = "picotool load -x -t elf" 7 | #runner = "probe-run --probe xiao-rp2040 --chip RP2040" # Program target with rust-dap on XIAO RP2040 (for rust-dap RP2040 development board) 8 | rustflags = ["-C", "link-arg=-Tlink.ram.x", "-C", "link-arg=--nmagic"] 9 | -------------------------------------------------------------------------------- /boards/rpi_pico/memory.x: -------------------------------------------------------------------------------- 1 | MEMORY { 2 | BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 3 | FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100 4 | RAM : ORIGIN = 0x20000000, LENGTH = 256K 5 | } 6 | 7 | EXTERN(BOOT2_FIRMWARE) 8 | 9 | SECTIONS { 10 | /* ### Boot loader */ 11 | .boot2 ORIGIN(BOOT2) : 12 | { 13 | KEEP(*(.boot2)); 14 | } > BOOT2 15 | } INSERT BEFORE .text; -------------------------------------------------------------------------------- /boards/xiao_rp2040/memory.x: -------------------------------------------------------------------------------- 1 | MEMORY { 2 | BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 3 | FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100 4 | RAM : ORIGIN = 0x20000000, LENGTH = 256K 5 | } 6 | 7 | EXTERN(BOOT2_FIRMWARE) 8 | 9 | SECTIONS { 10 | /* ### Boot loader */ 11 | .boot2 ORIGIN(BOOT2) : 12 | { 13 | KEEP(*(.boot2)); 14 | } > BOOT2 15 | } INSERT BEFORE .text; -------------------------------------------------------------------------------- /boards/xiao_m0/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // tasks.json の形式に関するドキュメントについては 3 | // https://go.microsoft.com/fwlink/?LinkId=733558 を参照してください 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "cargo", 8 | "command": "build", 9 | "problemMatcher": [ 10 | "$rustc" 11 | ], 12 | "group": { 13 | "kind": "build", 14 | "isDefault": true 15 | }, 16 | "label": "build rust-dap-xiao" 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /boards/xiao_m0/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-dap-xiao" 3 | version = "0.1.0" 4 | authors = ["Kenta IDA "] 5 | edition = "2021" 6 | license = "Apache-2.0" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | rust-dap = { path = "../../rust-dap", features = ["bitbang", "unproven"] } 12 | xiao_m0 = { version = "0.11", features = ["usb", "unproven"]} 13 | panic-halt = "0.2" 14 | cortex-m = "0.6" 15 | cortex-m-rt = "0.6" 16 | 17 | usb-device = { version = "0.2", features = ["control-buffer-256"]} 18 | usbd-serial = "0.1" 19 | nb = "0.1" 20 | heapless = "0.7" 21 | embedded-hal = { version = "0.2.6", features = ["unproven"] } -------------------------------------------------------------------------------- /rust-dap/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-dap" 3 | version = "0.2.0" 4 | authors = ["Kenta IDA "] 5 | edition = "2021" 6 | license = "Apache-2.0" 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [features] 10 | default = [] 11 | bitbang = ["embedded-hal"] 12 | unproven = [] 13 | defmt = ["dep:defmt"] 14 | 15 | [dependencies] 16 | defmt = { version = "0.3", optional = true } 17 | usb-device = "0.2" 18 | nb = "0.1" 19 | heapless = "0.7" 20 | num_enum = { version = "0.5", default-features = false } 21 | bitflags = "1.2" 22 | embedded-hal = { version = "0.2", optional = true, features = ["unproven"] } 23 | bitvec = { version = "1.0.1", default-features = false } 24 | -------------------------------------------------------------------------------- /boards/xiao_m0/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug", 6 | "type": "cortex-debug", 7 | "request": "launch", 8 | "servertype": "external", 9 | "cwd": "${workspaceRoot}", 10 | "runToMain": true, 11 | "executable": "target/thumbv6m-none-eabi/debug/rust-dap-xiao", 12 | "device": "ATSAMD21G18", 13 | "gdbPath": "gdb-multiarch", 14 | "gdbTarget": "localhost:3333", 15 | "svdFile": "ATSAMD21G18A.svd", 16 | "runToEntryPoint": "main", 17 | "preLaunchTask": "build rust-dap-xiao", 18 | "showDevDebugOutput": false 19 | } 20 | ] 21 | } -------------------------------------------------------------------------------- /boards/xiao_rp2040/README.ja.md: -------------------------------------------------------------------------------- 1 | 2 | # XIAO RP2040 port 3 | 4 | [English](./README.md) 日本語 5 | 6 | ## ピン配置 7 | 8 | | ピン番号 | ピン名 | SWDピン接続先 | 9 | |:--------|:-------|:-------------| 10 | | GND | GND | GND | 11 | | 8 | GPIO2 | SWCLK | 12 | | 9 | GPIO4 | SWDIO | 13 | | 0 | GPIO26 | RESET | 14 | 15 | ## 使い方 16 | 17 | ### pyOCDを使う場合 18 | 19 | #### pyOCDのインストール 20 | 21 | ``` 22 | python3 -m pip install pyocd 23 | ``` 24 | 25 | #### pyOCDの実行とGDB接続 26 | 27 | ```sh 28 | pyocd gdbserver --target rp2040_core0 29 | ``` 30 | 31 | 別のターミナルでgdb実行 32 | 33 | Ubuntuのaptで入れられる `gdb-multiarch` だとアーキテクチャの認識に失敗するようなので、[Armのサイトからツールチェインをダウンロード](https://developer.arm.com/downloads/-/gnu-rm) して、その中のGDBを使う。 34 | 35 | ```sh 36 | arm-none-eabi-gdb -ex "target extended-remote localhost:3333" 37 | ``` 38 | -------------------------------------------------------------------------------- /rust-dap/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #![cfg_attr(not(test), no_std)] 18 | 19 | #[cfg(feature = "bitbang")] 20 | pub mod bitbang; 21 | mod cmsis_dap; 22 | mod cursor; 23 | mod interface; 24 | 25 | pub use crate::cmsis_dap::*; 26 | pub use crate::interface::*; 27 | -------------------------------------------------------------------------------- /README.ja.md: -------------------------------------------------------------------------------- 1 | # A CMSIS-DAP implementation in Rust 2 | 3 | [English](./README.md) 日本語 4 | ## 概要 5 | 6 | ![デバッグボード](./doc/figure/debug_board.drawio.svg) 7 | 8 | Arm用のデバッグ・アダプタのプロトコルおよびファームウェアの規格であるCMSIS-DAPのRust実装です。 9 | 10 | 現時点では他の実装と比較して性能やデバッグ・アダプタとしての機能面での優位性はありませんが、正しいWCID (Windows Compatibility ID) を返すことにより、Windowsでドライバの手動インストールを行わずに使用できます。 11 | 12 | ## 対応ボード 13 | 14 | 現在対応しているボードは以下の通りです。 15 | 各ボードごとのの実装については、 [boards](./boards) ディレクトリ以下に含まれています。 16 | 17 | | ボード名 | 対応機能 | ディレクトリ | 18 | |:------------------|:----------------|:--------------------| 19 | | Seeeduino XIAO | CMSIS-DAP | [./boards/xiao_m0](./boards/xiao_m0) | 20 | | XIAO RP2040 | CMSIS-DAP, UART | [./boards/xiao_rp2040](./boards/xiao_rp2040) | 21 | | Raspberry Pi Pico | CMSIS-DAP, UART | [./boards/rpi_pico](./boards/rpi_pico) | 22 | 23 | ## ライセンス 24 | 25 | ライセンスは `Apache-2.0 License` に従います。詳しくは [LICENSE](./LICENSE) ファイルを確認してください。 -------------------------------------------------------------------------------- /boards/xiao_rp2040/README.md: -------------------------------------------------------------------------------- 1 | # XIAO RP2040 port 2 | 3 | English [日本語](./README.ja.md) 4 | 5 | ## Pin assignments 6 | 7 | | Pin Number | Pin Name | SWD pin | 8 | |:--------|:-------|:-------------| 9 | | GND | GND | GND | 10 | | 8 | GPIO2 | SWCLK | 11 | | 9 | GPIO4 | SWDIO | 12 | | 0 | GPIO26 | RESET | 13 | 14 | ## How to build 15 | 16 | ## How to use 17 | 18 | ### Use with pyOCD 19 | 20 | #### Install pyOCD 21 | 22 | ``` 23 | python3 -m pip install pyocd 24 | ``` 25 | 26 | #### Run pyOCD and GDB connection 27 | 28 | ```sh 29 | pyocd gdbserver --target rp2040_core0 30 | ``` 31 | 32 | Run GDB in another terminal. 33 | 34 | `gdb-multiarch`, which is installed with `apt`, seems to fail to recognize the architecture correctly, so [download the toolchain from Arm's website](https://developer.arm.com/downloads/-/gnu-rm) 35 | and use GDB in it. 36 | 37 | ```sh 38 | arm-none-eabi-gdb -ex "target extended-remote localhost:3333" 39 | ``` 40 | -------------------------------------------------------------------------------- /rust-dap-rp2040/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-dap-rp2040" 3 | version = "0.2.0" 4 | authors = ["Kenta IDA "] 5 | edition = "2021" 6 | license = "Apache-2.0" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [features] 11 | bitbang = ["rust-dap/bitbang", "rust-dap/unproven"] 12 | set_clock = [ 13 | ] # Enable swj_clock implementation for bitbang and PIO and set appropriate SWCLK frequency. Otherwise, SWCLK is fixed to 15.625[MHz] 14 | ram-exec = [] # Execute-in-SRAM support 15 | defmt = ["dep:defmt"] 16 | 17 | [dependencies] 18 | rust-dap = { path = "../rust-dap" } 19 | rp2040-boot2 = "0.2" 20 | rp2040-hal = "0.8" 21 | pio = "0.2" 22 | panic-halt = "0.2" 23 | cortex-m = "0.7" 24 | cortex-m-rt = "0.7" 25 | cortex-m-rtic = "1.0" 26 | 27 | usb-device = { version = "0.2", features = ["control-buffer-256"] } 28 | usbd-serial = "0.1" 29 | nb = "0.1" 30 | heapless = "0.7" 31 | embedded-hal = { version = "0.2", features = ["unproven"] } 32 | fugit = "0.3" 33 | defmt = { version = "0.3", optional = true } 34 | bitvec = { version = "1.0.1", default-features = false } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A CMSIS-DAP implementation in Rust 2 | 3 | English [日本語](./README.ja.md) 4 | 5 | ## About this project 6 | 7 | ![Debug Board](./doc/figure/debug_board.drawio.svg) 8 | 9 | This is a Rust implementation of CMSIS-DAP, which is a protocol and firmware standard of debug adapters for Arm processors. 10 | 11 | At this time, it has no performance or feature advantage over other implementations as a debug adapter , but by returning the correct WCID (Windows Compatibility ID), it can be used on Windows without manual driver installation. 12 | 13 | ## Supported boards 14 | 15 | The following boards are currently supported. 16 | The implementation for each board is placed under the [boards](./boards) directory. 17 | 18 | | Bord name | Supported features | Directory | 19 | |:------------------|:----------------|:--------------------| 20 | | Seeeduino XIAO | CMSIS-DAP | [./boards/xiao_m0](./boards/xiao_m0) | 21 | | XIAO RP2040 | CMSIS-DAP, UART | [./boards/xiao_rp2040](./boards/xiao_rp2040) | 22 | | Raspberry Pi Pico | CMSIS-DAP, UART | [./boards/rpi_pico](./boards/rpi_pico) | 23 | 24 | ## License 25 | 26 | Distributed under `Apache-2.0 License` 27 | 28 | Check the [LICENSE](./LICENSE) file for details. -------------------------------------------------------------------------------- /boards/xiao_rp2040/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-dap-xiao-rp2040" 3 | version = "0.2.0" 4 | authors = ["Kenta IDA "] 5 | edition = "2021" 6 | license = "Apache-2.0" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [profile.release] 11 | debug = 2 12 | codegen-units = 1 13 | opt-level = 3 14 | lto = true 15 | 16 | [features] 17 | bitbang = ["rust-dap/bitbang", "rust-dap-rp2040/bitbang"] 18 | set_clock = ["rust-dap-rp2040/set_clock"] # Enable swj_clock implementation for PIO and set appropriate SWCLK frequency. Otherwise, SWCLK is fixed to 15.625[MHz] 19 | ram-exec = ["rust-dap-rp2040/ram-exec"] # Execute-in-SRAM support 20 | 21 | [dependencies.rp-pico] 22 | version = "0.7" 23 | # Below is to take out "boot2" from the set of features. 24 | default-features = false 25 | features = [ "rt", "critical-section-impl" ] 26 | 27 | [dependencies] 28 | rust-dap = { path = "../../rust-dap", features = ["unproven"] } 29 | rust-dap-rp2040 = { path = "../../rust-dap-rp2040" } 30 | panic-halt = "0.2" 31 | cortex-m = "0.7" 32 | cortex-m-rt = "0.7" 33 | cortex-m-rtic = "1.0" 34 | 35 | usb-device = { version = "0.2", features = ["control-buffer-256"]} 36 | usbd-serial = "0.1" 37 | nb = "0.1" 38 | heapless = "0.7" 39 | embedded-hal = { version = "0.2", features = ["unproven"]} 40 | -------------------------------------------------------------------------------- /rust-dap-rp2040/build.rs: -------------------------------------------------------------------------------- 1 | //! This build script copies the `memory.x` file from the crate root into 2 | //! a directory where the linker can always find it at build time. 3 | //! For many projects this is optional, as the linker always searches the 4 | //! project root directory -- wherever `Cargo.toml` is. However, if you 5 | //! are using a workspace or have a more complicated build setup, this 6 | //! build script becomes required. Additionally, by requesting that 7 | //! Cargo re-run the build script whenever `memory.x` is changed, 8 | //! updating `memory.x` ensures a rebuild of the application with the 9 | //! new memory settings. 10 | 11 | use std::env; 12 | use std::fs::File; 13 | use std::io::Write; 14 | use std::path::PathBuf; 15 | 16 | fn main() { 17 | // Put `link.ram.x` in our output directory and ensure it's 18 | // on the linker search path. 19 | let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 20 | let ram_exec = env::var("CARGO_FEATURE_RAM_EXEC").ok() != None; 21 | File::create(out.join("link.ram.x")) 22 | .unwrap() 23 | .write_all(if ram_exec { 24 | include_bytes!("link.ram.x") 25 | } else { 26 | b"INCLUDE link.x" 27 | }) 28 | .unwrap(); 29 | println!("cargo:rustc-link-search={}", out.display()); 30 | 31 | // By default, Cargo will re-run a build script whenever 32 | // any file in the project changes. By specifying `link.ram.x` 33 | // here, we ensure the build script is only re-run when 34 | // `link.ram.x` is changed. 35 | println!("cargo:rerun-if-changed=link.ram.x"); 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: Build test 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | format_and_clippy: 11 | runs-on: ubuntu-latest 12 | strategy: 13 | max-parallel: 2 14 | matrix: 15 | projects: ["rust-dap", "rust-dap-rp2040", "uart-test", "boards/rpi_pico", "boards/xiao_m0", "boards/xiao_rp2040"] 16 | container: 17 | image: rust:1.72-slim-bookworm 18 | steps: 19 | - uses: actions/checkout@v2 20 | - name: setup 21 | run: rustup component add rustfmt clippy 22 | - name: target add thumbv6m-none-eabi 23 | run: rustup target add thumbv6m-none-eabi 24 | if: ${{ startsWith(matrix.projects, 'boards') }} 25 | - name: install package dependencies 26 | run: apt-get update && apt-get -y install pkg-config libudev-dev 27 | if: ${{ matrix.projects == 'uart-test' }} 28 | - name: cargo fmt for ${{ matrix.projects }} 29 | run: cargo fmt --all -- --check 30 | working-directory: ${{ matrix.projects }} 31 | - name: cargo clippy for ${{ matrix.projects }} 32 | run: cargo clippy 33 | working-directory: ${{ matrix.projects }} 34 | if: ${{ matrix.projects != 'boards/rpi_pico' }} 35 | - name: cargo clippy for boards/rpi_pico 36 | run: | 37 | cargo clippy --features swd 38 | cargo clippy --features swd,bitbang 39 | cargo clippy --no-default-features --features jtag 40 | working-directory: ${{ matrix.projects }} 41 | if: ${{ matrix.projects == 'boards/rpi_pico' }} 42 | -------------------------------------------------------------------------------- /boards/rpi_pico/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rust-dap-raspberrypi-pico" 3 | version = "0.2.0" 4 | authors = ["Kenta IDA "] 5 | edition = "2021" 6 | license = "Apache-2.0" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [profile.release] 11 | debug = 2 12 | codegen-units = 1 13 | opt-level = 3 14 | lto = true 15 | 16 | [features] 17 | defmt = [ 18 | "dep:defmt", 19 | "dep:defmt-rtt", 20 | "dep:panic-probe", 21 | "rust-dap-rp2040/defmt", 22 | "rust-dap/defmt", 23 | ] 24 | default = ["swd"] 25 | bitbang = ["rust-dap/bitbang", "rust-dap-rp2040/bitbang"] 26 | set_clock = [ 27 | "rust-dap-rp2040/set_clock", 28 | ] # Enable swj_clock implementation for PIO and set appropriate SWCLK frequency. Otherwise, SWCLK is fixed to 15.625[MHz] 29 | jtag = [] 30 | swd = [] 31 | swj = [] 32 | ram-exec = ["rust-dap-rp2040/ram-exec"] # Execute-in-SRAM support 33 | 34 | [dependencies.rp-pico] 35 | version = "0.7" 36 | # Below is to take out "boot2" from the set of features. 37 | default-features = false 38 | features = ["rt", "critical-section-impl"] 39 | 40 | [dependencies] 41 | rust-dap = { path = "../../rust-dap", features = ["unproven"] } 42 | rust-dap-rp2040 = { path = "../../rust-dap-rp2040" } 43 | panic-halt = "0.2" 44 | cortex-m = { version = "0.7" } 45 | cortex-m-rt = "0.7" 46 | cortex-m-rtic = "1.0" 47 | 48 | usb-device = { version = "0.2", features = ["control-buffer-256"] } 49 | usbd-serial = "0.1" 50 | nb = "0.1" 51 | heapless = "0.7" 52 | embedded-hal = { version = "0.2", features = ["unproven"] } 53 | defmt = { version = "0.3", optional = true } 54 | defmt-rtt = { version = "0.4", optional = true } 55 | panic-probe = { version = "0.3", features = ["print-defmt"], optional = true } 56 | -------------------------------------------------------------------------------- /boards/rpi_pico/README.ja.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi Pico port 2 | 3 | [English](./README.md) 日本語 4 | 5 | ## ピン配置 6 | 7 | ![ピン配置](./rust-dap-pico.svg) 8 | 9 | | ピン番号 | ピン名 | SWDピン接続先 | JTAGピン接続先 | 10 | |:--------|:-------|:-------------|:--------------| 11 | | 3 | GND | GND | GND | 12 | | 4 | GPIO2 | SWCLK | TCK | 13 | | 5 | GPIO3 | SWDIO | TMS | 14 | | 6 | GPIO4 | RESET | nSRST | 15 | | 7 | GPIO5 | | TDO | 16 | | 9 | GPIO6 | | TDI | 17 | | 10 | GPIO7 | | nTRST | 18 | 19 | ## ビルド 20 | 21 | ### SWD用 22 | 23 | デフォルトのfeatureではPIOを使ったSWD用のrust-dapをビルドします。 24 | 25 | ``` 26 | cargo build --release 27 | ``` 28 | 29 | feature `bitbang` を有効にすると、PIOを使ったSWD通信処理ではなく、GPIOをCPUで制御してSWD通信処理を行います。 30 | 31 | ``` 32 | cargo build --release --features bitbang 33 | ``` 34 | 35 | ホストからのクロックレートの設定を有効にするには feature `set_clock` を有効にします。 PIO向けの場合はかなり正確にクロックレートを設定できますが、bitbangの場合はそれなりです。 36 | 37 | ``` 38 | cargo build --release --features set_clock # PIO 39 | cargo build --release --features set_clock,bitbang # bitbang 40 | ``` 41 | 42 | ### JTAG用 43 | 44 | JTAG用のファームウェアをビルドするには、 `--no-default-featrues` をつけて デフォルトで有効であるSWD機能のfeatureを無効化したうえで、 `jtag` featureを有効にします。 45 | 46 | ``` 47 | cargo build --release --no-default-features --features jtag 48 | ``` 49 | 50 | ホストからのクロックレートの設定を有効にするには feature `set_clock` を有効にします。 51 | 52 | ``` 53 | cargo build --release --no-default-features --features jtag,set_clock 54 | ``` 55 | 56 | ## 使い方 57 | 58 | ### pyOCDを使う場合 59 | 60 | #### pyOCDのインストール 61 | 62 | ``` 63 | python3 -m pip install pyocd 64 | ``` 65 | 66 | #### pyOCDの実行とGDB接続 67 | 68 | ```sh 69 | pyocd gdbserver --target rp2040_core0 70 | ``` 71 | 72 | 別のターミナルでgdb実行 73 | 74 | Ubuntuのaptで入れられる `gdb-multiarch` だとアーキテクチャの認識に失敗するようなので、[Armのサイトからツールチェインをダウンロード](https://developer.arm.com/downloads/-/gnu-rm) して、その中のGDBを使う。 75 | 76 | ```sh 77 | arm-none-eabi-gdb -ex "target extended-remote localhost:3333" 78 | ``` 79 | -------------------------------------------------------------------------------- /rust-dap-rp2040/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #![no_std] 18 | #![no_main] 19 | 20 | /// The linker will place this boot block at the start of our program image. We 21 | /// need this to help the ROM bootloader get our code up and running. 22 | #[cfg(feature = "ram-exec")] 23 | #[link_section = ".boot2"] 24 | #[no_mangle] 25 | #[used] 26 | pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_RAM_MEMCPY; 27 | 28 | /// The linker will place this boot block at the start of our program image. We 29 | /// need this to help the ROM bootloader get our code up and running. 30 | #[cfg(not(feature = "ram-exec"))] 31 | #[link_section = ".boot2"] 32 | #[no_mangle] 33 | #[used] 34 | pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080; 35 | 36 | pub mod line_coding; 37 | #[cfg(not(feature = "bitbang"))] 38 | pub mod pio; 39 | pub mod swdio_pin; 40 | pub mod util; 41 | 42 | use cortex_m_rt::pre_init; 43 | 44 | #[pre_init] 45 | unsafe fn pre_init() -> () { 46 | // clear_locks : this is what expected to be done by #[rp2040_hal::entry] . 47 | // but because we are gonna use #[rtic::app(...)] , we ought to do it here. 48 | const SIO_BASE: u32 = 0xd0000000; 49 | const SPINLOCK0_PTR: *mut u32 = (SIO_BASE + 0x100) as *mut u32; 50 | const SPINLOCK_COUNT: usize = 32; 51 | for i in 0..SPINLOCK_COUNT { 52 | SPINLOCK0_PTR.wrapping_add(i).write_volatile(1); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /uart-test/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg(test)] 2 | mod tests { 3 | use core::time::Duration; 4 | use rand::Rng; 5 | use serialport; 6 | use std::sync::mpsc::channel; 7 | use std::thread::spawn; 8 | 9 | #[test] 10 | fn loopback() { 11 | let port = serialport::new("/dev/ttyACM1", 921600) 12 | .stop_bits(serialport::StopBits::One) 13 | .data_bits(serialport::DataBits::Eight) 14 | .timeout(Duration::from_secs(5)) 15 | .open() 16 | .unwrap_or_else(|e| { 17 | eprintln!("Failed to open \"{}\"", e); 18 | ::std::process::exit(1); 19 | }); 20 | 21 | const NUMBER_OF_TRANSFERS: usize = 50; 22 | const BUFFER_SIZE: usize = 32; 23 | 24 | let (tx_send, tx_recv) = channel(); 25 | let (rx_send, rx_recv) = channel(); 26 | // Fill write buffer 27 | for _ in 0..10 { 28 | let buffer = vec![0u8; BUFFER_SIZE]; 29 | tx_send.send(buffer).unwrap(); 30 | } 31 | // Fill read buffer 32 | { 33 | let buffer = vec![0u8; BUFFER_SIZE]; 34 | rx_send.send(buffer).unwrap(); 35 | } 36 | 37 | let mut read_port = port.try_clone().expect("Failed to clone port."); 38 | let mut write_port = port; 39 | 40 | let write_thread = spawn(move || { 41 | let mut rng = rand::thread_rng(); 42 | for _ in 0..NUMBER_OF_TRANSFERS { 43 | let mut buffer = tx_recv.recv().unwrap(); 44 | //rng.fill(buffer.as_mut_slice()); 45 | for i in 0..buffer.len() { 46 | buffer[i] = i as u8; 47 | } 48 | write_port.write_all(&buffer).unwrap(); 49 | rx_send.send(buffer).unwrap(); 50 | } 51 | }); 52 | let read_thread = spawn(move || { 53 | let mut buffer = rx_recv.recv().unwrap(); 54 | for i in 0..NUMBER_OF_TRANSFERS { 55 | let expected = rx_recv.recv().unwrap(); 56 | read_port.read_exact(buffer.as_mut_slice()).unwrap(); 57 | assert_eq!(buffer, expected, "Failed at transfer {}", i); 58 | tx_send.send(buffer).ok(); 59 | buffer = expected; 60 | } 61 | }); 62 | 63 | read_thread.join().unwrap(); 64 | write_thread.join().unwrap(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /boards/rpi_pico/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi Pico port 2 | 3 | English [日本語](./README.ja.md) 4 | 5 | ## Pin assignments 6 | 7 | ![Pin assignments](./rust-dap-pico.svg) 8 | 9 | | Pin Number | Pin Name | SWD pin | JTAG pin | 10 | |:--------|:-------|:-------------|:--------------| 11 | | 3 | GND | GND | GND | 12 | | 4 | GPIO2 | SWCLK | TCK | 13 | | 5 | GPIO3 | SWDIO | TMS | 14 | | 6 | GPIO4 | RESET | nSRST | 15 | | 7 | GPIO5 | | TDO | 16 | | 9 | GPIO6 | | TDI | 17 | | 10 | GPIO7 | | nTRST | 18 | 19 | ## How to build 20 | 21 | ### For SWD 22 | 23 | By default, this project is configured to use `features` to build the firmware for SWD with PIO. 24 | 25 | ``` 26 | cargo build --release 27 | ``` 28 | 29 | When the feature `bitbang` is enabled, the firmware performs SWD communication by controlling GPIO from CPU instead of PIO. 30 | 31 | ``` 32 | cargo build --release --features bitbang 33 | ``` 34 | 35 | When the feature `set_clock` is enabled, the firmware supports setting clock rate from the host. If the firmware uses PIO, the accuracy of the clock rate is fairly accurate. If the firmware uses bitbang, the accuracy is not good. 36 | 37 | ``` 38 | cargo build --release --features set_clock # PIO 39 | cargo build --release --features set_clock,bitbang # bitbang 40 | ``` 41 | 42 | ### For JTAG 43 | 44 | In order to build firmware for JTAG, disable the default SWD features by specifying `--no-default-features` option and then enable the `jtag` feature. 45 | 46 | ``` 47 | cargo build --release --no-default-features --features jtag 48 | ``` 49 | 50 | Enable the feature `set_clock` to enable setting clock rate from the host PC. 51 | 52 | ``` 53 | cargo build --release --no-default-features --features jtag,set_clock 54 | ``` 55 | 56 | ## How to use 57 | 58 | ### Use with pyOCD 59 | 60 | #### Install pyOCD 61 | 62 | ``` 63 | python3 -m pip install pyocd 64 | ``` 65 | 66 | #### Run pyOCD and GDB connection 67 | 68 | ```sh 69 | pyocd gdbserver --target rp2040_core0 70 | ``` 71 | 72 | Run GDB in another terminal. 73 | 74 | `gdb-multiarch`, which is installed with `apt`, seems to fail to recognize the architecture correctly, so [download the toolchain from Arm's website](https://developer.arm.com/downloads/-/gnu-rm) 75 | and use GDB in it. 76 | 77 | ```sh 78 | arm-none-eabi-gdb -ex "target extended-remote localhost:3333" 79 | ``` 80 | -------------------------------------------------------------------------------- /rust-dap/src/cursor.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] 18 | pub enum CursorError { 19 | InsufficientBuffer, 20 | NotEnoughData, 21 | } 22 | pub trait CursorRead { 23 | fn read<'a>(&mut self, buffer: &'a mut [u8]) -> Result<&'a [u8], CursorError>; 24 | } 25 | pub trait CursorWrite { 26 | fn write(&mut self, data: &[u8]) -> Result<(), CursorError>; 27 | } 28 | 29 | pub struct BufferCursor { 30 | buffer: Buffer, 31 | position: usize, 32 | } 33 | 34 | impl BufferCursor { 35 | pub fn new(buffer: Buffer) -> Self { 36 | Self { 37 | buffer, 38 | position: 0, 39 | } 40 | } 41 | pub fn new_with_position(buffer: Buffer, position: usize) -> Self { 42 | Self { buffer, position } 43 | } 44 | #[allow(dead_code)] 45 | pub fn release(self) -> Buffer { 46 | self.buffer 47 | } 48 | #[allow(dead_code)] 49 | pub fn reset(&mut self) { 50 | self.position = 0; 51 | } 52 | pub fn get_position(&self) -> usize { 53 | self.position 54 | } 55 | } 56 | 57 | impl> CursorRead for BufferCursor { 58 | fn read<'a>(&mut self, buffer: &'a mut [u8]) -> Result<&'a [u8], CursorError> { 59 | let data = self.buffer.as_ref(); 60 | let remaining = data.len() - self.position; 61 | let bytes_to_read = core::cmp::min(remaining, buffer.len()); 62 | buffer.copy_from_slice(&data[self.position..self.position + bytes_to_read]); 63 | self.position += bytes_to_read; 64 | Ok(&buffer[0..bytes_to_read]) 65 | } 66 | } 67 | 68 | impl> CursorWrite for BufferCursor { 69 | fn write(&mut self, data: &[u8]) -> Result<(), CursorError> { 70 | let bytes_to_write = data.len(); 71 | let remaining = self.buffer.as_mut().len() - self.position; 72 | if remaining < bytes_to_write { 73 | Err(CursorError::InsufficientBuffer) 74 | } else { 75 | let buffer: &mut [u8] = self.buffer.as_mut(); 76 | buffer[self.position..self.position + bytes_to_write].copy_from_slice(data); 77 | self.position += bytes_to_write; 78 | Ok(()) 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /rust-dap-rp2040/src/pio/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Ein Terakawa 2 | // Copyright 2023 Toshifumi Nishinaga 3 | // 4 | // SPDX-License-Identifier: Apache-2.0 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); 7 | // you may not use this file except in compliance with the License. 8 | // You may obtain a copy of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | // See the License for the specific language governing permissions and 16 | // limitations under the License. 17 | 18 | use pio::Program; 19 | use rp2040_hal as hal; 20 | pub mod pio0 { 21 | use crate::pio::hal::{self, gpio::FunctionPio0}; 22 | pub type Pin

= hal::gpio::Pin; 23 | } 24 | 25 | pub mod jtag; 26 | pub mod swd; 27 | 28 | const DEFAULT_CORE_CLOCK: u32 = 125000000; 29 | /// Default PIO Divisor. 30 | /// Generate 125/8 = 15.625[MHz] SWCLK clock. 31 | /// Generate 125/8 = 15.625[MHz] TCK clock(max) 32 | const DEFAULT_PIO_DIVISOR: f32 = 1.0f32; 33 | 34 | fn swj_pins_program() -> Program<{ pio::RP2040_MAX_PROGRAM_SIZE }> { 35 | type Assembler = pio::Assembler<{ pio::RP2040_MAX_PROGRAM_SIZE }>; 36 | let mut a = Assembler::new(); 37 | let mut delay_loop = a.label(); 38 | let mut wrap_target = a.label(); 39 | let mut wrap_source = a.label(); 40 | 41 | a.bind(&mut wrap_target); 42 | 43 | // command data 44 | // [ 45 | // pin_output_values: u32, 46 | // pin_directions: u32, 47 | // wait_us: u32 48 | // ] 49 | 50 | // load and set output value 51 | a.pull(false, true); 52 | a.out(pio::OutDestination::PINS, 32); 53 | // load and set direction 54 | a.pull(false, true); 55 | a.out(pio::OutDestination::PINDIRS, 32); 56 | 57 | // load output delay to Y 58 | a.pull(false, true); 59 | a.out(pio::OutDestination::Y, 32); 60 | 61 | // wait_us 62 | a.bind(&mut delay_loop); 63 | // delay 9(+1) cycles * 0.1us/cycle = 1us 64 | a.jmp_with_delay(pio::JmpCondition::YDecNonZero, &mut delay_loop, 9); 65 | 66 | // check all pin status 67 | a.r#in(pio::InSource::PINS, 32); 68 | a.push(false, true); 69 | 70 | a.bind(&mut wrap_source); 71 | 72 | a.assemble_with_wrap(wrap_source, wrap_target) 73 | } 74 | 75 | fn all_pins_to_input_program() -> Program<{ pio::RP2040_MAX_PROGRAM_SIZE }> { 76 | type Assembler = pio::Assembler<{ pio::RP2040_MAX_PROGRAM_SIZE }>; 77 | let mut a = Assembler::new(); 78 | let mut wrap_target = a.label(); 79 | let mut wrap_source = a.label(); 80 | 81 | a.bind(&mut wrap_target); 82 | 83 | a.mov( 84 | pio::MovDestination::X, 85 | pio::MovOperation::None, 86 | pio::MovSource::NULL, 87 | ); 88 | a.out(pio::OutDestination::PINDIRS, 32); 89 | 90 | a.bind(&mut wrap_source); 91 | 92 | a.assemble_with_wrap(wrap_source, wrap_target) 93 | } 94 | -------------------------------------------------------------------------------- /boards/xiao_m0/src/swdio_pin.rs: -------------------------------------------------------------------------------- 1 | use embedded_hal::digital::v2::{InputPin, IoPin, OutputPin, PinState}; 2 | use xiao_m0::hal::gpio::v2::pin::{Disabled, Floating, Input, Output, Pin, PinId, PushPull}; 3 | 4 | pub struct XiaoSwdInputPin 5 | where 6 | I: PinId, 7 | { 8 | pin: Pin>, 9 | } 10 | 11 | impl XiaoSwdInputPin 12 | where 13 | I: PinId, 14 | { 15 | pub fn new(pin: Pin>) -> Self { 16 | Self { pin } 17 | } 18 | } 19 | 20 | impl InputPin for XiaoSwdInputPin 21 | where 22 | I: PinId, 23 | { 24 | type Error = core::convert::Infallible; 25 | fn is_high(&self) -> Result { 26 | self.pin.is_high() 27 | } 28 | fn is_low(&self) -> Result { 29 | self.pin.is_low() 30 | } 31 | } 32 | 33 | impl IoPin, XiaoSwdOutputPin> for XiaoSwdInputPin 34 | where 35 | I: PinId, 36 | { 37 | type Error = core::convert::Infallible; 38 | fn into_input_pin(self) -> Result, Self::Error> { 39 | Ok(self) 40 | } 41 | fn into_output_pin(self, state: PinState) -> Result, Self::Error> { 42 | let output_pin = self.pin.into_push_pull_output(); 43 | let mut new_pin = XiaoSwdOutputPin::new(output_pin); 44 | new_pin.set_state(state)?; 45 | Ok(new_pin) 46 | } 47 | } 48 | pub struct XiaoSwdOutputPin 49 | where 50 | I: PinId, 51 | { 52 | pin: Pin>, 53 | } 54 | 55 | impl XiaoSwdOutputPin 56 | where 57 | I: PinId, 58 | { 59 | pub fn new(pin: Pin>) -> Self { 60 | Self { pin } 61 | } 62 | } 63 | 64 | impl OutputPin for XiaoSwdOutputPin 65 | where 66 | I: PinId, 67 | { 68 | type Error = core::convert::Infallible; 69 | fn set_high(&mut self) -> Result<(), Self::Error> { 70 | self.pin.set_high() 71 | } 72 | fn set_low(&mut self) -> Result<(), Self::Error> { 73 | self.pin.set_low() 74 | } 75 | fn set_state(&mut self, state: embedded_hal::digital::v2::PinState) -> Result<(), Self::Error> { 76 | self.pin.set_state(state) 77 | } 78 | } 79 | 80 | impl IoPin, XiaoSwdOutputPin> for XiaoSwdOutputPin 81 | where 82 | I: PinId, 83 | { 84 | type Error = core::convert::Infallible; 85 | fn into_input_pin(self) -> Result, Self::Error> { 86 | let new_pin = self.pin.into_floating_input(); 87 | Ok(XiaoSwdInputPin::new(new_pin)) 88 | } 89 | fn into_output_pin(mut self, state: PinState) -> Result, Self::Error> { 90 | self.set_state(state)?; 91 | Ok(self) 92 | } 93 | } 94 | 95 | pub struct XiaoSwdPin 96 | where 97 | I: PinId, 98 | { 99 | pin: Pin>, 100 | } 101 | 102 | impl IoPin, XiaoSwdOutputPin> for XiaoSwdPin 103 | where 104 | I: PinId, 105 | { 106 | type Error = core::convert::Infallible; 107 | fn into_input_pin(self) -> Result, Self::Error> { 108 | let input_pin = self.pin.into_floating_input(); 109 | Ok(XiaoSwdInputPin::new(input_pin)) 110 | } 111 | fn into_output_pin(self, state: PinState) -> Result, Self::Error> { 112 | let output_pin = self.pin.into_push_pull_output(); 113 | let mut new_pin = XiaoSwdOutputPin::new(output_pin); 114 | new_pin.set_state(state)?; 115 | Ok(new_pin) 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /rust-dap-rp2040/src/swdio_pin.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | use embedded_hal::digital::v2::{InputPin, IoPin, OutputPin, PinState}; 18 | use hal::gpio::{Disabled, Floating, Input, Output, Pin, PinId, PushPull}; 19 | use rp2040_hal as hal; 20 | 21 | /// InputPin implementation for SWD pin 22 | pub struct PicoSwdInputPin 23 | where 24 | I: PinId, 25 | { 26 | pin: Pin>, 27 | } 28 | 29 | impl PicoSwdInputPin 30 | where 31 | I: PinId, 32 | { 33 | pub fn new(pin: Pin>) -> Self { 34 | Self { pin } 35 | } 36 | } 37 | 38 | impl InputPin for PicoSwdInputPin 39 | where 40 | I: PinId, 41 | { 42 | type Error = core::convert::Infallible; 43 | fn is_high(&self) -> Result { 44 | self.pin.is_high() 45 | } 46 | fn is_low(&self) -> Result { 47 | self.pin.is_low() 48 | } 49 | } 50 | 51 | impl IoPin, PicoSwdOutputPin> for PicoSwdInputPin 52 | where 53 | I: PinId, 54 | { 55 | type Error = core::convert::Infallible; 56 | fn into_input_pin(self) -> Result, Self::Error> { 57 | Ok(self) 58 | } 59 | fn into_output_pin(self, state: PinState) -> Result, Self::Error> { 60 | let output_pin = self.pin.into_push_pull_output_in_state(state); 61 | Ok(PicoSwdOutputPin::new(output_pin)) 62 | } 63 | } 64 | 65 | /// OutputPin implementation for SWD pin 66 | pub struct PicoSwdOutputPin 67 | where 68 | I: PinId, 69 | { 70 | pin: Pin>, 71 | } 72 | 73 | impl PicoSwdOutputPin 74 | where 75 | I: PinId, 76 | { 77 | pub fn new(pin: Pin>) -> Self { 78 | Self { pin } 79 | } 80 | } 81 | 82 | impl OutputPin for PicoSwdOutputPin 83 | where 84 | I: PinId, 85 | { 86 | type Error = core::convert::Infallible; 87 | fn set_high(&mut self) -> Result<(), Self::Error> { 88 | self.pin.set_high() 89 | } 90 | fn set_low(&mut self) -> Result<(), Self::Error> { 91 | self.pin.set_low() 92 | } 93 | fn set_state(&mut self, state: embedded_hal::digital::v2::PinState) -> Result<(), Self::Error> { 94 | self.pin.set_state(state) 95 | } 96 | } 97 | 98 | impl IoPin, PicoSwdOutputPin> for PicoSwdOutputPin 99 | where 100 | I: PinId, 101 | { 102 | type Error = core::convert::Infallible; 103 | fn into_input_pin(self) -> Result, Self::Error> { 104 | let input_pin = self.pin.into_floating_input(); 105 | Ok(PicoSwdInputPin::new(input_pin)) 106 | } 107 | fn into_output_pin(mut self, state: PinState) -> Result, Self::Error> { 108 | self.set_state(state)?; 109 | Ok(self) 110 | } 111 | } 112 | 113 | /// Pico SWD pin 114 | pub struct PicoSwdPin 115 | where 116 | I: PinId, 117 | { 118 | pin: Pin>, 119 | } 120 | 121 | impl IoPin, PicoSwdOutputPin> for PicoSwdPin 122 | where 123 | I: PinId, 124 | { 125 | type Error = core::convert::Infallible; 126 | fn into_input_pin(self) -> Result, Self::Error> { 127 | let input_pin = self.pin.into_floating_input(); 128 | Ok(PicoSwdInputPin::new(input_pin)) 129 | } 130 | fn into_output_pin(self, state: PinState) -> Result, Self::Error> { 131 | let output_pin = self.pin.into_push_pull_output_in_state(state); 132 | Ok(PicoSwdOutputPin::new(output_pin)) 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /rust-dap-rp2040/src/util.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | use crate::line_coding::UartConfig; 18 | use core::result::Result; 19 | use hal::usb::UsbBus; 20 | use rp2040_hal as hal; 21 | use rust_dap::{ 22 | CmsisDap, DapCapabilities, USB_CLASS_MISCELLANEOUS, USB_PROTOCOL_IAD, USB_SUBCLASS_COMMON, 23 | }; 24 | use usb_device::device::{UsbDevice, UsbDeviceBuilder, UsbVidPid}; 25 | use usb_device::{class_prelude::UsbBusAllocator, UsbError}; 26 | use usbd_serial::SerialPort; 27 | 28 | #[cfg(feature = "bitbang")] 29 | use crate::swdio_pin::{PicoSwdInputPin, PicoSwdOutputPin}; 30 | #[cfg(feature = "bitbang")] 31 | use rust_dap::bitbang::{DelayFunc, JtagIoSet as BitbangJtagIoSet, SwdIoSet as BitbangSwdIoSet}; 32 | #[cfg(feature = "bitbang")] 33 | pub type SwdIoSet = BitbangSwdIoSet< 34 | PicoSwdInputPin, 35 | PicoSwdOutputPin, 36 | PicoSwdInputPin, 37 | PicoSwdOutputPin, 38 | PicoSwdInputPin, 39 | PicoSwdOutputPin, 40 | CycleDelay, 41 | >; 42 | #[cfg(feature = "bitbang")] 43 | pub type JtagIoSet = BitbangJtagIoSet< 44 | PicoSwdInputPin, 45 | PicoSwdOutputPin, 46 | PicoSwdInputPin, 47 | PicoSwdOutputPin, 48 | PicoSwdInputPin, 49 | PicoSwdOutputPin, 50 | PicoSwdInputPin, 51 | PicoSwdOutputPin, 52 | PicoSwdInputPin, 53 | PicoSwdOutputPin, 54 | PicoSwdInputPin, 55 | PicoSwdOutputPin, 56 | CycleDelay, 57 | >; 58 | 59 | #[cfg(not(feature = "bitbang"))] 60 | use crate::pio::{jtag::JtagIoSet as PioJtagIoSet, pio0, swd::SwdIoSet as PioSwdIoSet}; 61 | #[cfg(not(feature = "bitbang"))] 62 | pub type SwdIoSet = PioSwdIoSet, pio0::Pin, pio0::Pin>; 63 | #[cfg(not(feature = "bitbang"))] 64 | pub type JtagIoSet = PioJtagIoSet< 65 | pio0::Pin, 66 | pio0::Pin, 67 | pio0::Pin, 68 | pio0::Pin, 69 | pio0::Pin, 70 | pio0::Pin, 71 | >; 72 | 73 | /// DelayFunc implementation which uses cortex_m::asm::delay 74 | #[cfg(feature = "bitbang")] 75 | pub struct CycleDelay {} 76 | #[cfg(feature = "bitbang")] 77 | impl CycleDelay { 78 | #[allow(unused)] 79 | const CPU_FREQUENCY_HZ: u32 = 120000000; // Default CPU Frequency. 80 | #[allow(unused)] 81 | const AVERAGE_OPERATION_OVERHEAD_CYCLES: u32 = 60; // Average SWD/JTAG operation overhead in cycles. 82 | } 83 | #[cfg(feature = "bitbang")] 84 | impl DelayFunc for CycleDelay { 85 | #[cfg(feature = "set_clock")] 86 | fn calculate_half_clock_cycles(frequency_hz: u32) -> Option { 87 | let cycles = (Self::CPU_FREQUENCY_HZ / 2) / frequency_hz; 88 | if cycles < Self::AVERAGE_OPERATION_OVERHEAD_CYCLES { 89 | Some(0) 90 | } else { 91 | Some(cycles - Self::AVERAGE_OPERATION_OVERHEAD_CYCLES) 92 | } 93 | } 94 | 95 | fn cycle_delay(&self, cycles: u32) { 96 | cortex_m::asm::delay(cycles); 97 | } 98 | } 99 | 100 | pub fn read_usb_serial_byte_cs(usb_serial: &mut SerialPort) -> Result { 101 | let mut buf = [0u8; 1]; 102 | match usb_serial.read(&mut buf) { 103 | Ok(1) => Ok(buf[0]), 104 | Ok(0) => Err(UsbError::WouldBlock), 105 | Ok(_) => panic!("USB Serial read extra data."), 106 | Err(err) => Err(err), 107 | } 108 | } 109 | 110 | pub fn write_usb_serial_byte_cs( 111 | usb_serial: &mut SerialPort, 112 | data: u8, 113 | ) -> Result<(), UsbError> { 114 | let buf = [data; 1]; 115 | match usb_serial.write(&buf) { 116 | Ok(1) => Ok(()), 117 | Ok(0) => Err(UsbError::WouldBlock), 118 | Ok(_) => panic!("USB Serial wrote extra data."), 119 | Err(err) => Err(err), 120 | } 121 | } 122 | 123 | /// UART configuration and UART peripheral clock frequency. 124 | pub struct UartConfigAndClock { 125 | /// UART configuraion 126 | pub config: UartConfig, 127 | /// UART peripheral clock frequency 128 | pub clock: fugit::HertzU32, 129 | } 130 | 131 | type PicoUsbBusAllocator = UsbBusAllocator; 132 | 133 | /// Initialize SWDIO, USB-UART, CMSIS-DAP and USB BUS. 134 | pub fn initialize_usb<'a, CmsisDapCommandInner, const MAX_PACKET_SIZE: usize>( 135 | io: CmsisDapCommandInner, 136 | usb_allocator: &'a PicoUsbBusAllocator, 137 | serial: &'a str, 138 | capabilities: DapCapabilities, 139 | ) -> ( 140 | SerialPort<'a, UsbBus>, 141 | CmsisDap<'a, UsbBus, CmsisDapCommandInner, MAX_PACKET_SIZE>, 142 | UsbDevice<'a, UsbBus>, 143 | ) 144 | where 145 | CmsisDapCommandInner: rust_dap::CmsisDapCommandInner, 146 | { 147 | let usb_serial = SerialPort::new(usb_allocator); 148 | let usb_dap = CmsisDap::new(usb_allocator, io, capabilities); 149 | let usb_bus = UsbDeviceBuilder::new(usb_allocator, UsbVidPid(0x6666, 0x4444)) 150 | .manufacturer("fugafuga.org") 151 | .product("CMSIS-DAP") 152 | .serial_number(serial) 153 | .device_class(USB_CLASS_MISCELLANEOUS) 154 | .device_class(USB_SUBCLASS_COMMON) 155 | .device_protocol(USB_PROTOCOL_IAD) 156 | .composite_with_iads() 157 | .max_packet_size_0(64) 158 | .build(); 159 | (usb_serial, usb_dap, usb_bus) 160 | } 161 | -------------------------------------------------------------------------------- /boards/xiao_m0/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #![no_std] 18 | #![no_main] 19 | 20 | use embedded_hal::digital::v2::ToggleableOutputPin; 21 | use panic_halt as _; 22 | use rust_dap::bitbang::{DelayFunc, SwdIoSet}; 23 | use rust_dap::{ 24 | CmsisDap, DapCapabilities, USB_CLASS_MISCELLANEOUS, USB_PROTOCOL_IAD, USB_SUBCLASS_COMMON, 25 | }; 26 | 27 | use bsp::{entry, hal, pac}; 28 | use hal::clock::GenericClockController; 29 | use hal::gpio::v2::{Output, Pin, PushPull}; 30 | use pac::{interrupt, CorePeripherals, Peripherals}; 31 | use xiao_m0 as bsp; 32 | 33 | use usb_device::bus::UsbBusAllocator; 34 | use xiao_m0::hal::usb::UsbBus; 35 | 36 | use usb_device::prelude::*; 37 | use usbd_serial::SerialPort; 38 | 39 | use cortex_m::asm::delay as cycle_delay; 40 | use cortex_m::peripheral::NVIC; 41 | 42 | mod swdio_pin; 43 | use swdio_pin::*; 44 | 45 | // Import pin types. 46 | use hal::gpio::v2::{PA02, PA05, PA07, PA18}; 47 | 48 | type SwdIoPin = PA05; // D9 49 | type SwClkPin = PA07; // D8 50 | type ResetPin = PA02; // D0 51 | type SwdIoInputPin = XiaoSwdInputPin; 52 | type SwdIoOutputPin = XiaoSwdOutputPin; 53 | type SwClkInputPin = XiaoSwdInputPin; 54 | type SwClkOutputPin = XiaoSwdOutputPin; 55 | type ResetInputPin = XiaoSwdInputPin; 56 | type ResetOutputPin = XiaoSwdOutputPin; 57 | type MySwdIoSet = SwdIoSet< 58 | SwClkInputPin, 59 | SwClkOutputPin, 60 | SwdIoInputPin, 61 | SwdIoOutputPin, 62 | ResetInputPin, 63 | ResetOutputPin, 64 | CycleDelay, 65 | >; 66 | 67 | struct CycleDelay {} 68 | impl DelayFunc for CycleDelay { 69 | fn cycle_delay(&self, cycles: u32) { 70 | cortex_m::asm::delay(cycles); 71 | } 72 | } 73 | 74 | #[entry] 75 | fn main() -> ! { 76 | let mut peripherals = Peripherals::take().unwrap(); 77 | let mut core = CorePeripherals::take().unwrap(); 78 | let mut clocks = GenericClockController::with_internal_32kosc( 79 | peripherals.GCLK, 80 | &mut peripherals.PM, 81 | &mut peripherals.SYSCTRL, 82 | &mut peripherals.NVMCTRL, 83 | ); 84 | 85 | let pins = bsp::Pins::new(peripherals.PORT); 86 | let mut led0 = pins.led0.into_push_pull_output(); 87 | 88 | let bus_allocator = unsafe { 89 | USB_ALLOCATOR = Some(bsp::usb_allocator( 90 | peripherals.USB, 91 | &mut clocks, 92 | &mut peripherals.PM, 93 | pins.usb_dm, 94 | pins.usb_dp, 95 | )); 96 | USB_ALLOCATOR.as_ref().unwrap() 97 | }; 98 | 99 | // RESET pin of Cortex Debug 10-pin connector is negative logic 100 | // https://developer.arm.com/documentation/101453/0100/CoreSight-Technology/Connectors 101 | let reset_pin = pins.a0.into_floating_input(); 102 | 103 | let swdio = MySwdIoSet::new( 104 | XiaoSwdInputPin::new(pins.a8.into_floating_input()), 105 | XiaoSwdInputPin::new(pins.a9.into_floating_input()), 106 | XiaoSwdInputPin::new(reset_pin), 107 | CycleDelay {}, 108 | ); 109 | 110 | unsafe { 111 | USB_SERIAL = Some(SerialPort::new(bus_allocator)); 112 | USB_DAP = Some(CmsisDap::new(bus_allocator, swdio, DapCapabilities::SWD)); 113 | USB_BUS = Some( 114 | UsbDeviceBuilder::new(bus_allocator, UsbVidPid(0x6666, 0x4444)) 115 | .manufacturer("fugafuga.org") 116 | .product("CMSIS-DAP") 117 | .serial_number("test") 118 | .device_class(USB_CLASS_MISCELLANEOUS) 119 | .device_class(USB_SUBCLASS_COMMON) 120 | .device_protocol(USB_PROTOCOL_IAD) 121 | .composite_with_iads() 122 | .max_packet_size_0(64) 123 | .build(), 124 | ); 125 | LED = Some(pins.led1.into_push_pull_output()); 126 | } 127 | 128 | unsafe { 129 | core.NVIC.set_priority(interrupt::USB, 1); 130 | NVIC::unmask(interrupt::USB); 131 | } 132 | 133 | loop { 134 | // unsafe { 135 | // USB_DAP.as_mut().map(|dap| { 136 | // let _ = dap.process(); 137 | // }); 138 | // } 139 | cycle_delay(15 * 1024 * 1024); 140 | led0.toggle().ok(); 141 | } 142 | } 143 | 144 | static mut USB_ALLOCATOR: Option> = None; 145 | static mut USB_BUS: Option> = None; 146 | static mut USB_SERIAL: Option> = None; 147 | static mut USB_DAP: Option> = None; 148 | static mut LED: Option>> = None; 149 | 150 | fn poll_usb() { 151 | unsafe { 152 | if let Some(usb_dev) = USB_BUS.as_mut() { 153 | if let Some(serial) = USB_SERIAL.as_mut() { 154 | if let Some(dap) = USB_DAP.as_mut() { 155 | usb_dev.poll(&mut [serial, dap]); 156 | 157 | dap.process().ok(); 158 | let mut buf = [0u8; 64]; 159 | if let Ok(count) = serial.read(&mut buf) { 160 | for (i, c) in buf.iter().enumerate() { 161 | if i >= count { 162 | break; 163 | } 164 | serial.write(&[*c]).unwrap(); 165 | LED.as_mut().map(|led| led.toggle()); 166 | } 167 | }; 168 | } 169 | } 170 | } 171 | }; 172 | } 173 | 174 | #[interrupt] 175 | fn USB() { 176 | poll_usb(); 177 | } 178 | -------------------------------------------------------------------------------- /rust-dap-rp2040/src/line_coding.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | use hal::uart; 18 | use rp2040_hal as hal; 19 | use usbd_serial; 20 | 21 | use core::convert::{From, TryFrom}; 22 | 23 | /// UART configuration conversion error 24 | #[derive(Debug, Clone, Copy, PartialEq)] 25 | pub enum UartConvertError { 26 | /// Incompatible UART parameter 27 | Incompatible, 28 | } 29 | 30 | /// UART Stop bits 31 | #[derive(Debug, Clone, Copy, PartialEq)] 32 | pub enum UartStopBits { 33 | /// 1 stop bit 34 | One, 35 | /// 2 stop bits 36 | Two, 37 | } 38 | 39 | /// UART parity type 40 | #[derive(Debug, Clone, Copy, PartialEq)] 41 | pub enum UartParityType { 42 | /// No parity 43 | None, 44 | /// Odd parity 45 | Odd, 46 | /// Even parity 47 | Even, 48 | } 49 | 50 | #[derive(Debug, Clone, Copy, PartialEq)] 51 | pub struct UartDataBits(u8); 52 | 53 | /// UART configuration which can be converted into both usbd_serial UART configuration and RP2040 UART configuration. 54 | #[derive(Debug, Clone, Copy, PartialEq)] 55 | pub struct UartConfig { 56 | pub data_bits: UartDataBits, 57 | pub stop_bits: UartStopBits, 58 | pub parity_type: UartParityType, 59 | pub data_rate: u32, 60 | } 61 | 62 | impl From for usbd_serial::StopBits { 63 | fn from(value: UartStopBits) -> Self { 64 | match value { 65 | UartStopBits::One => Self::One, 66 | UartStopBits::Two => Self::Two, 67 | } 68 | } 69 | } 70 | impl TryFrom for UartStopBits { 71 | type Error = UartConvertError; 72 | fn try_from(value: usbd_serial::StopBits) -> Result { 73 | match value { 74 | usbd_serial::StopBits::One => Ok(Self::One), 75 | usbd_serial::StopBits::Two => Ok(Self::Two), 76 | _ => Err(Self::Error::Incompatible), 77 | } 78 | } 79 | } 80 | 81 | impl From for uart::StopBits { 82 | fn from(value: UartStopBits) -> Self { 83 | match value { 84 | UartStopBits::One => Self::One, 85 | UartStopBits::Two => Self::Two, 86 | } 87 | } 88 | } 89 | 90 | impl From for UartStopBits { 91 | fn from(value: uart::StopBits) -> Self { 92 | match value { 93 | uart::StopBits::One => Self::One, 94 | uart::StopBits::Two => Self::Two, 95 | } 96 | } 97 | } 98 | 99 | impl From for usbd_serial::ParityType { 100 | fn from(value: UartParityType) -> Self { 101 | match value { 102 | UartParityType::None => Self::None, 103 | UartParityType::Even => Self::Event, 104 | UartParityType::Odd => Self::Odd, 105 | } 106 | } 107 | } 108 | impl TryFrom for UartParityType { 109 | type Error = UartConvertError; 110 | fn try_from(value: usbd_serial::ParityType) -> Result { 111 | match value { 112 | usbd_serial::ParityType::None => Ok(Self::None), 113 | usbd_serial::ParityType::Event => Ok(Self::Even), 114 | usbd_serial::ParityType::Odd => Ok(Self::Odd), 115 | _ => Err(Self::Error::Incompatible), 116 | } 117 | } 118 | } 119 | 120 | impl From for Option { 121 | fn from(value: UartParityType) -> Self { 122 | match value { 123 | UartParityType::None => None, 124 | UartParityType::Even => Some(uart::Parity::Even), 125 | UartParityType::Odd => Some(uart::Parity::Odd), 126 | } 127 | } 128 | } 129 | impl From> for UartParityType { 130 | fn from(value: Option) -> Self { 131 | match value { 132 | None => Self::None, 133 | Some(uart::Parity::Even) => Self::Even, 134 | Some(uart::Parity::Odd) => Self::Odd, 135 | } 136 | } 137 | } 138 | 139 | impl From for UartDataBits { 140 | fn from(value: uart::DataBits) -> Self { 141 | match value { 142 | uart::DataBits::Five => Self(5), 143 | uart::DataBits::Six => Self(6), 144 | uart::DataBits::Seven => Self(7), 145 | uart::DataBits::Eight => Self(8), 146 | } 147 | } 148 | } 149 | impl From for uart::DataBits { 150 | fn from(value: UartDataBits) -> Self { 151 | match value.0 { 152 | 5 => Self::Five, 153 | 6 => Self::Six, 154 | 7 => Self::Seven, 155 | 8 => Self::Eight, 156 | _ => panic!("Incompative UART data bits."), 157 | } 158 | } 159 | } 160 | impl TryFrom for UartDataBits { 161 | type Error = UartConvertError; 162 | fn try_from(value: u8) -> Result { 163 | match value { 164 | 5 => Ok(Self(5)), 165 | 6 => Ok(Self(6)), 166 | 7 => Ok(Self(7)), 167 | 8 => Ok(Self(8)), 168 | _ => Err(Self::Error::Incompatible), 169 | } 170 | } 171 | } 172 | 173 | impl From for UartConfig { 174 | fn from(value: uart::UartConfig) -> Self { 175 | Self { 176 | data_bits: value.data_bits.into(), 177 | stop_bits: value.stop_bits.into(), 178 | parity_type: value.parity.into(), 179 | data_rate: value.baudrate.raw(), 180 | } 181 | } 182 | } 183 | impl From<&UartConfig> for uart::UartConfig { 184 | fn from(value: &UartConfig) -> Self { 185 | let mut config = uart::UartConfig::default(); 186 | config.data_bits = value.data_bits.into(); 187 | config.stop_bits = value.stop_bits.into(); 188 | config.parity = value.parity_type.into(); 189 | config.baudrate = fugit::HertzU32::from_raw(value.data_rate); 190 | config 191 | } 192 | } 193 | impl TryFrom<&usbd_serial::LineCoding> for UartConfig { 194 | type Error = UartConvertError; 195 | fn try_from(value: &usbd_serial::LineCoding) -> Result { 196 | let data_bits = value.data_bits().try_into()?; 197 | let stop_bits = value.stop_bits().try_into()?; 198 | let parity_type = value.parity_type().try_into()?; 199 | let data_rate = value.data_rate(); 200 | Ok(Self { 201 | data_bits, 202 | stop_bits, 203 | parity_type, 204 | data_rate, 205 | }) 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /uart-test/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "CoreFoundation-sys" 7 | version = "0.1.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "d0e9889e6db118d49d88d84728d0e964d973a5680befb5f85f55141beea5c20b" 10 | dependencies = [ 11 | "libc", 12 | "mach 0.1.2", 13 | ] 14 | 15 | [[package]] 16 | name = "IOKit-sys" 17 | version = "0.1.5" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "99696c398cbaf669d2368076bdb3d627fb0ce51a26899d7c61228c5c0af3bf4a" 20 | dependencies = [ 21 | "CoreFoundation-sys", 22 | "libc", 23 | "mach 0.1.2", 24 | ] 25 | 26 | [[package]] 27 | name = "aho-corasick" 28 | version = "0.7.18" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 31 | dependencies = [ 32 | "memchr", 33 | ] 34 | 35 | [[package]] 36 | name = "autocfg" 37 | version = "0.1.7" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" 40 | 41 | [[package]] 42 | name = "bitflags" 43 | version = "1.3.2" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 46 | 47 | [[package]] 48 | name = "cc" 49 | version = "1.0.72" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" 52 | 53 | [[package]] 54 | name = "cfg-if" 55 | version = "0.1.10" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 58 | 59 | [[package]] 60 | name = "cloudabi" 61 | version = "0.0.3" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 64 | dependencies = [ 65 | "bitflags", 66 | ] 67 | 68 | [[package]] 69 | name = "fuchsia-cprng" 70 | version = "0.1.1" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" 73 | 74 | [[package]] 75 | name = "libc" 76 | version = "0.2.112" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" 79 | 80 | [[package]] 81 | name = "libudev" 82 | version = "0.2.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "ea626d3bdf40a1c5aee3bcd4f40826970cae8d80a8fec934c82a63840094dcfe" 85 | dependencies = [ 86 | "libc", 87 | "libudev-sys", 88 | ] 89 | 90 | [[package]] 91 | name = "libudev-sys" 92 | version = "0.1.4" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" 95 | dependencies = [ 96 | "libc", 97 | "pkg-config", 98 | ] 99 | 100 | [[package]] 101 | name = "mach" 102 | version = "0.1.2" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9" 105 | dependencies = [ 106 | "libc", 107 | ] 108 | 109 | [[package]] 110 | name = "mach" 111 | version = "0.2.3" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" 114 | dependencies = [ 115 | "libc", 116 | ] 117 | 118 | [[package]] 119 | name = "memchr" 120 | version = "2.4.1" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 123 | 124 | [[package]] 125 | name = "nix" 126 | version = "0.16.1" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "dd0eaf8df8bab402257e0a5c17a254e4cc1f72a93588a1ddfb5d356c801aa7cb" 129 | dependencies = [ 130 | "bitflags", 131 | "cc", 132 | "cfg-if", 133 | "libc", 134 | "void", 135 | ] 136 | 137 | [[package]] 138 | name = "pkg-config" 139 | version = "0.3.24" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" 142 | 143 | [[package]] 144 | name = "rand" 145 | version = "0.6.5" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" 148 | dependencies = [ 149 | "autocfg", 150 | "libc", 151 | "rand_chacha", 152 | "rand_core 0.4.2", 153 | "rand_hc", 154 | "rand_isaac", 155 | "rand_jitter", 156 | "rand_os", 157 | "rand_pcg", 158 | "rand_xorshift", 159 | "winapi", 160 | ] 161 | 162 | [[package]] 163 | name = "rand_chacha" 164 | version = "0.1.1" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 167 | dependencies = [ 168 | "autocfg", 169 | "rand_core 0.3.1", 170 | ] 171 | 172 | [[package]] 173 | name = "rand_core" 174 | version = "0.3.1" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" 177 | dependencies = [ 178 | "rand_core 0.4.2", 179 | ] 180 | 181 | [[package]] 182 | name = "rand_core" 183 | version = "0.4.2" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" 186 | 187 | [[package]] 188 | name = "rand_hc" 189 | version = "0.1.0" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 192 | dependencies = [ 193 | "rand_core 0.3.1", 194 | ] 195 | 196 | [[package]] 197 | name = "rand_isaac" 198 | version = "0.1.1" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 201 | dependencies = [ 202 | "rand_core 0.3.1", 203 | ] 204 | 205 | [[package]] 206 | name = "rand_jitter" 207 | version = "0.1.4" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" 210 | dependencies = [ 211 | "libc", 212 | "rand_core 0.4.2", 213 | "winapi", 214 | ] 215 | 216 | [[package]] 217 | name = "rand_os" 218 | version = "0.1.3" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" 221 | dependencies = [ 222 | "cloudabi", 223 | "fuchsia-cprng", 224 | "libc", 225 | "rand_core 0.4.2", 226 | "rdrand", 227 | "winapi", 228 | ] 229 | 230 | [[package]] 231 | name = "rand_pcg" 232 | version = "0.1.2" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" 235 | dependencies = [ 236 | "autocfg", 237 | "rand_core 0.4.2", 238 | ] 239 | 240 | [[package]] 241 | name = "rand_xorshift" 242 | version = "0.1.1" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 245 | dependencies = [ 246 | "rand_core 0.3.1", 247 | ] 248 | 249 | [[package]] 250 | name = "rdrand" 251 | version = "0.4.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 254 | dependencies = [ 255 | "rand_core 0.3.1", 256 | ] 257 | 258 | [[package]] 259 | name = "regex" 260 | version = "1.5.4" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" 263 | dependencies = [ 264 | "aho-corasick", 265 | "memchr", 266 | "regex-syntax", 267 | ] 268 | 269 | [[package]] 270 | name = "regex-syntax" 271 | version = "0.6.25" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 274 | 275 | [[package]] 276 | name = "serialport" 277 | version = "4.0.1" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "5d8cd7c0f22290ee2c01457009fa6fc1cae4153d5608a924e5dc423babc2c655" 280 | dependencies = [ 281 | "CoreFoundation-sys", 282 | "IOKit-sys", 283 | "bitflags", 284 | "cfg-if", 285 | "libudev", 286 | "mach 0.2.3", 287 | "nix", 288 | "regex", 289 | "winapi", 290 | ] 291 | 292 | [[package]] 293 | name = "uart-test" 294 | version = "0.1.0" 295 | dependencies = [ 296 | "rand", 297 | "serialport", 298 | ] 299 | 300 | [[package]] 301 | name = "void" 302 | version = "1.0.2" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 305 | 306 | [[package]] 307 | name = "winapi" 308 | version = "0.3.9" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 311 | dependencies = [ 312 | "winapi-i686-pc-windows-gnu", 313 | "winapi-x86_64-pc-windows-gnu", 314 | ] 315 | 316 | [[package]] 317 | name = "winapi-i686-pc-windows-gnu" 318 | version = "0.4.0" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 321 | 322 | [[package]] 323 | name = "winapi-x86_64-pc-windows-gnu" 324 | version = "0.4.0" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 327 | -------------------------------------------------------------------------------- /rust-dap-rp2040/link.ram.x: -------------------------------------------------------------------------------- 1 | /* # Origin 2 | 3 | - This file is adopted from cortex-m-rt crate. 4 | https://github.com/rust-embedded/cortex-m-rt/blob/master/link.x.in 5 | The release version of the original crate was 0.7.1 at the time of writing. 6 | 7 | - The last portion of this file originates from the build script of the original crate. 8 | https://github.com/rust-embedded/cortex-m-rt/blob/master/build.rs 9 | 10 | - The modification is to locate all the code and data into the ram region. 11 | */ 12 | 13 | /* # Developer notes 14 | 15 | - Symbols that start with a double underscore (__) are considered "private" 16 | 17 | - Symbols that start with a single underscore (_) are considered "semi-public"; they can be 18 | overridden in a user linker script, but should not be referred from user code (e.g. `extern "C" { 19 | static mut __sbss }`). 20 | 21 | - `EXTERN` forces the linker to keep a symbol in the final binary. We use this to make sure a 22 | symbol if not dropped if it appears in or near the front of the linker arguments and "it's not 23 | needed" by any of the preceding objects (linker arguments) 24 | 25 | - `PROVIDE` is used to provide default values that can be overridden by a user linker script 26 | 27 | - On alignment: it's important for correctness that the VMA boundaries of both .bss and .data *and* 28 | the LMA of .data are all 4-byte aligned. These alignments are assumed by the RAM initialization 29 | routine. There's also a second benefit: 4-byte aligned boundaries means that you won't see 30 | "Address (..) is out of bounds" in the disassembly produced by `objdump`. 31 | */ 32 | 33 | /* Provides information about the memory layout of the device */ 34 | /* This will be provided by the user (see `memory.x`) or by a Board Support Crate */ 35 | INCLUDE memory.x 36 | 37 | /* # Entry point = reset vector */ 38 | EXTERN(__RESET_VECTOR); 39 | /* EXTERN(Reset); */ 40 | /* ENTRY(Reset); */ 41 | ENTRY(BOOT2_FIRMWARE); 42 | 43 | /* # Exception vectors */ 44 | /* This is effectively weak aliasing at the linker level */ 45 | /* The user can override any of these aliases by defining the corresponding symbol themselves (cf. 46 | the `exception!` macro) */ 47 | EXTERN(__EXCEPTIONS); /* depends on all the these PROVIDED symbols */ 48 | 49 | EXTERN(DefaultHandler); 50 | 51 | PROVIDE(NonMaskableInt = DefaultHandler); 52 | EXTERN(HardFaultTrampoline); 53 | PROVIDE(MemoryManagement = DefaultHandler); 54 | PROVIDE(BusFault = DefaultHandler); 55 | PROVIDE(UsageFault = DefaultHandler); 56 | PROVIDE(SecureFault = DefaultHandler); 57 | PROVIDE(SVCall = DefaultHandler); 58 | PROVIDE(DebugMonitor = DefaultHandler); 59 | PROVIDE(PendSV = DefaultHandler); 60 | PROVIDE(SysTick = DefaultHandler); 61 | 62 | PROVIDE(DefaultHandler = DefaultHandler_); 63 | PROVIDE(HardFault = HardFault_); 64 | 65 | /* # Interrupt vectors */ 66 | EXTERN(__INTERRUPTS); /* `static` variable similar to `__EXCEPTIONS` */ 67 | 68 | /* # Pre-initialization function */ 69 | /* If the user overrides this using the `pre_init!` macro or by creating a `__pre_init` function, 70 | then the function this points to will be called before the RAM is initialized. */ 71 | PROVIDE(__pre_init = DefaultPreInit); 72 | 73 | /* # Sections */ 74 | SECTIONS 75 | { 76 | PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM)); 77 | 78 | /* ## Sections in FLASH */ 79 | /* ### Vector table */ 80 | .vector_table ORIGIN(RAM) : 81 | { 82 | /* Initial Stack Pointer (SP) value */ 83 | LONG(_stack_start); 84 | 85 | /* Reset vector */ 86 | KEEP(*(.vector_table.reset_vector)); /* this is the `__RESET_VECTOR` symbol */ 87 | __reset_vector = .; 88 | 89 | /* Exceptions */ 90 | KEEP(*(.vector_table.exceptions)); /* this is the `__EXCEPTIONS` symbol */ 91 | __eexceptions = .; 92 | 93 | /* Device specific interrupts */ 94 | KEEP(*(.vector_table.interrupts)); /* this is the `__INTERRUPTS` symbol */ 95 | 96 | . = ALIGN(16); 97 | } > RAM AT > FLASH 98 | 99 | PROVIDE(_stext = ORIGIN(RAM) + SIZEOF(.vector_table)); 100 | 101 | /* ### .text */ 102 | .text _stext : 103 | { 104 | __stext = .; 105 | *(.Reset); 106 | 107 | *(.text .text.*); 108 | 109 | /* The HardFaultTrampoline uses the `b` instruction to enter `HardFault`, 110 | so must be placed close to it. */ 111 | *(.HardFaultTrampoline); 112 | *(.HardFault.*); 113 | 114 | . = ALIGN(16); 115 | __etext = .; 116 | } > RAM AT > FLASH 117 | 118 | /* ### .rodata */ 119 | .rodata : ALIGN(4) 120 | { 121 | . = ALIGN(4); 122 | __srodata = .; 123 | *(.rodata .rodata.*); 124 | 125 | /* 4-byte align the end (VMA) of this section. 126 | This is required by LLD to ensure the LMA of the following .data 127 | section will have the correct alignment. */ 128 | . = ALIGN(16); 129 | __erodata = .; 130 | } > RAM AT > FLASH 131 | 132 | /* ## Sections in RAM */ 133 | /* ### .data */ 134 | .data : ALIGN(4) 135 | { 136 | . = ALIGN(4); 137 | __sdata = .; 138 | *(.data .data.*); 139 | . = ALIGN(4); /* 4-byte align the end (VMA) of this section */ 140 | } > RAM AT > FLASH 141 | /* Allow sections from user `memory.x` injected using `INSERT AFTER .data` to 142 | * use the .data loading mechanism by pushing __edata. Note: do not change 143 | * output region or load region in those user sections! */ 144 | . = ALIGN(4); 145 | __edata = .; 146 | 147 | /* LMA of .data */ 148 | /* __sidata = LOADADDR(.data); */ 149 | /* This makes initial copying of .data an inane in-place re-write. */ 150 | __sidata = __sdata; 151 | 152 | /* ### .gnu.sgstubs 153 | This section contains the TrustZone-M veneers put there by the Arm GNU linker. */ 154 | /* Security Attribution Unit blocks must be 32 bytes aligned. */ 155 | /* Note that this pads the FLASH usage to 32 byte alignment. */ 156 | .gnu.sgstubs : ALIGN(32) 157 | { 158 | . = ALIGN(32); 159 | __veneer_base = .; 160 | *(.gnu.sgstubs*) 161 | . = ALIGN(32); 162 | __veneer_limit = .; 163 | } > RAM AT > FLASH 164 | 165 | /* ### .bss */ 166 | .bss (NOLOAD) : ALIGN(4) 167 | { 168 | . = ALIGN(4); 169 | __sbss = .; 170 | *(.bss .bss.*); 171 | *(COMMON); /* Uninitialized C statics */ 172 | . = ALIGN(4); /* 4-byte align the end (VMA) of this section */ 173 | } > RAM 174 | /* Allow sections from user `memory.x` injected using `INSERT AFTER .bss` to 175 | * use the .bss zeroing mechanism by pushing __ebss. Note: do not change 176 | * output region or load region in those user sections! */ 177 | . = ALIGN(4); 178 | __ebss = .; 179 | 180 | /* ### .uninit */ 181 | .uninit (NOLOAD) : ALIGN(4) 182 | { 183 | . = ALIGN(4); 184 | __suninit = .; 185 | *(.uninit .uninit.*); 186 | . = ALIGN(4); 187 | __euninit = .; 188 | } > RAM 189 | 190 | /* Place the heap right after `.uninit` in RAM */ 191 | PROVIDE(__sheap = __euninit); 192 | 193 | /* ## .got */ 194 | /* Dynamic relocations are unsupported. This section is only used to detect relocatable code in 195 | the input files and raise an error if relocatable code is found */ 196 | .got (NOLOAD) : 197 | { 198 | KEEP(*(.got .got.*)); 199 | } 200 | 201 | /* ## Discarded sections */ 202 | /DISCARD/ : 203 | { 204 | /* Unused exception related info that only wastes space */ 205 | *(.ARM.exidx); 206 | *(.ARM.exidx.*); 207 | *(.ARM.extab.*); 208 | } 209 | } 210 | 211 | /* Do not exceed this mark in the error messages below | */ 212 | /* # Alignment checks */ 213 | ASSERT(ORIGIN(FLASH) % 4 == 0, " 214 | ERROR(cortex-m-rt): the start of the FLASH region must be 4-byte aligned"); 215 | 216 | ASSERT(ORIGIN(RAM) % 4 == 0, " 217 | ERROR(cortex-m-rt): the start of the RAM region must be 4-byte aligned"); 218 | 219 | ASSERT(__sdata % 4 == 0 && __edata % 4 == 0, " 220 | BUG(cortex-m-rt): .data is not 4-byte aligned"); 221 | 222 | ASSERT(__sidata % 4 == 0, " 223 | BUG(cortex-m-rt): the LMA of .data is not 4-byte aligned"); 224 | 225 | ASSERT(__sbss % 4 == 0 && __ebss % 4 == 0, " 226 | BUG(cortex-m-rt): .bss is not 4-byte aligned"); 227 | 228 | ASSERT(__sheap % 4 == 0, " 229 | BUG(cortex-m-rt): start of .heap is not 4-byte aligned"); 230 | 231 | /* # Position checks */ 232 | 233 | /* ## .vector_table */ 234 | ASSERT(__reset_vector == ADDR(.vector_table) + 0x8, " 235 | BUG(cortex-m-rt): the reset vector is missing"); 236 | 237 | ASSERT(__eexceptions == ADDR(.vector_table) + 0x40, " 238 | BUG(cortex-m-rt): the exception vectors are missing"); 239 | 240 | ASSERT(SIZEOF(.vector_table) > 0x40, " 241 | ERROR(cortex-m-rt): The interrupt vectors are missing. 242 | Possible solutions, from most likely to less likely: 243 | - Link to a svd2rust generated device crate 244 | - Check that you actually use the device/hal/bsp crate in your code 245 | - Disable the 'device' feature of cortex-m-rt to build a generic application (a dependency 246 | may be enabling it) 247 | - Supply the interrupt handlers yourself. Check the documentation for details."); 248 | 249 | /* # Other checks */ 250 | ASSERT(SIZEOF(.got) == 0, " 251 | ERROR(cortex-m-rt): .got section detected in the input object files 252 | Dynamic relocations are not supported. If you are linking to C code compiled using 253 | the 'cc' crate then modify your build script to compile the C code _without_ 254 | the -fPIC flag. See the documentation of the `cc::Build.pic` method for details."); 255 | /* Do not exceed this mark in the error messages above | */ 256 | 257 | /* Provides weak aliases (cf. PROVIDED) for device specific interrupt handlers */ 258 | /* This will usually be provided by a device crate generated using svd2rust (see `device.x`) */ 259 | INCLUDE device.x 260 | 261 | ASSERT(SIZEOF(.vector_table) <= 0xc0, " 262 | There can't be more than 32 interrupt handlers. This may be a bug in 263 | your device crate, or you may have registered more than 32 interrupt 264 | handlers."); 265 | -------------------------------------------------------------------------------- /rust-dap/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "atomic-polyfill" 7 | version = "0.1.11" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" 10 | dependencies = [ 11 | "critical-section", 12 | ] 13 | 14 | [[package]] 15 | name = "autocfg" 16 | version = "1.1.0" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 19 | 20 | [[package]] 21 | name = "bitflags" 22 | version = "1.3.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 25 | 26 | [[package]] 27 | name = "bitvec" 28 | version = "1.0.1" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" 31 | dependencies = [ 32 | "funty", 33 | "radium", 34 | "tap", 35 | "wyz", 36 | ] 37 | 38 | [[package]] 39 | name = "byteorder" 40 | version = "1.4.3" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 43 | 44 | [[package]] 45 | name = "critical-section" 46 | version = "1.1.2" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 49 | 50 | [[package]] 51 | name = "defmt" 52 | version = "0.3.5" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" 55 | dependencies = [ 56 | "bitflags", 57 | "defmt-macros", 58 | ] 59 | 60 | [[package]] 61 | name = "defmt-macros" 62 | version = "0.3.6" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" 65 | dependencies = [ 66 | "defmt-parser", 67 | "proc-macro-error", 68 | "proc-macro2", 69 | "quote", 70 | "syn 2.0.32", 71 | ] 72 | 73 | [[package]] 74 | name = "defmt-parser" 75 | version = "0.3.3" 76 | source = "registry+https://github.com/rust-lang/crates.io-index" 77 | checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" 78 | dependencies = [ 79 | "thiserror", 80 | ] 81 | 82 | [[package]] 83 | name = "embedded-hal" 84 | version = "0.2.7" 85 | source = "registry+https://github.com/rust-lang/crates.io-index" 86 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 87 | dependencies = [ 88 | "nb 0.1.3", 89 | "void", 90 | ] 91 | 92 | [[package]] 93 | name = "funty" 94 | version = "2.0.0" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" 97 | 98 | [[package]] 99 | name = "hash32" 100 | version = "0.2.1" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 103 | dependencies = [ 104 | "byteorder", 105 | ] 106 | 107 | [[package]] 108 | name = "heapless" 109 | version = "0.7.16" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 112 | dependencies = [ 113 | "atomic-polyfill", 114 | "hash32", 115 | "rustc_version", 116 | "spin", 117 | "stable_deref_trait", 118 | ] 119 | 120 | [[package]] 121 | name = "lock_api" 122 | version = "0.4.10" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" 125 | dependencies = [ 126 | "autocfg", 127 | "scopeguard", 128 | ] 129 | 130 | [[package]] 131 | name = "nb" 132 | version = "0.1.3" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 135 | dependencies = [ 136 | "nb 1.1.0", 137 | ] 138 | 139 | [[package]] 140 | name = "nb" 141 | version = "1.1.0" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 144 | 145 | [[package]] 146 | name = "num_enum" 147 | version = "0.5.11" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" 150 | dependencies = [ 151 | "num_enum_derive", 152 | ] 153 | 154 | [[package]] 155 | name = "num_enum_derive" 156 | version = "0.5.11" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" 159 | dependencies = [ 160 | "proc-macro2", 161 | "quote", 162 | "syn 1.0.109", 163 | ] 164 | 165 | [[package]] 166 | name = "proc-macro-error" 167 | version = "1.0.4" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 170 | dependencies = [ 171 | "proc-macro-error-attr", 172 | "proc-macro2", 173 | "quote", 174 | "syn 1.0.109", 175 | "version_check", 176 | ] 177 | 178 | [[package]] 179 | name = "proc-macro-error-attr" 180 | version = "1.0.4" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 183 | dependencies = [ 184 | "proc-macro2", 185 | "quote", 186 | "version_check", 187 | ] 188 | 189 | [[package]] 190 | name = "proc-macro2" 191 | version = "1.0.66" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" 194 | dependencies = [ 195 | "unicode-ident", 196 | ] 197 | 198 | [[package]] 199 | name = "quote" 200 | version = "1.0.33" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 203 | dependencies = [ 204 | "proc-macro2", 205 | ] 206 | 207 | [[package]] 208 | name = "radium" 209 | version = "0.7.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" 212 | 213 | [[package]] 214 | name = "rust-dap" 215 | version = "0.2.0" 216 | dependencies = [ 217 | "bitflags", 218 | "bitvec", 219 | "defmt", 220 | "embedded-hal", 221 | "heapless", 222 | "nb 0.1.3", 223 | "num_enum", 224 | "usb-device", 225 | ] 226 | 227 | [[package]] 228 | name = "rustc_version" 229 | version = "0.4.0" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 232 | dependencies = [ 233 | "semver", 234 | ] 235 | 236 | [[package]] 237 | name = "scopeguard" 238 | version = "1.2.0" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 241 | 242 | [[package]] 243 | name = "semver" 244 | version = "1.0.18" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" 247 | 248 | [[package]] 249 | name = "spin" 250 | version = "0.9.8" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 253 | dependencies = [ 254 | "lock_api", 255 | ] 256 | 257 | [[package]] 258 | name = "stable_deref_trait" 259 | version = "1.2.0" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 262 | 263 | [[package]] 264 | name = "syn" 265 | version = "1.0.109" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 268 | dependencies = [ 269 | "proc-macro2", 270 | "quote", 271 | "unicode-ident", 272 | ] 273 | 274 | [[package]] 275 | name = "syn" 276 | version = "2.0.32" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" 279 | dependencies = [ 280 | "proc-macro2", 281 | "quote", 282 | "unicode-ident", 283 | ] 284 | 285 | [[package]] 286 | name = "tap" 287 | version = "1.0.1" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 290 | 291 | [[package]] 292 | name = "thiserror" 293 | version = "1.0.50" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" 296 | dependencies = [ 297 | "thiserror-impl", 298 | ] 299 | 300 | [[package]] 301 | name = "thiserror-impl" 302 | version = "1.0.50" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" 305 | dependencies = [ 306 | "proc-macro2", 307 | "quote", 308 | "syn 2.0.32", 309 | ] 310 | 311 | [[package]] 312 | name = "unicode-ident" 313 | version = "1.0.11" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" 316 | 317 | [[package]] 318 | name = "usb-device" 319 | version = "0.2.9" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" 322 | 323 | [[package]] 324 | name = "version_check" 325 | version = "0.9.4" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 328 | 329 | [[package]] 330 | name = "void" 331 | version = "1.0.2" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 334 | 335 | [[package]] 336 | name = "wyz" 337 | version = "0.5.1" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" 340 | dependencies = [ 341 | "tap", 342 | ] 343 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /rust-dap/src/interface.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | use num_enum::{IntoPrimitive, TryFromPrimitive}; 18 | use usb_device::class_prelude::*; 19 | use usb_device::control::RequestType; 20 | use usb_device::device::DEFAULT_ALTERNATE_SETTING; 21 | use usb_device::Result; 22 | 23 | const USB_IF_CLASS_VENDOR: u8 = 0xff; 24 | const USB_IF_SUBCLASS_VENDOR: u8 = 0x00; 25 | const USB_IF_PROTOCOL_NONE: u8 = 0x00; 26 | 27 | pub const USB_CLASS_MISCELLANEOUS: u8 = 0xef; 28 | pub const USB_SUBCLASS_COMMON: u8 = 0x02; 29 | pub const USB_PROTOCOL_IAD: u8 = 0x01; 30 | 31 | const BOS_CAPABILITY_TYPE_PLATFORM: u8 = 0x05; 32 | const MS_OS_20_SET_HEADER_DESCRIPTOR: u16 = 0x0000; 33 | const MS_OS_20_SUBSET_HEADER_CONFIGURATION: u16 = 0x0001; 34 | const MS_OS_20_SUBSET_HEADER_FUNCTION: u16 = 0x0002; 35 | const MS_OS_20_FEATURE_COMPATIBLE_ID: u16 = 0x0003; 36 | const MS_OS_20_FEATURE_REG_PROPERTY: u16 = 0x0004; 37 | 38 | #[repr(u16)] 39 | #[derive(IntoPrimitive, TryFromPrimitive)] 40 | enum RegPropertyType { 41 | Reserved, 42 | String, 43 | ExpandString, 44 | Binary, 45 | DwordLittleEndian, 46 | DwordBigEndian, 47 | Link, 48 | MultiString, 49 | } 50 | 51 | const MS_VENDOR_CODE: u8 = 0x01; 52 | 53 | fn fill_utf16(buf: &mut [u8], b: &[u8; N]) { 54 | for i in 0..N { 55 | buf[i * 2] = b[i]; 56 | buf[i * 2 + 1] = 0; 57 | } 58 | } 59 | 60 | fn write_descriptor_set( 61 | buffer: &mut [u8], 62 | windows_version: u32, 63 | f: impl FnOnce(&mut [u8]) -> Result, 64 | ) -> Result { 65 | let length = 10usize; 66 | if buffer.len() < length { 67 | return Err(UsbError::BufferOverflow); 68 | } 69 | buffer[0] = u16_lo(length as u16); 70 | buffer[1] = u16_hi(length as u16); 71 | buffer[2] = u16_lo(MS_OS_20_SET_HEADER_DESCRIPTOR); 72 | buffer[3] = u16_hi(MS_OS_20_SET_HEADER_DESCRIPTOR); 73 | buffer[4] = u16_lo(u32_lo(windows_version)); 74 | buffer[5] = u16_hi(u32_lo(windows_version)); 75 | buffer[6] = u16_lo(u32_hi(windows_version)); 76 | buffer[7] = u16_hi(u32_hi(windows_version)); 77 | let total_length = f(&mut buffer[length..])? + length; 78 | buffer[8] = u16_lo(total_length as u16); 79 | buffer[9] = u16_hi(total_length as u16); 80 | Ok(total_length) 81 | } 82 | 83 | fn write_configuration_subset( 84 | buffer: &mut [u8], 85 | f: impl FnOnce(&mut [u8]) -> Result, 86 | ) -> Result { 87 | let length = 8usize; 88 | if buffer.len() < length { 89 | return Err(UsbError::BufferOverflow); 90 | } 91 | buffer[0] = u16_lo(length as u16); 92 | buffer[1] = u16_hi(length as u16); 93 | buffer[2] = u16_lo(MS_OS_20_SUBSET_HEADER_CONFIGURATION); 94 | buffer[3] = u16_hi(MS_OS_20_SUBSET_HEADER_CONFIGURATION); 95 | buffer[4] = 0; // Currently usb_device supports one configuration. 96 | buffer[5] = 0; // reserved 97 | let total_length = f(&mut buffer[length..])? + length; 98 | buffer[6] = u16_lo(total_length as u16); 99 | buffer[7] = u16_hi(total_length as u16); 100 | Ok(total_length) 101 | } 102 | 103 | fn write_function_subset( 104 | buffer: &mut [u8], 105 | first_interface_number: InterfaceNumber, 106 | f: impl FnOnce(&mut [u8]) -> Result, 107 | ) -> Result { 108 | let length = 8usize; 109 | if buffer.len() < length { 110 | return Err(UsbError::BufferOverflow); 111 | } 112 | buffer[0] = u16_lo(length as u16); 113 | buffer[1] = u16_hi(length as u16); 114 | buffer[2] = u16_lo(MS_OS_20_SUBSET_HEADER_FUNCTION); 115 | buffer[3] = u16_hi(MS_OS_20_SUBSET_HEADER_FUNCTION); 116 | buffer[4] = first_interface_number.into(); 117 | buffer[5] = 0; // reserved 118 | let total_length = f(&mut buffer[length..])? + length; 119 | buffer[6] = u16_lo(total_length as u16); 120 | buffer[7] = u16_hi(total_length as u16); 121 | Ok(total_length) 122 | } 123 | 124 | fn write_compatible_id( 125 | buffer: &mut [u8], 126 | compatible_id: &[u8; 8], 127 | sub_compatible_id: &[u8; 8], 128 | ) -> Result { 129 | let length = 20usize; 130 | if buffer.len() < length { 131 | return Err(UsbError::BufferOverflow); 132 | } 133 | buffer[0] = u16_lo(length as u16); 134 | buffer[1] = u16_hi(length as u16); 135 | buffer[2] = u16_lo(MS_OS_20_FEATURE_COMPATIBLE_ID); 136 | buffer[3] = u16_hi(MS_OS_20_FEATURE_COMPATIBLE_ID); 137 | buffer[4..12].copy_from_slice(compatible_id); 138 | buffer[12..20].copy_from_slice(sub_compatible_id); 139 | Ok(length) 140 | } 141 | 142 | fn write_registry_property( 143 | buffer: &mut [u8], 144 | property_name: &[u8], 145 | property_type: RegPropertyType, 146 | property_data: &[u8], 147 | ) -> Result { 148 | let name_len = property_name.len(); 149 | let data_len = property_data.len(); 150 | let length = name_len + data_len + 10; 151 | if buffer.len() < length { 152 | return Err(UsbError::BufferOverflow); 153 | } 154 | let property_type: u16 = property_type.into(); 155 | buffer[0] = u16_lo(length as u16); 156 | buffer[1] = u16_hi(length as u16); 157 | buffer[2] = u16_lo(MS_OS_20_FEATURE_REG_PROPERTY); 158 | buffer[3] = u16_hi(MS_OS_20_FEATURE_REG_PROPERTY); 159 | buffer[4..6].copy_from_slice(&property_type.to_le_bytes()); 160 | buffer[6..8].copy_from_slice(&(name_len as u16).to_le_bytes()); 161 | buffer[8..8 + name_len].copy_from_slice(property_name); 162 | buffer[8 + name_len..8 + name_len + 2].copy_from_slice(&(data_len as u16).to_le_bytes()); 163 | buffer[8 + name_len + 2..8 + name_len + 2 + data_len].copy_from_slice(property_data); 164 | 165 | Ok(length) 166 | } 167 | 168 | const fn u16_lo(v: u16) -> u8 { 169 | (v & 0xff) as u8 170 | } 171 | const fn u16_hi(v: u16) -> u8 { 172 | (v >> 8) as u8 173 | } 174 | const fn u32_lo(v: u32) -> u16 { 175 | (v & 0xfffff) as u16 176 | } 177 | const fn u32_hi(v: u32) -> u16 { 178 | (v >> 16) as u16 179 | } 180 | 181 | pub struct CmsisDapInterface<'a, B: UsbBus> { 182 | interface: InterfaceNumber, 183 | serial_string: StringIndex, 184 | out_ep: EndpointOut<'a, B>, 185 | in_ep: EndpointIn<'a, B>, 186 | } 187 | 188 | impl CmsisDapInterface<'_, B> { 189 | pub fn new(alloc: &UsbBusAllocator, max_packet_size: u16) -> CmsisDapInterface<'_, B> { 190 | CmsisDapInterface { 191 | interface: alloc.interface(), 192 | serial_string: alloc.string(), 193 | out_ep: alloc.bulk(max_packet_size), 194 | in_ep: alloc.bulk(max_packet_size), 195 | } 196 | } 197 | 198 | pub fn max_packet_size(&self) -> u16 { 199 | self.out_ep.max_packet_size() 200 | } 201 | 202 | pub fn write_packet(&mut self, data: &[u8]) -> Result { 203 | self.in_ep.write(data) 204 | } 205 | pub fn read_packet(&mut self, data: &mut [u8]) -> Result { 206 | self.out_ep.read(data) 207 | } 208 | 209 | pub(crate) fn in_ep_address(&self) -> EndpointAddress { 210 | self.in_ep.address() 211 | } 212 | pub(crate) fn out_ep_address(&self) -> EndpointAddress { 213 | self.out_ep.address() 214 | } 215 | } 216 | 217 | impl UsbClass for CmsisDapInterface<'_, B> { 218 | fn get_configuration_descriptors(&self, writer: &mut DescriptorWriter) -> Result<()> { 219 | //writer.iad(self.interface, 1, 0xff, 0xff, 0x00)?; 220 | writer.interface_alt( 221 | self.interface, 222 | DEFAULT_ALTERNATE_SETTING, 223 | USB_IF_CLASS_VENDOR, 224 | USB_IF_SUBCLASS_VENDOR, 225 | USB_IF_PROTOCOL_NONE, 226 | Some(self.serial_string), 227 | )?; 228 | writer.endpoint(&self.out_ep)?; 229 | writer.endpoint(&self.in_ep)?; 230 | 231 | Ok(()) 232 | } 233 | 234 | fn get_bos_descriptors(&self, writer: &mut BosWriter) -> Result<()> { 235 | #[rustfmt::skip] 236 | writer.capability( 237 | BOS_CAPABILITY_TYPE_PLATFORM, 238 | &[ 239 | 0, // Reserved 240 | 0xdf, 0x60, 0xdd, 0xd8, // MS_OS_20_Platform_Capability_ID 241 | 0x89, 0x45, 0xc7, 0x4c, // {D8DD60DF-4589-4CC7-9CD2-659D9E648A9F} 242 | 0x9c, 0xd2, 0x65, 0x9d, // 243 | 0x9e, 0x64, 0x8a, 0x9f, // 244 | 0x00, 0x00, 0x03, 0x06, // dwWindowsVersion – 0x06030000 (Win8.1 or later) 245 | 174, 0, // wLength = MS OS 2.0 descriptor set 246 | MS_VENDOR_CODE, // bMS_VendorCode 247 | 0x00, // bAltEnumCmd - does not support alternate enum. 248 | ] 249 | )?; 250 | Ok(()) 251 | } 252 | 253 | fn get_string(&self, index: StringIndex, lang_id: u16) -> Option<&str> { 254 | let _ = lang_id; 255 | if index == self.serial_string { 256 | Some("CMSIS-DAP interface") 257 | } else { 258 | None 259 | } 260 | } 261 | 262 | fn control_in(&mut self, xfer: ControlIn) { 263 | let request = xfer.request(); 264 | if request.request_type == RequestType::Vendor 265 | && request.request == MS_VENDOR_CODE 266 | && request.value == 0 267 | && request.index == 7 268 | { 269 | // Request to retrieve MS OS 2.0 Descriptor Set. 270 | let interface_number = self.interface; 271 | xfer.accept(|buffer| { 272 | write_descriptor_set(buffer, 0x06030000, |buffer| { 273 | write_configuration_subset(buffer, |buffer| { 274 | write_function_subset(buffer, interface_number, |buffer| { 275 | let mut offset = 0; 276 | // Registry property name and value must be null-terminated UTF-16 string so we have to allocate double size of the original string and fill it with 0 padded on MSB. 277 | let mut property_name = [0u8; b"DeviceInterfaceGUID\0".len() * 2]; 278 | fill_utf16(&mut property_name, b"DeviceInterfaceGUID\0"); 279 | let mut property_data = 280 | [0u8; b"{A5DCBF10-6530-11D2-901F-00C04FB951ED}\0".len() * 2]; 281 | fill_utf16( 282 | &mut property_data, 283 | b"{A5DCBF10-6530-11D2-901F-00C04FB951ED}\0", 284 | ); 285 | 286 | // Set Compatible ID to WINUSB in order to be WinUSB driver is loaded for this interface. 287 | offset += write_compatible_id( 288 | &mut buffer[offset..], 289 | b"WINUSB\0\0", 290 | &[0u8; 8], 291 | )?; 292 | // Set GUID_DEVINTERFACE_USB_DEVICE({A5DCBF10-6530-11D2-901F-00C04FB951ED}) Device Interface Class to be enumerated by libusb. 293 | offset += write_registry_property( 294 | &mut buffer[offset..], 295 | &property_name, 296 | RegPropertyType::String, 297 | &property_data, 298 | )?; 299 | Ok(offset) 300 | }) 301 | }) 302 | }) 303 | }) 304 | .unwrap(); 305 | } 306 | } 307 | } 308 | -------------------------------------------------------------------------------- /boards/xiao_m0/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "aligned" 7 | version = "0.3.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "c19796bd8d477f1a9d4ac2465b464a8b1359474f06a96bb3cda650b4fca309bf" 10 | dependencies = [ 11 | "as-slice", 12 | ] 13 | 14 | [[package]] 15 | name = "as-slice" 16 | version = "0.1.5" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "45403b49e3954a4b8428a0ac21a4b7afadccf92bfd96273f1a58cd4812496ae0" 19 | dependencies = [ 20 | "generic-array 0.12.4", 21 | "generic-array 0.13.3", 22 | "generic-array 0.14.4", 23 | "stable_deref_trait", 24 | ] 25 | 26 | [[package]] 27 | name = "atomic-polyfill" 28 | version = "0.1.2" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "30302dda7a66f8c55932ebf208f7def840743ff64d495e9ceffcd97c18f11d39" 31 | dependencies = [ 32 | "cortex-m 0.7.2", 33 | ] 34 | 35 | [[package]] 36 | name = "atsamd-hal" 37 | version = "0.13.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "eb5dce6169ab96f922232f87f2f301429bd947ff417cd6695b4ad1e1c5b83a01" 40 | dependencies = [ 41 | "atsamd21g", 42 | "bitfield", 43 | "bitflags", 44 | "cortex-m 0.6.7", 45 | "embedded-hal", 46 | "modular-bitfield", 47 | "nb 0.1.3", 48 | "num-traits", 49 | "paste", 50 | "rand_core", 51 | "replace_with", 52 | "seq-macro", 53 | "typenum", 54 | "usb-device", 55 | "vcell", 56 | "void", 57 | ] 58 | 59 | [[package]] 60 | name = "atsamd21g" 61 | version = "0.10.0" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "6256c8fd4ea5739c8582885eaf0800e3d2f3cb484e66e0a1a0892dbbdc4e4a9e" 64 | dependencies = [ 65 | "bare-metal", 66 | "cortex-m 0.6.7", 67 | "cortex-m-rt", 68 | "vcell", 69 | ] 70 | 71 | [[package]] 72 | name = "autocfg" 73 | version = "1.0.1" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 76 | 77 | [[package]] 78 | name = "bare-metal" 79 | version = "0.2.5" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 82 | dependencies = [ 83 | "rustc_version", 84 | ] 85 | 86 | [[package]] 87 | name = "bitfield" 88 | version = "0.13.2" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 91 | 92 | [[package]] 93 | name = "bitflags" 94 | version = "1.2.1" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 97 | 98 | [[package]] 99 | name = "byteorder" 100 | version = "1.4.3" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 103 | 104 | [[package]] 105 | name = "cortex-m" 106 | version = "0.6.7" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "9075300b07c6a56263b9b582c214d0ff037b00d45ec9fde1cc711490c56f1bb9" 109 | dependencies = [ 110 | "aligned", 111 | "bare-metal", 112 | "bitfield", 113 | "cortex-m 0.7.2", 114 | "volatile-register", 115 | ] 116 | 117 | [[package]] 118 | name = "cortex-m" 119 | version = "0.7.2" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "643a210c1bdc23d0db511e2a576082f4ff4dcae9d0c37f50b431b8f8439d6d6b" 122 | dependencies = [ 123 | "bare-metal", 124 | "bitfield", 125 | "embedded-hal", 126 | "volatile-register", 127 | ] 128 | 129 | [[package]] 130 | name = "cortex-m-rt" 131 | version = "0.6.15" 132 | source = "registry+https://github.com/rust-lang/crates.io-index" 133 | checksum = "454f278bf469e2de0a4d22ea019d169d8944f86957c8207a39e3f66c32be2fc6" 134 | dependencies = [ 135 | "cortex-m-rt-macros", 136 | "r0", 137 | ] 138 | 139 | [[package]] 140 | name = "cortex-m-rt-macros" 141 | version = "0.6.15" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | checksum = "c8e3aa52243e26f5922fa522b0814019e0c98fc567e2756d715dce7ad7a81f49" 144 | dependencies = [ 145 | "proc-macro2", 146 | "quote", 147 | "syn", 148 | ] 149 | 150 | [[package]] 151 | name = "derivative" 152 | version = "2.2.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" 155 | dependencies = [ 156 | "proc-macro2", 157 | "quote", 158 | "syn", 159 | ] 160 | 161 | [[package]] 162 | name = "embedded-hal" 163 | version = "0.2.6" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | checksum = "e36cfb62ff156596c892272f3015ef952fe1525e85261fa3a7f327bd6b384ab9" 166 | dependencies = [ 167 | "nb 0.1.3", 168 | "void", 169 | ] 170 | 171 | [[package]] 172 | name = "generic-array" 173 | version = "0.12.4" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" 176 | dependencies = [ 177 | "typenum", 178 | ] 179 | 180 | [[package]] 181 | name = "generic-array" 182 | version = "0.13.3" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "f797e67af32588215eaaab8327027ee8e71b9dd0b2b26996aedf20c030fce309" 185 | dependencies = [ 186 | "typenum", 187 | ] 188 | 189 | [[package]] 190 | name = "generic-array" 191 | version = "0.14.4" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" 194 | dependencies = [ 195 | "typenum", 196 | "version_check", 197 | ] 198 | 199 | [[package]] 200 | name = "hash32" 201 | version = "0.2.1" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 204 | dependencies = [ 205 | "byteorder", 206 | ] 207 | 208 | [[package]] 209 | name = "heapless" 210 | version = "0.7.1" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "c7ee8a997d259962217f40279f34201fdf06e669bafa69d7c1f4c7ff1893b5f6" 213 | dependencies = [ 214 | "atomic-polyfill", 215 | "hash32", 216 | "stable_deref_trait", 217 | ] 218 | 219 | [[package]] 220 | name = "modular-bitfield" 221 | version = "0.11.2" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "a53d79ba8304ac1c4f9eb3b9d281f21f7be9d4626f72ce7df4ad8fbde4f38a74" 224 | dependencies = [ 225 | "modular-bitfield-impl", 226 | "static_assertions", 227 | ] 228 | 229 | [[package]] 230 | name = "modular-bitfield-impl" 231 | version = "0.11.2" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "5a7d5f7076603ebc68de2dc6a650ec331a062a13abaa346975be747bbfa4b789" 234 | dependencies = [ 235 | "proc-macro2", 236 | "quote", 237 | "syn", 238 | ] 239 | 240 | [[package]] 241 | name = "nb" 242 | version = "0.1.3" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 245 | dependencies = [ 246 | "nb 1.0.0", 247 | ] 248 | 249 | [[package]] 250 | name = "nb" 251 | version = "1.0.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" 254 | 255 | [[package]] 256 | name = "num-traits" 257 | version = "0.2.14" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 260 | dependencies = [ 261 | "autocfg", 262 | ] 263 | 264 | [[package]] 265 | name = "num_enum" 266 | version = "0.5.1" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" 269 | dependencies = [ 270 | "derivative", 271 | "num_enum_derive", 272 | ] 273 | 274 | [[package]] 275 | name = "num_enum_derive" 276 | version = "0.5.1" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" 279 | dependencies = [ 280 | "proc-macro2", 281 | "quote", 282 | "syn", 283 | ] 284 | 285 | [[package]] 286 | name = "panic-halt" 287 | version = "0.2.0" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 290 | 291 | [[package]] 292 | name = "paste" 293 | version = "1.0.5" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" 296 | 297 | [[package]] 298 | name = "proc-macro2" 299 | version = "1.0.27" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" 302 | dependencies = [ 303 | "unicode-xid", 304 | ] 305 | 306 | [[package]] 307 | name = "quote" 308 | version = "1.0.9" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 311 | dependencies = [ 312 | "proc-macro2", 313 | ] 314 | 315 | [[package]] 316 | name = "r0" 317 | version = "0.2.2" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | checksum = "e2a38df5b15c8d5c7e8654189744d8e396bddc18ad48041a500ce52d6948941f" 320 | 321 | [[package]] 322 | name = "rand_core" 323 | version = "0.5.1" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 326 | 327 | [[package]] 328 | name = "replace_with" 329 | version = "0.1.7" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "e3a8614ee435691de62bcffcf4a66d91b3594bf1428a5722e79103249a095690" 332 | 333 | [[package]] 334 | name = "rust-dap" 335 | version = "0.2.0" 336 | dependencies = [ 337 | "bitflags", 338 | "embedded-hal", 339 | "heapless", 340 | "nb 0.1.3", 341 | "num_enum", 342 | "usb-device", 343 | ] 344 | 345 | [[package]] 346 | name = "rust-dap-xiao" 347 | version = "0.1.0" 348 | dependencies = [ 349 | "cortex-m 0.6.7", 350 | "cortex-m-rt", 351 | "embedded-hal", 352 | "heapless", 353 | "nb 0.1.3", 354 | "panic-halt", 355 | "rust-dap", 356 | "usb-device", 357 | "usbd-serial", 358 | "xiao_m0", 359 | ] 360 | 361 | [[package]] 362 | name = "rustc_version" 363 | version = "0.2.3" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 366 | dependencies = [ 367 | "semver", 368 | ] 369 | 370 | [[package]] 371 | name = "semver" 372 | version = "0.9.0" 373 | source = "registry+https://github.com/rust-lang/crates.io-index" 374 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 375 | dependencies = [ 376 | "semver-parser", 377 | ] 378 | 379 | [[package]] 380 | name = "semver-parser" 381 | version = "0.7.0" 382 | source = "registry+https://github.com/rust-lang/crates.io-index" 383 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 384 | 385 | [[package]] 386 | name = "seq-macro" 387 | version = "0.2.2" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | checksum = "5a9f47faea3cad316faa914d013d24f471cd90bfca1a0c70f05a3f42c6441e99" 390 | 391 | [[package]] 392 | name = "stable_deref_trait" 393 | version = "1.2.0" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 396 | 397 | [[package]] 398 | name = "static_assertions" 399 | version = "1.1.0" 400 | source = "registry+https://github.com/rust-lang/crates.io-index" 401 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 402 | 403 | [[package]] 404 | name = "syn" 405 | version = "1.0.72" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" 408 | dependencies = [ 409 | "proc-macro2", 410 | "quote", 411 | "unicode-xid", 412 | ] 413 | 414 | [[package]] 415 | name = "typenum" 416 | version = "1.13.0" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" 419 | 420 | [[package]] 421 | name = "unicode-xid" 422 | version = "0.2.2" 423 | source = "registry+https://github.com/rust-lang/crates.io-index" 424 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 425 | 426 | [[package]] 427 | name = "usb-device" 428 | version = "0.2.8" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "6be90410d4772074ea49525e2e753b65920b94b57eee21a6ef7b6a6fe6296245" 431 | 432 | [[package]] 433 | name = "usbd-serial" 434 | version = "0.1.1" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" 437 | dependencies = [ 438 | "embedded-hal", 439 | "nb 0.1.3", 440 | "usb-device", 441 | ] 442 | 443 | [[package]] 444 | name = "vcell" 445 | version = "0.1.3" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 448 | 449 | [[package]] 450 | name = "version_check" 451 | version = "0.9.3" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" 454 | 455 | [[package]] 456 | name = "void" 457 | version = "1.0.2" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 460 | 461 | [[package]] 462 | name = "volatile-register" 463 | version = "0.2.0" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" 466 | dependencies = [ 467 | "vcell", 468 | ] 469 | 470 | [[package]] 471 | name = "xiao_m0" 472 | version = "0.11.0" 473 | source = "registry+https://github.com/rust-lang/crates.io-index" 474 | checksum = "53b8a15c3048887b8e0bcfcfe471a36162a42897b1113da6307e7b2547ac13e8" 475 | dependencies = [ 476 | "atsamd-hal", 477 | "cortex-m-rt", 478 | "usb-device", 479 | ] 480 | -------------------------------------------------------------------------------- /boards/xiao_rp2040/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2022 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #![no_std] 18 | #![no_main] 19 | 20 | #[rtic::app(device = rp_pico::hal::pac, peripherals = true)] 21 | mod app { 22 | use panic_halt as _; 23 | 24 | use hal::clocks::Clock; 25 | use hal::gpio::{Output, Pin, PushPull}; 26 | use hal::pac; 27 | use rp_pico::hal; 28 | 29 | use hal::usb::UsbBus; 30 | use usb_device::bus::UsbBusAllocator; 31 | 32 | use rust_dap::{CmsisDap, DapCapabilities}; 33 | use usb_device::prelude::*; 34 | use usbd_serial::SerialPort; 35 | 36 | use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin}; 37 | use embedded_hal::serial::{Read, Write}; 38 | 39 | use rust_dap_rp2040::line_coding::*; 40 | use rust_dap_rp2040::util::{ 41 | initialize_usb, read_usb_serial_byte_cs, write_usb_serial_byte_cs, UartConfigAndClock, 42 | }; 43 | #[cfg(feature = "bitbang")] 44 | type SwdIoSet = rust_dap_rp2040::util::SwdIoSet; 45 | #[cfg(not(feature = "bitbang"))] 46 | type SwdIoSet = rust_dap_rp2040::util::SwdIoSet; 47 | 48 | // GPIO mappings 49 | type GpioSwClk = hal::gpio::bank0::Gpio2; 50 | type GpioSwdIo = hal::gpio::bank0::Gpio4; 51 | type GpioReset = hal::gpio::bank0::Gpio26; 52 | type GpioUartTx = hal::gpio::bank0::Gpio0; 53 | type GpioUartRx = hal::gpio::bank0::Gpio1; 54 | type GpioUsbLed = hal::gpio::bank0::Gpio25; 55 | type GpioIdleLed = hal::gpio::bank0::Gpio17; 56 | type GpioDebugOut = hal::gpio::bank0::Gpio6; 57 | type GpioDebugIrqOut = hal::gpio::bank0::Gpio28; 58 | type GpioDebugUsbIrqOut = hal::gpio::bank0::Gpio27; 59 | 60 | // UART Interrupt context 61 | const UART_RX_QUEUE_SIZE: usize = 256; 62 | const UART_TX_QUEUE_SIZE: usize = 128; 63 | // UART Shared context 64 | type UartPins = ( 65 | hal::gpio::Pin>, 66 | hal::gpio::Pin>, 67 | ); 68 | type Uart = hal::uart::UartPeripheral; 69 | pub struct UartReader(hal::uart::Reader); 70 | pub struct UartWriter(hal::uart::Writer); 71 | unsafe impl Sync for UartReader {} 72 | unsafe impl Sync for UartWriter {} 73 | unsafe impl Send for UartReader {} 74 | unsafe impl Send for UartWriter {} 75 | 76 | #[shared] 77 | struct Shared { 78 | uart_reader: Option, 79 | uart_writer: Option, 80 | usb_serial: SerialPort<'static, UsbBus>, 81 | uart_rx_consumer: heapless::spsc::Consumer<'static, u8, UART_RX_QUEUE_SIZE>, 82 | uart_tx_producer: heapless::spsc::Producer<'static, u8, UART_TX_QUEUE_SIZE>, 83 | uart_tx_consumer: heapless::spsc::Consumer<'static, u8, UART_TX_QUEUE_SIZE>, 84 | } 85 | 86 | #[local] 87 | struct Local { 88 | uart_config: UartConfigAndClock, 89 | uart_rx_producer: heapless::spsc::Producer<'static, u8, UART_RX_QUEUE_SIZE>, 90 | usb_bus: UsbDevice<'static, UsbBus>, 91 | usb_dap: CmsisDap<'static, UsbBus, SwdIoSet, 64>, 92 | usb_led: Pin>, 93 | idle_led: Pin>, 94 | debug_out: Pin>, 95 | debug_irq_out: Pin>, 96 | debug_usb_irq_out: Pin>, 97 | } 98 | 99 | #[init(local = [ 100 | uart_rx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), 101 | uart_tx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), 102 | USB_ALLOCATOR: Option> = None, 103 | ])] 104 | fn init(c: init::Context) -> (Shared, Local, init::Monotonics) { 105 | let mut resets = c.device.RESETS; 106 | let sio = hal::Sio::new(c.device.SIO); 107 | let pins = rp_pico::Pins::new( 108 | c.device.IO_BANK0, 109 | c.device.PADS_BANK0, 110 | sio.gpio_bank0, 111 | &mut resets, 112 | ); 113 | 114 | let mut watchdog = hal::Watchdog::new(c.device.WATCHDOG); 115 | let clocks = hal::clocks::init_clocks_and_plls( 116 | rp_pico::XOSC_CRYSTAL_FREQ, 117 | c.device.XOSC, 118 | c.device.CLOCKS, 119 | c.device.PLL_SYS, 120 | c.device.PLL_USB, 121 | &mut resets, 122 | &mut watchdog, 123 | ) 124 | .ok() 125 | .unwrap(); 126 | 127 | let uart_pins = ( 128 | pins.gpio0.into_mode::(), // TxD 129 | pins.gpio1.into_mode::(), // RxD 130 | ); 131 | let uart_config = UartConfigAndClock { 132 | config: UartConfig::from(hal::uart::UartConfig::default()), 133 | clock: clocks.peripheral_clock.freq(), 134 | }; 135 | let mut uart = hal::uart::UartPeripheral::new(c.device.UART0, uart_pins, &mut resets) 136 | .enable((&uart_config.config).into(), uart_config.clock) 137 | .unwrap(); 138 | // Enable RX interrupt. Note that TX interrupt is enabled when some TX data is available. 139 | uart.enable_rx_interrupt(); 140 | let (uart_reader, uart_writer) = uart.split(); 141 | let uart_reader = Some(UartReader(uart_reader)); 142 | let uart_writer = Some(UartWriter(uart_writer)); 143 | 144 | let usb_allocator = UsbBusAllocator::new(hal::usb::UsbBus::new( 145 | c.device.USBCTRL_REGS, 146 | c.device.USBCTRL_DPRAM, 147 | clocks.usb_clock, 148 | true, 149 | &mut resets, 150 | )); 151 | c.local.USB_ALLOCATOR.replace(usb_allocator); 152 | let usb_allocator = c.local.USB_ALLOCATOR.as_ref().unwrap(); 153 | 154 | let (usb_serial, usb_dap, usb_bus) = { 155 | // Initialize MCU reset pin. 156 | // RESET pin of Cortex Debug 10-pin connector is negative logic 157 | // https://developer.arm.com/documentation/101453/0100/CoreSight-Technology/Connectors 158 | let reset_pin = pins.gpio26.into_floating_input(); 159 | 160 | let swdio; 161 | #[cfg(feature = "bitbang")] 162 | { 163 | use rust_dap_rp2040::{swdio_pin::PicoSwdInputPin, util::CycleDelay}; 164 | let swclk_pin = PicoSwdInputPin::new(pins.gpio2.into_floating_input()); 165 | let swdio_pin = PicoSwdInputPin::new(pins.gpio4.into_floating_input()); 166 | let reset_pin = PicoSwdInputPin::new(reset_pin); 167 | swdio = SwdIoSet::new(swclk_pin, swdio_pin, reset_pin, CycleDelay {}); 168 | } 169 | #[cfg(not(feature = "bitbang"))] 170 | { 171 | let mut swclk_pin = pins.gpio2.into_mode(); 172 | let mut swdio_pin = pins.gpio4.into_mode(); 173 | let mut reset_pin = reset_pin.into_mode(); 174 | swclk_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 175 | swdio_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 176 | reset_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 177 | swdio = SwdIoSet::new(c.device.PIO0, swclk_pin, swdio_pin, reset_pin, &mut resets); 178 | } 179 | initialize_usb(swdio, usb_allocator, "xiao-rp2040", DapCapabilities::SWD) 180 | }; 181 | 182 | let usb_led = pins.led.into_push_pull_output(); 183 | let (uart_rx_producer, uart_rx_consumer) = c.local.uart_rx_queue.split(); 184 | let (uart_tx_producer, uart_tx_consumer) = c.local.uart_tx_queue.split(); 185 | 186 | let mut debug_out = pins.gpio6.into_push_pull_output(); 187 | debug_out.set_low().ok(); 188 | let mut debug_irq_out = pins.gpio28.into_push_pull_output(); 189 | debug_irq_out.set_low().ok(); 190 | let mut debug_usb_irq_out = pins.gpio27.into_push_pull_output(); 191 | debug_usb_irq_out.set_low().ok(); 192 | 193 | pins.gpio16.into_push_pull_output().set_high().ok(); 194 | let mut idle_led = pins.gpio17.into_push_pull_output(); 195 | idle_led.set_high().ok(); 196 | ( 197 | Shared { 198 | uart_reader, 199 | uart_writer, 200 | usb_serial, 201 | uart_rx_consumer, 202 | uart_tx_producer, 203 | uart_tx_consumer, 204 | }, 205 | Local { 206 | uart_config, 207 | uart_rx_producer, 208 | usb_bus, 209 | usb_dap, 210 | usb_led, 211 | idle_led, 212 | debug_out, 213 | debug_irq_out, 214 | debug_usb_irq_out, 215 | }, 216 | init::Monotonics(), 217 | ) 218 | } 219 | 220 | #[idle(shared = [uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], local = [idle_led])] 221 | fn idle(mut c: idle::Context) -> ! { 222 | loop { 223 | (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( 224 | |usb_serial, uart_tx_producer| { 225 | while uart_tx_producer.ready() { 226 | if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { 227 | uart_tx_producer.enqueue(data).unwrap(); 228 | } else { 229 | break; 230 | } 231 | } 232 | }, 233 | ); 234 | (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( 235 | |uart, uart_tx_consumer| { 236 | let uart = uart.as_mut().unwrap(); 237 | while let Some(data) = uart_tx_consumer.peek() { 238 | if uart.0.write(*data).is_ok() { 239 | uart_tx_consumer.dequeue().unwrap(); 240 | } else { 241 | break; 242 | } 243 | } 244 | }, 245 | ); 246 | 247 | // Process RX data. 248 | (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( 249 | |usb_serial, uart_rx_consumer| { 250 | while let Some(data) = uart_rx_consumer.peek() { 251 | match write_usb_serial_byte_cs(usb_serial, *data) { 252 | Ok(_) => { 253 | let _ = uart_rx_consumer.dequeue().unwrap(); 254 | } 255 | _ => break, 256 | } 257 | } 258 | usb_serial.flush().ok(); 259 | }, 260 | ); 261 | 262 | c.local.idle_led.toggle().ok(); 263 | } 264 | } 265 | 266 | #[task( 267 | binds = UART0_IRQ, 268 | priority = 1, 269 | shared = [uart_reader], 270 | local = [uart_rx_producer, debug_out, debug_irq_out], 271 | )] 272 | fn uart_irq(mut c: uart_irq::Context) { 273 | c.local.debug_irq_out.set_high().ok(); 274 | while c.local.uart_rx_producer.ready() { 275 | if let Ok(data) = c 276 | .shared 277 | .uart_reader 278 | .lock(|uart| uart.as_mut().unwrap().0.read()) 279 | { 280 | c.local.debug_out.toggle().ok(); 281 | let _ = c.local.uart_rx_producer.enqueue(data).ok(); // Enqueuing must not fail because we have already checked that the queue is ready to enqueue. 282 | } else { 283 | break; 284 | } 285 | } 286 | c.local.debug_irq_out.set_low().ok(); 287 | } 288 | 289 | #[task( 290 | binds = USBCTRL_IRQ, 291 | priority = 2, // USBCTRL_IRQ priority must be greater than or equal to UART0_IRQ not to hang up the UART when UART FIFO is full. 292 | shared = [uart_reader, uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], 293 | local = [usb_bus, usb_dap, uart_config, usb_led, debug_usb_irq_out], 294 | )] 295 | fn usbctrl_irq(mut c: usbctrl_irq::Context) { 296 | c.local.debug_usb_irq_out.set_high().ok(); 297 | 298 | let poll_result = c 299 | .shared 300 | .usb_serial 301 | .lock(|usb_serial| c.local.usb_bus.poll(&mut [usb_serial, c.local.usb_dap])); 302 | if !poll_result { 303 | c.local.debug_usb_irq_out.set_low().ok(); 304 | return; // Nothing to do at this time... 305 | } 306 | // Process DAP commands. 307 | c.local.usb_dap.process().ok(); 308 | 309 | // Process TX data. 310 | (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( 311 | |usb_serial, uart_tx_producer| { 312 | while uart_tx_producer.ready() { 313 | if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { 314 | uart_tx_producer.enqueue(data).unwrap(); 315 | } else { 316 | break; 317 | } 318 | } 319 | }, 320 | ); 321 | (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( 322 | |uart, uart_tx_consumer| { 323 | let uart = uart.as_mut().unwrap(); 324 | while let Some(data) = uart_tx_consumer.peek() { 325 | if uart.0.write(*data).is_ok() { 326 | uart_tx_consumer.dequeue().unwrap(); 327 | } else { 328 | break; 329 | } 330 | } 331 | }, 332 | ); 333 | 334 | // Process RX data. 335 | (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( 336 | |usb_serial, uart_rx_consumer| { 337 | while let Some(data) = uart_rx_consumer.peek() { 338 | match write_usb_serial_byte_cs(usb_serial, *data) { 339 | Ok(_) => { 340 | let _ = uart_rx_consumer.dequeue().unwrap(); 341 | } 342 | _ => break, 343 | } 344 | } 345 | usb_serial.flush().ok(); 346 | }, 347 | ); 348 | 349 | // Check if the UART transmitter must be re-configured. 350 | if let Ok(expected_config) = c 351 | .shared 352 | .usb_serial 353 | .lock(|usb_serial| UartConfig::try_from(usb_serial.line_coding())) 354 | { 355 | let config = c.local.uart_config.config; 356 | if expected_config != config { 357 | (&mut c.shared.uart_reader, &mut c.shared.uart_writer).lock(|reader, writer| { 358 | reader.as_mut().unwrap().0.disable_rx_interrupt(); 359 | let disabled = 360 | Uart::join(reader.take().unwrap().0, writer.take().unwrap().0).disable(); 361 | let enabled = disabled 362 | .enable((&expected_config).into(), c.local.uart_config.clock) 363 | .unwrap(); 364 | c.local.uart_config.config = expected_config; 365 | let (new_reader, new_writer) = enabled.split(); 366 | reader.replace(UartReader(new_reader)); 367 | writer.replace(UartWriter(new_writer)); 368 | reader.as_mut().unwrap().0.enable_rx_interrupt(); 369 | }); 370 | } 371 | } 372 | 373 | c.local.usb_led.toggle().ok(); 374 | c.local.debug_usb_irq_out.set_low().ok(); 375 | } 376 | } 377 | -------------------------------------------------------------------------------- /boards/xiao_rp2040/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "arrayvec" 7 | version = "0.7.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 10 | 11 | [[package]] 12 | name = "atomic-polyfill" 13 | version = "0.1.11" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" 16 | dependencies = [ 17 | "critical-section", 18 | ] 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.1.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 25 | 26 | [[package]] 27 | name = "bare-metal" 28 | version = "0.2.5" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 31 | dependencies = [ 32 | "rustc_version 0.2.3", 33 | ] 34 | 35 | [[package]] 36 | name = "bare-metal" 37 | version = "1.0.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" 40 | 41 | [[package]] 42 | name = "bitfield" 43 | version = "0.13.2" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 46 | 47 | [[package]] 48 | name = "bitflags" 49 | version = "1.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 52 | 53 | [[package]] 54 | name = "byteorder" 55 | version = "1.4.3" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 58 | 59 | [[package]] 60 | name = "cortex-m" 61 | version = "0.7.7" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 64 | dependencies = [ 65 | "bare-metal 0.2.5", 66 | "bitfield", 67 | "embedded-hal", 68 | "volatile-register", 69 | ] 70 | 71 | [[package]] 72 | name = "cortex-m-rt" 73 | version = "0.7.3" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" 76 | dependencies = [ 77 | "cortex-m-rt-macros", 78 | ] 79 | 80 | [[package]] 81 | name = "cortex-m-rt-macros" 82 | version = "0.7.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" 85 | dependencies = [ 86 | "proc-macro2", 87 | "quote", 88 | "syn", 89 | ] 90 | 91 | [[package]] 92 | name = "cortex-m-rtic" 93 | version = "1.1.4" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | checksum = "d696ae7390bdb9f7978f71ca7144256a2c4616240a6df9002da3c451f9fc8f02" 96 | dependencies = [ 97 | "bare-metal 1.0.0", 98 | "cortex-m", 99 | "cortex-m-rtic-macros", 100 | "heapless", 101 | "rtic-core", 102 | "rtic-monotonic", 103 | "version_check", 104 | ] 105 | 106 | [[package]] 107 | name = "cortex-m-rtic-macros" 108 | version = "1.1.6" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | checksum = "eefb40b1ca901c759d29526e5c8a0a1b246c20caaa5b4cc5d0f0b94debecd4c7" 111 | dependencies = [ 112 | "proc-macro-error", 113 | "proc-macro2", 114 | "quote", 115 | "rtic-syntax", 116 | "syn", 117 | ] 118 | 119 | [[package]] 120 | name = "crc-any" 121 | version = "2.4.3" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df" 124 | dependencies = [ 125 | "debug-helper", 126 | ] 127 | 128 | [[package]] 129 | name = "critical-section" 130 | version = "1.1.2" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 133 | 134 | [[package]] 135 | name = "debug-helper" 136 | version = "0.3.13" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" 139 | 140 | [[package]] 141 | name = "either" 142 | version = "1.9.0" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 145 | 146 | [[package]] 147 | name = "embedded-dma" 148 | version = "0.2.0" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 151 | dependencies = [ 152 | "stable_deref_trait", 153 | ] 154 | 155 | [[package]] 156 | name = "embedded-hal" 157 | version = "0.2.7" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 160 | dependencies = [ 161 | "nb 0.1.3", 162 | "void", 163 | ] 164 | 165 | [[package]] 166 | name = "fugit" 167 | version = "0.3.7" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" 170 | dependencies = [ 171 | "gcd", 172 | ] 173 | 174 | [[package]] 175 | name = "gcd" 176 | version = "2.3.0" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" 179 | 180 | [[package]] 181 | name = "hash32" 182 | version = "0.2.1" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 185 | dependencies = [ 186 | "byteorder", 187 | ] 188 | 189 | [[package]] 190 | name = "hashbrown" 191 | version = "0.12.3" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 194 | 195 | [[package]] 196 | name = "heapless" 197 | version = "0.7.16" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 200 | dependencies = [ 201 | "atomic-polyfill", 202 | "hash32", 203 | "rustc_version 0.4.0", 204 | "spin", 205 | "stable_deref_trait", 206 | ] 207 | 208 | [[package]] 209 | name = "indexmap" 210 | version = "1.9.3" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 213 | dependencies = [ 214 | "autocfg", 215 | "hashbrown", 216 | ] 217 | 218 | [[package]] 219 | name = "itertools" 220 | version = "0.10.5" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" 223 | dependencies = [ 224 | "either", 225 | ] 226 | 227 | [[package]] 228 | name = "lock_api" 229 | version = "0.4.10" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" 232 | dependencies = [ 233 | "autocfg", 234 | "scopeguard", 235 | ] 236 | 237 | [[package]] 238 | name = "nb" 239 | version = "0.1.3" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 242 | dependencies = [ 243 | "nb 1.1.0", 244 | ] 245 | 246 | [[package]] 247 | name = "nb" 248 | version = "1.1.0" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 251 | 252 | [[package]] 253 | name = "num_enum" 254 | version = "0.5.11" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" 257 | dependencies = [ 258 | "num_enum_derive", 259 | ] 260 | 261 | [[package]] 262 | name = "num_enum_derive" 263 | version = "0.5.11" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" 266 | dependencies = [ 267 | "proc-macro2", 268 | "quote", 269 | "syn", 270 | ] 271 | 272 | [[package]] 273 | name = "panic-halt" 274 | version = "0.2.0" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 277 | 278 | [[package]] 279 | name = "paste" 280 | version = "1.0.14" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 283 | 284 | [[package]] 285 | name = "pio" 286 | version = "0.2.1" 287 | source = "registry+https://github.com/rust-lang/crates.io-index" 288 | checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" 289 | dependencies = [ 290 | "arrayvec", 291 | "num_enum", 292 | "paste", 293 | ] 294 | 295 | [[package]] 296 | name = "proc-macro-error" 297 | version = "1.0.4" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 300 | dependencies = [ 301 | "proc-macro-error-attr", 302 | "proc-macro2", 303 | "quote", 304 | "syn", 305 | "version_check", 306 | ] 307 | 308 | [[package]] 309 | name = "proc-macro-error-attr" 310 | version = "1.0.4" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 313 | dependencies = [ 314 | "proc-macro2", 315 | "quote", 316 | "version_check", 317 | ] 318 | 319 | [[package]] 320 | name = "proc-macro2" 321 | version = "1.0.66" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" 324 | dependencies = [ 325 | "unicode-ident", 326 | ] 327 | 328 | [[package]] 329 | name = "quote" 330 | version = "1.0.33" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 333 | dependencies = [ 334 | "proc-macro2", 335 | ] 336 | 337 | [[package]] 338 | name = "rand_core" 339 | version = "0.6.4" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 342 | 343 | [[package]] 344 | name = "rp-pico" 345 | version = "0.7.0" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "aab28f6f4e19cec2d61b64cdd685e69794b81c579fd3b765579c46018fe616d0" 348 | dependencies = [ 349 | "cortex-m", 350 | "cortex-m-rt", 351 | "fugit", 352 | "rp2040-hal", 353 | "usb-device", 354 | ] 355 | 356 | [[package]] 357 | name = "rp2040-boot2" 358 | version = "0.2.1" 359 | source = "registry+https://github.com/rust-lang/crates.io-index" 360 | checksum = "3c773ec49b836077aa144b58dc7654a243e1eecdb6cf0d25361ae7c7600fabd8" 361 | dependencies = [ 362 | "crc-any", 363 | ] 364 | 365 | [[package]] 366 | name = "rp2040-hal" 367 | version = "0.8.2" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "1369bb84862d7f69391a96606b2f29a00bfce7f29a749e23d5f01fc3f607ada0" 370 | dependencies = [ 371 | "cortex-m", 372 | "critical-section", 373 | "embedded-dma", 374 | "embedded-hal", 375 | "fugit", 376 | "itertools", 377 | "nb 1.1.0", 378 | "paste", 379 | "pio", 380 | "rand_core", 381 | "rp2040-hal-macros", 382 | "rp2040-pac", 383 | "usb-device", 384 | "vcell", 385 | "void", 386 | ] 387 | 388 | [[package]] 389 | name = "rp2040-hal-macros" 390 | version = "0.1.0" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "86479063e497efe1ae81995ef9071f54fd1c7427e04d6c5b84cde545ff672a5e" 393 | dependencies = [ 394 | "cortex-m-rt", 395 | "proc-macro2", 396 | "quote", 397 | "syn", 398 | ] 399 | 400 | [[package]] 401 | name = "rp2040-pac" 402 | version = "0.4.0" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "9192cafbb40d717c9e0ddf767aaf9c69fee1b4e48d22ed853b57b11f6d9f3d7e" 405 | dependencies = [ 406 | "cortex-m", 407 | "cortex-m-rt", 408 | "vcell", 409 | ] 410 | 411 | [[package]] 412 | name = "rtic-core" 413 | version = "1.0.0" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" 416 | 417 | [[package]] 418 | name = "rtic-monotonic" 419 | version = "1.0.0" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" 422 | 423 | [[package]] 424 | name = "rtic-syntax" 425 | version = "1.0.3" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "5f5e215601dc467752c2bddc6284a622c6f3d2bab569d992adcd5ab7e4cb9478" 428 | dependencies = [ 429 | "indexmap", 430 | "proc-macro2", 431 | "quote", 432 | "syn", 433 | ] 434 | 435 | [[package]] 436 | name = "rust-dap" 437 | version = "0.2.0" 438 | dependencies = [ 439 | "bitflags", 440 | "embedded-hal", 441 | "heapless", 442 | "nb 0.1.3", 443 | "num_enum", 444 | "usb-device", 445 | ] 446 | 447 | [[package]] 448 | name = "rust-dap-rp2040" 449 | version = "0.2.0" 450 | dependencies = [ 451 | "cortex-m", 452 | "cortex-m-rt", 453 | "cortex-m-rtic", 454 | "embedded-hal", 455 | "fugit", 456 | "heapless", 457 | "nb 0.1.3", 458 | "panic-halt", 459 | "pio", 460 | "rp2040-boot2", 461 | "rp2040-hal", 462 | "rust-dap", 463 | "usb-device", 464 | "usbd-serial", 465 | ] 466 | 467 | [[package]] 468 | name = "rust-dap-xiao-rp2040" 469 | version = "0.2.0" 470 | dependencies = [ 471 | "cortex-m", 472 | "cortex-m-rt", 473 | "cortex-m-rtic", 474 | "embedded-hal", 475 | "heapless", 476 | "nb 0.1.3", 477 | "panic-halt", 478 | "rp-pico", 479 | "rust-dap", 480 | "rust-dap-rp2040", 481 | "usb-device", 482 | "usbd-serial", 483 | ] 484 | 485 | [[package]] 486 | name = "rustc_version" 487 | version = "0.2.3" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 490 | dependencies = [ 491 | "semver 0.9.0", 492 | ] 493 | 494 | [[package]] 495 | name = "rustc_version" 496 | version = "0.4.0" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 499 | dependencies = [ 500 | "semver 1.0.18", 501 | ] 502 | 503 | [[package]] 504 | name = "scopeguard" 505 | version = "1.2.0" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 508 | 509 | [[package]] 510 | name = "semver" 511 | version = "0.9.0" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 514 | dependencies = [ 515 | "semver-parser", 516 | ] 517 | 518 | [[package]] 519 | name = "semver" 520 | version = "1.0.18" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" 523 | 524 | [[package]] 525 | name = "semver-parser" 526 | version = "0.7.0" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 529 | 530 | [[package]] 531 | name = "spin" 532 | version = "0.9.8" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 535 | dependencies = [ 536 | "lock_api", 537 | ] 538 | 539 | [[package]] 540 | name = "stable_deref_trait" 541 | version = "1.2.0" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 544 | 545 | [[package]] 546 | name = "syn" 547 | version = "1.0.109" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 550 | dependencies = [ 551 | "proc-macro2", 552 | "quote", 553 | "unicode-ident", 554 | ] 555 | 556 | [[package]] 557 | name = "unicode-ident" 558 | version = "1.0.11" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" 561 | 562 | [[package]] 563 | name = "usb-device" 564 | version = "0.2.9" 565 | source = "registry+https://github.com/rust-lang/crates.io-index" 566 | checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" 567 | 568 | [[package]] 569 | name = "usbd-serial" 570 | version = "0.1.1" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" 573 | dependencies = [ 574 | "embedded-hal", 575 | "nb 0.1.3", 576 | "usb-device", 577 | ] 578 | 579 | [[package]] 580 | name = "vcell" 581 | version = "0.1.3" 582 | source = "registry+https://github.com/rust-lang/crates.io-index" 583 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 584 | 585 | [[package]] 586 | name = "version_check" 587 | version = "0.9.4" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 590 | 591 | [[package]] 592 | name = "void" 593 | version = "1.0.2" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 596 | 597 | [[package]] 598 | name = "volatile-register" 599 | version = "0.2.1" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" 602 | dependencies = [ 603 | "vcell", 604 | ] 605 | -------------------------------------------------------------------------------- /rust-dap-rp2040/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "arrayvec" 7 | version = "0.7.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 10 | 11 | [[package]] 12 | name = "atomic-polyfill" 13 | version = "0.1.11" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" 16 | dependencies = [ 17 | "critical-section", 18 | ] 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.1.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 25 | 26 | [[package]] 27 | name = "bare-metal" 28 | version = "0.2.5" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 31 | dependencies = [ 32 | "rustc_version 0.2.3", 33 | ] 34 | 35 | [[package]] 36 | name = "bare-metal" 37 | version = "1.0.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" 40 | 41 | [[package]] 42 | name = "bitfield" 43 | version = "0.13.2" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 46 | 47 | [[package]] 48 | name = "bitflags" 49 | version = "1.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 52 | 53 | [[package]] 54 | name = "bitvec" 55 | version = "1.0.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" 58 | dependencies = [ 59 | "funty", 60 | "radium", 61 | "tap", 62 | "wyz", 63 | ] 64 | 65 | [[package]] 66 | name = "byteorder" 67 | version = "1.4.3" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 70 | 71 | [[package]] 72 | name = "cortex-m" 73 | version = "0.7.7" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 76 | dependencies = [ 77 | "bare-metal 0.2.5", 78 | "bitfield", 79 | "embedded-hal", 80 | "volatile-register", 81 | ] 82 | 83 | [[package]] 84 | name = "cortex-m-rt" 85 | version = "0.7.3" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" 88 | dependencies = [ 89 | "cortex-m-rt-macros", 90 | ] 91 | 92 | [[package]] 93 | name = "cortex-m-rt-macros" 94 | version = "0.7.0" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" 97 | dependencies = [ 98 | "proc-macro2", 99 | "quote", 100 | "syn 1.0.109", 101 | ] 102 | 103 | [[package]] 104 | name = "cortex-m-rtic" 105 | version = "1.1.4" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "d696ae7390bdb9f7978f71ca7144256a2c4616240a6df9002da3c451f9fc8f02" 108 | dependencies = [ 109 | "bare-metal 1.0.0", 110 | "cortex-m", 111 | "cortex-m-rtic-macros", 112 | "heapless", 113 | "rtic-core", 114 | "rtic-monotonic", 115 | "version_check", 116 | ] 117 | 118 | [[package]] 119 | name = "cortex-m-rtic-macros" 120 | version = "1.1.6" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "eefb40b1ca901c759d29526e5c8a0a1b246c20caaa5b4cc5d0f0b94debecd4c7" 123 | dependencies = [ 124 | "proc-macro-error", 125 | "proc-macro2", 126 | "quote", 127 | "rtic-syntax", 128 | "syn 1.0.109", 129 | ] 130 | 131 | [[package]] 132 | name = "crc-any" 133 | version = "2.4.3" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df" 136 | dependencies = [ 137 | "debug-helper", 138 | ] 139 | 140 | [[package]] 141 | name = "critical-section" 142 | version = "1.1.2" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 145 | 146 | [[package]] 147 | name = "debug-helper" 148 | version = "0.3.13" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" 151 | 152 | [[package]] 153 | name = "defmt" 154 | version = "0.3.5" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" 157 | dependencies = [ 158 | "bitflags", 159 | "defmt-macros", 160 | ] 161 | 162 | [[package]] 163 | name = "defmt-macros" 164 | version = "0.3.6" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" 167 | dependencies = [ 168 | "defmt-parser", 169 | "proc-macro-error", 170 | "proc-macro2", 171 | "quote", 172 | "syn 2.0.32", 173 | ] 174 | 175 | [[package]] 176 | name = "defmt-parser" 177 | version = "0.3.3" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" 180 | dependencies = [ 181 | "thiserror", 182 | ] 183 | 184 | [[package]] 185 | name = "either" 186 | version = "1.9.0" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 189 | 190 | [[package]] 191 | name = "embedded-dma" 192 | version = "0.2.0" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 195 | dependencies = [ 196 | "stable_deref_trait", 197 | ] 198 | 199 | [[package]] 200 | name = "embedded-hal" 201 | version = "0.2.7" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 204 | dependencies = [ 205 | "nb 0.1.3", 206 | "void", 207 | ] 208 | 209 | [[package]] 210 | name = "fugit" 211 | version = "0.3.7" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" 214 | dependencies = [ 215 | "gcd", 216 | ] 217 | 218 | [[package]] 219 | name = "funty" 220 | version = "2.0.0" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" 223 | 224 | [[package]] 225 | name = "gcd" 226 | version = "2.3.0" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" 229 | 230 | [[package]] 231 | name = "hash32" 232 | version = "0.2.1" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 235 | dependencies = [ 236 | "byteorder", 237 | ] 238 | 239 | [[package]] 240 | name = "hashbrown" 241 | version = "0.12.3" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 244 | 245 | [[package]] 246 | name = "heapless" 247 | version = "0.7.16" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 250 | dependencies = [ 251 | "atomic-polyfill", 252 | "hash32", 253 | "rustc_version 0.4.0", 254 | "spin", 255 | "stable_deref_trait", 256 | ] 257 | 258 | [[package]] 259 | name = "indexmap" 260 | version = "1.9.3" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 263 | dependencies = [ 264 | "autocfg", 265 | "hashbrown", 266 | ] 267 | 268 | [[package]] 269 | name = "itertools" 270 | version = "0.10.5" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" 273 | dependencies = [ 274 | "either", 275 | ] 276 | 277 | [[package]] 278 | name = "lock_api" 279 | version = "0.4.10" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" 282 | dependencies = [ 283 | "autocfg", 284 | "scopeguard", 285 | ] 286 | 287 | [[package]] 288 | name = "nb" 289 | version = "0.1.3" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 292 | dependencies = [ 293 | "nb 1.1.0", 294 | ] 295 | 296 | [[package]] 297 | name = "nb" 298 | version = "1.1.0" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 301 | 302 | [[package]] 303 | name = "num_enum" 304 | version = "0.5.11" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" 307 | dependencies = [ 308 | "num_enum_derive", 309 | ] 310 | 311 | [[package]] 312 | name = "num_enum_derive" 313 | version = "0.5.11" 314 | source = "registry+https://github.com/rust-lang/crates.io-index" 315 | checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" 316 | dependencies = [ 317 | "proc-macro2", 318 | "quote", 319 | "syn 1.0.109", 320 | ] 321 | 322 | [[package]] 323 | name = "panic-halt" 324 | version = "0.2.0" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 327 | 328 | [[package]] 329 | name = "paste" 330 | version = "1.0.14" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 333 | 334 | [[package]] 335 | name = "pio" 336 | version = "0.2.1" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" 339 | dependencies = [ 340 | "arrayvec", 341 | "num_enum", 342 | "paste", 343 | ] 344 | 345 | [[package]] 346 | name = "proc-macro-error" 347 | version = "1.0.4" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 350 | dependencies = [ 351 | "proc-macro-error-attr", 352 | "proc-macro2", 353 | "quote", 354 | "syn 1.0.109", 355 | "version_check", 356 | ] 357 | 358 | [[package]] 359 | name = "proc-macro-error-attr" 360 | version = "1.0.4" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 363 | dependencies = [ 364 | "proc-macro2", 365 | "quote", 366 | "version_check", 367 | ] 368 | 369 | [[package]] 370 | name = "proc-macro2" 371 | version = "1.0.66" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" 374 | dependencies = [ 375 | "unicode-ident", 376 | ] 377 | 378 | [[package]] 379 | name = "quote" 380 | version = "1.0.33" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 383 | dependencies = [ 384 | "proc-macro2", 385 | ] 386 | 387 | [[package]] 388 | name = "radium" 389 | version = "0.7.0" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" 392 | 393 | [[package]] 394 | name = "rand_core" 395 | version = "0.6.4" 396 | source = "registry+https://github.com/rust-lang/crates.io-index" 397 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 398 | 399 | [[package]] 400 | name = "rp2040-boot2" 401 | version = "0.2.1" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | checksum = "3c773ec49b836077aa144b58dc7654a243e1eecdb6cf0d25361ae7c7600fabd8" 404 | dependencies = [ 405 | "crc-any", 406 | ] 407 | 408 | [[package]] 409 | name = "rp2040-hal" 410 | version = "0.8.2" 411 | source = "registry+https://github.com/rust-lang/crates.io-index" 412 | checksum = "1369bb84862d7f69391a96606b2f29a00bfce7f29a749e23d5f01fc3f607ada0" 413 | dependencies = [ 414 | "cortex-m", 415 | "critical-section", 416 | "embedded-dma", 417 | "embedded-hal", 418 | "fugit", 419 | "itertools", 420 | "nb 1.1.0", 421 | "paste", 422 | "pio", 423 | "rand_core", 424 | "rp2040-hal-macros", 425 | "rp2040-pac", 426 | "usb-device", 427 | "vcell", 428 | "void", 429 | ] 430 | 431 | [[package]] 432 | name = "rp2040-hal-macros" 433 | version = "0.1.0" 434 | source = "registry+https://github.com/rust-lang/crates.io-index" 435 | checksum = "86479063e497efe1ae81995ef9071f54fd1c7427e04d6c5b84cde545ff672a5e" 436 | dependencies = [ 437 | "cortex-m-rt", 438 | "proc-macro2", 439 | "quote", 440 | "syn 1.0.109", 441 | ] 442 | 443 | [[package]] 444 | name = "rp2040-pac" 445 | version = "0.4.0" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "9192cafbb40d717c9e0ddf767aaf9c69fee1b4e48d22ed853b57b11f6d9f3d7e" 448 | dependencies = [ 449 | "cortex-m", 450 | "vcell", 451 | ] 452 | 453 | [[package]] 454 | name = "rtic-core" 455 | version = "1.0.0" 456 | source = "registry+https://github.com/rust-lang/crates.io-index" 457 | checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" 458 | 459 | [[package]] 460 | name = "rtic-monotonic" 461 | version = "1.0.0" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" 464 | 465 | [[package]] 466 | name = "rtic-syntax" 467 | version = "1.0.3" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "5f5e215601dc467752c2bddc6284a622c6f3d2bab569d992adcd5ab7e4cb9478" 470 | dependencies = [ 471 | "indexmap", 472 | "proc-macro2", 473 | "quote", 474 | "syn 1.0.109", 475 | ] 476 | 477 | [[package]] 478 | name = "rust-dap" 479 | version = "0.2.0" 480 | dependencies = [ 481 | "bitflags", 482 | "bitvec", 483 | "embedded-hal", 484 | "heapless", 485 | "nb 0.1.3", 486 | "num_enum", 487 | "usb-device", 488 | ] 489 | 490 | [[package]] 491 | name = "rust-dap-rp2040" 492 | version = "0.2.0" 493 | dependencies = [ 494 | "bitvec", 495 | "cortex-m", 496 | "cortex-m-rt", 497 | "cortex-m-rtic", 498 | "defmt", 499 | "embedded-hal", 500 | "fugit", 501 | "heapless", 502 | "nb 0.1.3", 503 | "panic-halt", 504 | "pio", 505 | "rp2040-boot2", 506 | "rp2040-hal", 507 | "rust-dap", 508 | "usb-device", 509 | "usbd-serial", 510 | ] 511 | 512 | [[package]] 513 | name = "rustc_version" 514 | version = "0.2.3" 515 | source = "registry+https://github.com/rust-lang/crates.io-index" 516 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 517 | dependencies = [ 518 | "semver 0.9.0", 519 | ] 520 | 521 | [[package]] 522 | name = "rustc_version" 523 | version = "0.4.0" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 526 | dependencies = [ 527 | "semver 1.0.18", 528 | ] 529 | 530 | [[package]] 531 | name = "scopeguard" 532 | version = "1.2.0" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 535 | 536 | [[package]] 537 | name = "semver" 538 | version = "0.9.0" 539 | source = "registry+https://github.com/rust-lang/crates.io-index" 540 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 541 | dependencies = [ 542 | "semver-parser", 543 | ] 544 | 545 | [[package]] 546 | name = "semver" 547 | version = "1.0.18" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" 550 | 551 | [[package]] 552 | name = "semver-parser" 553 | version = "0.7.0" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 556 | 557 | [[package]] 558 | name = "spin" 559 | version = "0.9.8" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 562 | dependencies = [ 563 | "lock_api", 564 | ] 565 | 566 | [[package]] 567 | name = "stable_deref_trait" 568 | version = "1.2.0" 569 | source = "registry+https://github.com/rust-lang/crates.io-index" 570 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 571 | 572 | [[package]] 573 | name = "syn" 574 | version = "1.0.109" 575 | source = "registry+https://github.com/rust-lang/crates.io-index" 576 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 577 | dependencies = [ 578 | "proc-macro2", 579 | "quote", 580 | "unicode-ident", 581 | ] 582 | 583 | [[package]] 584 | name = "syn" 585 | version = "2.0.32" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" 588 | dependencies = [ 589 | "proc-macro2", 590 | "quote", 591 | "unicode-ident", 592 | ] 593 | 594 | [[package]] 595 | name = "tap" 596 | version = "1.0.1" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 599 | 600 | [[package]] 601 | name = "thiserror" 602 | version = "1.0.49" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" 605 | dependencies = [ 606 | "thiserror-impl", 607 | ] 608 | 609 | [[package]] 610 | name = "thiserror-impl" 611 | version = "1.0.49" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" 614 | dependencies = [ 615 | "proc-macro2", 616 | "quote", 617 | "syn 2.0.32", 618 | ] 619 | 620 | [[package]] 621 | name = "unicode-ident" 622 | version = "1.0.11" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" 625 | 626 | [[package]] 627 | name = "usb-device" 628 | version = "0.2.9" 629 | source = "registry+https://github.com/rust-lang/crates.io-index" 630 | checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" 631 | 632 | [[package]] 633 | name = "usbd-serial" 634 | version = "0.1.1" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" 637 | dependencies = [ 638 | "embedded-hal", 639 | "nb 0.1.3", 640 | "usb-device", 641 | ] 642 | 643 | [[package]] 644 | name = "vcell" 645 | version = "0.1.3" 646 | source = "registry+https://github.com/rust-lang/crates.io-index" 647 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 648 | 649 | [[package]] 650 | name = "version_check" 651 | version = "0.9.4" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 654 | 655 | [[package]] 656 | name = "void" 657 | version = "1.0.2" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 660 | 661 | [[package]] 662 | name = "volatile-register" 663 | version = "0.2.1" 664 | source = "registry+https://github.com/rust-lang/crates.io-index" 665 | checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" 666 | dependencies = [ 667 | "vcell", 668 | ] 669 | 670 | [[package]] 671 | name = "wyz" 672 | version = "0.5.1" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" 675 | dependencies = [ 676 | "tap", 677 | ] 678 | -------------------------------------------------------------------------------- /boards/rpi_pico/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2022 Kenta Ida 2 | // 3 | // SPDX-License-Identifier: Apache-2.0 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | 17 | #![no_std] 18 | #![no_main] 19 | 20 | #[rtic::app(device = rp_pico::hal::pac, peripherals = true)] 21 | mod app { 22 | #[cfg(not(feature = "defmt"))] 23 | use panic_halt as _; 24 | #[cfg(feature = "defmt")] 25 | use {defmt_rtt as _, panic_probe as _}; 26 | 27 | use hal::clocks::Clock; 28 | use hal::gpio::{Output, Pin, PushPull}; 29 | use hal::pac; 30 | use rp_pico::hal; 31 | 32 | use hal::usb::UsbBus; 33 | use usb_device::bus::UsbBusAllocator; 34 | 35 | use rust_dap::{CmsisDap, DapCapabilities}; 36 | use usb_device::prelude::*; 37 | use usbd_serial::SerialPort; 38 | 39 | use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin}; 40 | use embedded_hal::serial::{Read, Write}; 41 | 42 | use rust_dap_rp2040::line_coding::*; 43 | use rust_dap_rp2040::util::{ 44 | initialize_usb, read_usb_serial_byte_cs, write_usb_serial_byte_cs, UartConfigAndClock, 45 | }; 46 | #[cfg(all(feature = "swd", feature = "bitbang"))] 47 | type SwdIoSet = rust_dap_rp2040::util::SwdIoSet; 48 | #[cfg(all(feature = "swd", not(feature = "bitbang")))] 49 | type SwdIoSet = rust_dap_rp2040::util::SwdIoSet; 50 | #[cfg(feature = "jtag")] 51 | type JtagIoSet = rust_dap_rp2040::util::JtagIoSet< 52 | JtagTckPin, 53 | JtagTmsPin, 54 | JtagTdiPin, 55 | JtagTdoPin, 56 | JtagTrstPin, 57 | JtagResetPin, 58 | >; 59 | #[cfg(feature = "swd")] 60 | type IoSet = SwdIoSet; 61 | #[cfg(feature = "jtag")] 62 | type IoSet = JtagIoSet; 63 | 64 | // GPIO mappings 65 | type GpioUartTx = hal::gpio::bank0::Gpio0; 66 | type GpioUartRx = hal::gpio::bank0::Gpio1; 67 | type GpioUsbLed = hal::gpio::bank0::Gpio25; 68 | type GpioIdleLed = hal::gpio::bank0::Gpio17; 69 | type GpioDebugOut = hal::gpio::bank0::Gpio15; 70 | type GpioDebugIrqOut = hal::gpio::bank0::Gpio28; 71 | type GpioDebugUsbIrqOut = hal::gpio::bank0::Gpio27; 72 | // swd 73 | #[cfg(feature = "swd")] 74 | type GpioSwClk = hal::gpio::bank0::Gpio2; 75 | #[cfg(feature = "swd")] 76 | type GpioSwdIo = hal::gpio::bank0::Gpio3; 77 | #[cfg(feature = "swd")] 78 | type GpioReset = hal::gpio::bank0::Gpio4; 79 | // jtag 80 | #[cfg(feature = "jtag")] 81 | type JtagTckPin = hal::gpio::bank0::Gpio2; 82 | #[cfg(feature = "jtag")] 83 | type JtagTmsPin = hal::gpio::bank0::Gpio3; 84 | #[cfg(feature = "jtag")] 85 | type JtagTdoPin = hal::gpio::bank0::Gpio5; 86 | #[cfg(feature = "jtag")] 87 | type JtagTdiPin = hal::gpio::bank0::Gpio6; 88 | #[cfg(feature = "jtag")] 89 | type JtagTrstPin = hal::gpio::bank0::Gpio7; 90 | #[cfg(feature = "jtag")] 91 | type JtagResetPin = hal::gpio::bank0::Gpio4; 92 | 93 | // UART Interrupt context 94 | const UART_RX_QUEUE_SIZE: usize = 256; 95 | const UART_TX_QUEUE_SIZE: usize = 128; 96 | // UART Shared context 97 | type UartPins = ( 98 | hal::gpio::Pin>, 99 | hal::gpio::Pin>, 100 | ); 101 | type Uart = hal::uart::UartPeripheral; 102 | pub struct UartReader(hal::uart::Reader); 103 | pub struct UartWriter(hal::uart::Writer); 104 | unsafe impl Sync for UartReader {} 105 | unsafe impl Sync for UartWriter {} 106 | unsafe impl Send for UartReader {} 107 | unsafe impl Send for UartWriter {} 108 | 109 | #[shared] 110 | struct Shared { 111 | uart_reader: Option, 112 | uart_writer: Option, 113 | usb_serial: SerialPort<'static, UsbBus>, 114 | uart_rx_consumer: heapless::spsc::Consumer<'static, u8, UART_RX_QUEUE_SIZE>, 115 | uart_tx_producer: heapless::spsc::Producer<'static, u8, UART_TX_QUEUE_SIZE>, 116 | uart_tx_consumer: heapless::spsc::Consumer<'static, u8, UART_TX_QUEUE_SIZE>, 117 | } 118 | 119 | #[local] 120 | struct Local { 121 | uart_config: UartConfigAndClock, 122 | uart_rx_producer: heapless::spsc::Producer<'static, u8, UART_RX_QUEUE_SIZE>, 123 | usb_bus: UsbDevice<'static, UsbBus>, 124 | usb_dap: CmsisDap<'static, UsbBus, IoSet, 64>, 125 | usb_led: Pin>, 126 | idle_led: Pin>, 127 | debug_out: Pin>, 128 | debug_irq_out: Pin>, 129 | debug_usb_irq_out: Pin>, 130 | } 131 | 132 | #[init(local = [ 133 | uart_rx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), 134 | uart_tx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), 135 | USB_ALLOCATOR: Option> = None, 136 | ])] 137 | fn init(c: init::Context) -> (Shared, Local, init::Monotonics) { 138 | let mut resets = c.device.RESETS; 139 | let sio = hal::Sio::new(c.device.SIO); 140 | let pins = rp_pico::Pins::new( 141 | c.device.IO_BANK0, 142 | c.device.PADS_BANK0, 143 | sio.gpio_bank0, 144 | &mut resets, 145 | ); 146 | 147 | let mut watchdog = hal::Watchdog::new(c.device.WATCHDOG); 148 | let clocks = hal::clocks::init_clocks_and_plls( 149 | rp_pico::XOSC_CRYSTAL_FREQ, 150 | c.device.XOSC, 151 | c.device.CLOCKS, 152 | c.device.PLL_SYS, 153 | c.device.PLL_USB, 154 | &mut resets, 155 | &mut watchdog, 156 | ) 157 | .ok() 158 | .unwrap(); 159 | 160 | let uart_pins = ( 161 | pins.gpio0.into_mode::(), // TxD 162 | pins.gpio1.into_mode::(), // RxD 163 | ); 164 | let uart_config = UartConfigAndClock { 165 | config: UartConfig::from(hal::uart::UartConfig::default()), 166 | clock: clocks.peripheral_clock.freq(), 167 | }; 168 | let mut uart = hal::uart::UartPeripheral::new(c.device.UART0, uart_pins, &mut resets) 169 | .enable((&uart_config.config).into(), uart_config.clock) 170 | .unwrap(); 171 | // Enable RX interrupt. Note that TX interrupt is enabled when some TX data is available. 172 | uart.enable_rx_interrupt(); 173 | let (uart_reader, uart_writer) = uart.split(); 174 | let uart_reader = Some(UartReader(uart_reader)); 175 | let uart_writer = Some(UartWriter(uart_writer)); 176 | 177 | let usb_allocator = UsbBusAllocator::new(hal::usb::UsbBus::new( 178 | c.device.USBCTRL_REGS, 179 | c.device.USBCTRL_DPRAM, 180 | clocks.usb_clock, 181 | true, 182 | &mut resets, 183 | )); 184 | c.local.USB_ALLOCATOR.replace(usb_allocator); 185 | let usb_allocator = c.local.USB_ALLOCATOR.as_ref().unwrap(); 186 | #[cfg(feature = "swd")] 187 | let (usb_serial, usb_dap, usb_bus) = { 188 | // Initialize MCU reset pin. 189 | // RESET pin of Cortex Debug 10-pin connector is negative logic 190 | // https://developer.arm.com/documentation/101453/0100/CoreSight-Technology/Connectors 191 | let reset_pin = pins.gpio4.into_floating_input(); 192 | 193 | let swdio; 194 | #[cfg(feature = "bitbang")] 195 | { 196 | use rust_dap_rp2040::{swdio_pin::PicoSwdInputPin, util::CycleDelay}; 197 | let swclk_pin = PicoSwdInputPin::new(pins.gpio2.into_floating_input()); 198 | let swdio_pin = PicoSwdInputPin::new(pins.gpio3.into_floating_input()); 199 | let reset_pin = PicoSwdInputPin::new(reset_pin); 200 | swdio = SwdIoSet::new(swclk_pin, swdio_pin, reset_pin, CycleDelay {}); 201 | } 202 | #[cfg(not(feature = "bitbang"))] 203 | { 204 | let mut swclk_pin = pins.gpio2.into_mode(); 205 | let mut swdio_pin = pins.gpio3.into_mode(); 206 | let mut reset_pin = reset_pin.into_mode(); 207 | swclk_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 208 | swdio_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 209 | reset_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 210 | 211 | swdio = SwdIoSet::new(c.device.PIO0, swclk_pin, swdio_pin, reset_pin, &mut resets); 212 | } 213 | initialize_usb( 214 | swdio, 215 | usb_allocator, 216 | "raspberry-pi-pico-swd", 217 | DapCapabilities::SWD, 218 | ) 219 | }; 220 | 221 | #[cfg(feature = "jtag")] 222 | let (usb_serial, usb_dap, usb_bus) = { 223 | let jtagio; 224 | #[cfg(feature = "bitbang")] 225 | { 226 | use rust_dap_rp2040::{swdio_pin::PicoSwdInputPin, util::CycleDelay}; 227 | let tck_pin = PicoSwdInputPin::new(pins.gpio2.into_floating_input()); 228 | let tms_pin = PicoSwdInputPin::new(pins.gpio3.into_floating_input()); 229 | let tdo_pin = PicoSwdInputPin::new(pins.gpio5.into_floating_input()); 230 | let tdi_pin = PicoSwdInputPin::new(pins.gpio6.into_floating_input()); 231 | let trst_pin = PicoSwdInputPin::new(pins.gpio7.into_floating_input()); 232 | let srst_pin = PicoSwdInputPin::new(pins.gpio4.into_floating_input()); 233 | jtagio = JtagIoSet::new( 234 | tck_pin, 235 | tms_pin, 236 | tdi_pin, 237 | tdo_pin, 238 | trst_pin, 239 | srst_pin, 240 | CycleDelay {}, 241 | ) 242 | }; 243 | #[cfg(not(feature = "bitbang"))] 244 | { 245 | // PIO 246 | let mut tck_pin = pins.gpio2.into_mode(); 247 | let mut tms_pin = pins.gpio3.into_mode(); 248 | let mut tdo_pin = pins.gpio5.into_mode(); 249 | let mut tdi_pin = pins.gpio6.into_mode(); 250 | let mut trst_pin = pins.gpio7.into_mode(); 251 | let mut srst_pin = pins.gpio4.into_mode(); 252 | tck_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 253 | tms_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 254 | tdo_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 255 | tdi_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 256 | trst_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 257 | srst_pin.set_slew_rate(hal::gpio::OutputSlewRate::Fast); 258 | jtagio = JtagIoSet::new( 259 | c.device.PIO0, 260 | tck_pin, 261 | tms_pin, 262 | tdi_pin, 263 | tdo_pin, 264 | Some(trst_pin), 265 | Some(srst_pin), 266 | &mut resets, 267 | ) 268 | }; 269 | initialize_usb( 270 | jtagio, 271 | usb_allocator, 272 | "raspberry-pi-pico-jtag", 273 | DapCapabilities::JTAG, 274 | ) 275 | }; 276 | 277 | let usb_led = pins.led.into_push_pull_output(); 278 | let (uart_rx_producer, uart_rx_consumer) = c.local.uart_rx_queue.split(); 279 | let (uart_tx_producer, uart_tx_consumer) = c.local.uart_tx_queue.split(); 280 | 281 | let mut debug_out = pins.gpio15.into_push_pull_output(); 282 | debug_out.set_low().ok(); 283 | let mut debug_irq_out = pins.gpio28.into_push_pull_output(); 284 | debug_irq_out.set_low().ok(); 285 | let mut debug_usb_irq_out = pins.gpio27.into_push_pull_output(); 286 | debug_usb_irq_out.set_low().ok(); 287 | 288 | pins.gpio16.into_push_pull_output().set_high().ok(); 289 | let mut idle_led = pins.gpio17.into_push_pull_output(); 290 | idle_led.set_high().ok(); 291 | ( 292 | Shared { 293 | uart_reader, 294 | uart_writer, 295 | usb_serial, 296 | uart_rx_consumer, 297 | uart_tx_producer, 298 | uart_tx_consumer, 299 | }, 300 | Local { 301 | uart_config, 302 | uart_rx_producer, 303 | usb_bus, 304 | usb_dap, 305 | usb_led, 306 | idle_led, 307 | debug_out, 308 | debug_irq_out, 309 | debug_usb_irq_out, 310 | }, 311 | init::Monotonics(), 312 | ) 313 | } 314 | 315 | #[idle(shared = [uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], local = [idle_led])] 316 | fn idle(mut c: idle::Context) -> ! { 317 | loop { 318 | (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( 319 | |usb_serial, uart_tx_producer| { 320 | while uart_tx_producer.ready() { 321 | if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { 322 | uart_tx_producer.enqueue(data).unwrap(); 323 | } else { 324 | break; 325 | } 326 | } 327 | }, 328 | ); 329 | (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( 330 | |uart, uart_tx_consumer| { 331 | let uart = uart.as_mut().unwrap(); 332 | while let Some(data) = uart_tx_consumer.peek() { 333 | if uart.0.write(*data).is_ok() { 334 | uart_tx_consumer.dequeue().unwrap(); 335 | } else { 336 | break; 337 | } 338 | } 339 | }, 340 | ); 341 | 342 | // Process RX data. 343 | (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( 344 | |usb_serial, uart_rx_consumer| { 345 | while let Some(data) = uart_rx_consumer.peek() { 346 | match write_usb_serial_byte_cs(usb_serial, *data) { 347 | Ok(_) => { 348 | let _ = uart_rx_consumer.dequeue().unwrap(); 349 | } 350 | _ => break, 351 | } 352 | } 353 | usb_serial.flush().ok(); 354 | }, 355 | ); 356 | 357 | c.local.idle_led.toggle().ok(); 358 | } 359 | } 360 | 361 | #[task( 362 | binds = UART0_IRQ, 363 | priority = 1, 364 | shared = [uart_reader], 365 | local = [uart_rx_producer, debug_out, debug_irq_out], 366 | )] 367 | fn uart_irq(mut c: uart_irq::Context) { 368 | c.local.debug_irq_out.set_high().ok(); 369 | while c.local.uart_rx_producer.ready() { 370 | if let Ok(data) = c 371 | .shared 372 | .uart_reader 373 | .lock(|uart| uart.as_mut().unwrap().0.read()) 374 | { 375 | c.local.debug_out.toggle().ok(); 376 | let _ = c.local.uart_rx_producer.enqueue(data).ok(); // Enqueuing must not fail because we have already checked that the queue is ready to enqueue. 377 | } else { 378 | break; 379 | } 380 | } 381 | c.local.debug_irq_out.set_low().ok(); 382 | } 383 | 384 | #[task( 385 | binds = USBCTRL_IRQ, 386 | priority = 2, // USBCTRL_IRQ priority must be greater than or equal to UART0_IRQ not to hang up the UART when UART FIFO is full. 387 | shared = [uart_reader, uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], 388 | local = [usb_bus, usb_dap, uart_config, usb_led, debug_usb_irq_out], 389 | )] 390 | fn usbctrl_irq(mut c: usbctrl_irq::Context) { 391 | c.local.debug_usb_irq_out.set_high().ok(); 392 | 393 | let poll_result = c 394 | .shared 395 | .usb_serial 396 | .lock(|usb_serial| c.local.usb_bus.poll(&mut [usb_serial, c.local.usb_dap])); 397 | if !poll_result { 398 | c.local.debug_usb_irq_out.set_low().ok(); 399 | return; // Nothing to do at this time... 400 | } 401 | // Process DAP commands. 402 | c.local.usb_dap.process().ok(); 403 | 404 | // Process TX data. 405 | (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( 406 | |usb_serial, uart_tx_producer| { 407 | while uart_tx_producer.ready() { 408 | if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { 409 | uart_tx_producer.enqueue(data).unwrap(); 410 | } else { 411 | break; 412 | } 413 | } 414 | }, 415 | ); 416 | (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( 417 | |uart, uart_tx_consumer| { 418 | let uart = uart.as_mut().unwrap(); 419 | while let Some(data) = uart_tx_consumer.peek() { 420 | if uart.0.write(*data).is_ok() { 421 | uart_tx_consumer.dequeue().unwrap(); 422 | } else { 423 | break; 424 | } 425 | } 426 | }, 427 | ); 428 | 429 | // Process RX data. 430 | (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( 431 | |usb_serial, uart_rx_consumer| { 432 | while let Some(data) = uart_rx_consumer.peek() { 433 | match write_usb_serial_byte_cs(usb_serial, *data) { 434 | Ok(_) => { 435 | let _ = uart_rx_consumer.dequeue().unwrap(); 436 | } 437 | _ => break, 438 | } 439 | } 440 | usb_serial.flush().ok(); 441 | }, 442 | ); 443 | 444 | // Check if the UART transmitter must be re-configured. 445 | if let Ok(expected_config) = c 446 | .shared 447 | .usb_serial 448 | .lock(|usb_serial| UartConfig::try_from(usb_serial.line_coding())) 449 | { 450 | let config = c.local.uart_config.config; 451 | if expected_config != config { 452 | (&mut c.shared.uart_reader, &mut c.shared.uart_writer).lock(|reader, writer| { 453 | reader.as_mut().unwrap().0.disable_rx_interrupt(); 454 | let disabled = 455 | Uart::join(reader.take().unwrap().0, writer.take().unwrap().0).disable(); 456 | let enabled = disabled 457 | .enable((&expected_config).into(), c.local.uart_config.clock) 458 | .unwrap(); 459 | c.local.uart_config.config = expected_config; 460 | let (new_reader, new_writer) = enabled.split(); 461 | reader.replace(UartReader(new_reader)); 462 | writer.replace(UartWriter(new_writer)); 463 | reader.as_mut().unwrap().0.enable_rx_interrupt(); 464 | }); 465 | } 466 | } 467 | 468 | c.local.usb_led.toggle().ok(); 469 | c.local.debug_usb_irq_out.set_low().ok(); 470 | } 471 | } 472 | -------------------------------------------------------------------------------- /boards/rpi_pico/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "arrayvec" 7 | version = "0.7.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" 10 | 11 | [[package]] 12 | name = "atomic-polyfill" 13 | version = "0.1.11" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" 16 | dependencies = [ 17 | "critical-section", 18 | ] 19 | 20 | [[package]] 21 | name = "autocfg" 22 | version = "1.1.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 25 | 26 | [[package]] 27 | name = "bare-metal" 28 | version = "0.2.5" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" 31 | dependencies = [ 32 | "rustc_version 0.2.3", 33 | ] 34 | 35 | [[package]] 36 | name = "bare-metal" 37 | version = "1.0.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" 40 | 41 | [[package]] 42 | name = "bitfield" 43 | version = "0.13.2" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" 46 | 47 | [[package]] 48 | name = "bitflags" 49 | version = "1.3.2" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 52 | 53 | [[package]] 54 | name = "bitvec" 55 | version = "1.0.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" 58 | dependencies = [ 59 | "funty", 60 | "radium", 61 | "tap", 62 | "wyz", 63 | ] 64 | 65 | [[package]] 66 | name = "byteorder" 67 | version = "1.4.3" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 70 | 71 | [[package]] 72 | name = "cortex-m" 73 | version = "0.7.7" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" 76 | dependencies = [ 77 | "bare-metal 0.2.5", 78 | "bitfield", 79 | "embedded-hal", 80 | "volatile-register", 81 | ] 82 | 83 | [[package]] 84 | name = "cortex-m-rt" 85 | version = "0.7.3" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" 88 | dependencies = [ 89 | "cortex-m-rt-macros", 90 | ] 91 | 92 | [[package]] 93 | name = "cortex-m-rt-macros" 94 | version = "0.7.0" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" 97 | dependencies = [ 98 | "proc-macro2", 99 | "quote", 100 | "syn 1.0.109", 101 | ] 102 | 103 | [[package]] 104 | name = "cortex-m-rtic" 105 | version = "1.1.4" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | checksum = "d696ae7390bdb9f7978f71ca7144256a2c4616240a6df9002da3c451f9fc8f02" 108 | dependencies = [ 109 | "bare-metal 1.0.0", 110 | "cortex-m", 111 | "cortex-m-rtic-macros", 112 | "heapless", 113 | "rtic-core", 114 | "rtic-monotonic", 115 | "version_check", 116 | ] 117 | 118 | [[package]] 119 | name = "cortex-m-rtic-macros" 120 | version = "1.1.6" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "eefb40b1ca901c759d29526e5c8a0a1b246c20caaa5b4cc5d0f0b94debecd4c7" 123 | dependencies = [ 124 | "proc-macro-error", 125 | "proc-macro2", 126 | "quote", 127 | "rtic-syntax", 128 | "syn 1.0.109", 129 | ] 130 | 131 | [[package]] 132 | name = "crc-any" 133 | version = "2.4.3" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "774646b687f63643eb0f4bf13dc263cb581c8c9e57973b6ddf78bda3994d88df" 136 | dependencies = [ 137 | "debug-helper", 138 | ] 139 | 140 | [[package]] 141 | name = "critical-section" 142 | version = "1.1.2" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 145 | 146 | [[package]] 147 | name = "debug-helper" 148 | version = "0.3.13" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e" 151 | 152 | [[package]] 153 | name = "defmt" 154 | version = "0.3.5" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "a8a2d011b2fee29fb7d659b83c43fce9a2cb4df453e16d441a51448e448f3f98" 157 | dependencies = [ 158 | "bitflags", 159 | "defmt-macros", 160 | ] 161 | 162 | [[package]] 163 | name = "defmt-macros" 164 | version = "0.3.6" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | checksum = "54f0216f6c5acb5ae1a47050a6645024e6edafc2ee32d421955eccfef12ef92e" 167 | dependencies = [ 168 | "defmt-parser", 169 | "proc-macro-error", 170 | "proc-macro2", 171 | "quote", 172 | "syn 2.0.32", 173 | ] 174 | 175 | [[package]] 176 | name = "defmt-parser" 177 | version = "0.3.3" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "269924c02afd7f94bc4cecbfa5c379f6ffcf9766b3408fe63d22c728654eccd0" 180 | dependencies = [ 181 | "thiserror", 182 | ] 183 | 184 | [[package]] 185 | name = "defmt-rtt" 186 | version = "0.4.0" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "609923761264dd99ed9c7d209718cda4631c5fe84668e0f0960124cbb844c49f" 189 | dependencies = [ 190 | "critical-section", 191 | "defmt", 192 | ] 193 | 194 | [[package]] 195 | name = "either" 196 | version = "1.9.0" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 199 | 200 | [[package]] 201 | name = "embedded-dma" 202 | version = "0.2.0" 203 | source = "registry+https://github.com/rust-lang/crates.io-index" 204 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 205 | dependencies = [ 206 | "stable_deref_trait", 207 | ] 208 | 209 | [[package]] 210 | name = "embedded-hal" 211 | version = "0.2.7" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 214 | dependencies = [ 215 | "nb 0.1.3", 216 | "void", 217 | ] 218 | 219 | [[package]] 220 | name = "fugit" 221 | version = "0.3.7" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" 224 | dependencies = [ 225 | "gcd", 226 | ] 227 | 228 | [[package]] 229 | name = "funty" 230 | version = "2.0.0" 231 | source = "registry+https://github.com/rust-lang/crates.io-index" 232 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" 233 | 234 | [[package]] 235 | name = "gcd" 236 | version = "2.3.0" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" 239 | 240 | [[package]] 241 | name = "hash32" 242 | version = "0.2.1" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" 245 | dependencies = [ 246 | "byteorder", 247 | ] 248 | 249 | [[package]] 250 | name = "hashbrown" 251 | version = "0.12.3" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 254 | 255 | [[package]] 256 | name = "heapless" 257 | version = "0.7.16" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" 260 | dependencies = [ 261 | "atomic-polyfill", 262 | "hash32", 263 | "rustc_version 0.4.0", 264 | "spin", 265 | "stable_deref_trait", 266 | ] 267 | 268 | [[package]] 269 | name = "indexmap" 270 | version = "1.9.3" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 273 | dependencies = [ 274 | "autocfg", 275 | "hashbrown", 276 | ] 277 | 278 | [[package]] 279 | name = "itertools" 280 | version = "0.10.5" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" 283 | dependencies = [ 284 | "either", 285 | ] 286 | 287 | [[package]] 288 | name = "lock_api" 289 | version = "0.4.10" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" 292 | dependencies = [ 293 | "autocfg", 294 | "scopeguard", 295 | ] 296 | 297 | [[package]] 298 | name = "nb" 299 | version = "0.1.3" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 302 | dependencies = [ 303 | "nb 1.1.0", 304 | ] 305 | 306 | [[package]] 307 | name = "nb" 308 | version = "1.1.0" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 311 | 312 | [[package]] 313 | name = "num_enum" 314 | version = "0.5.11" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" 317 | dependencies = [ 318 | "num_enum_derive", 319 | ] 320 | 321 | [[package]] 322 | name = "num_enum_derive" 323 | version = "0.5.11" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" 326 | dependencies = [ 327 | "proc-macro2", 328 | "quote", 329 | "syn 1.0.109", 330 | ] 331 | 332 | [[package]] 333 | name = "panic-halt" 334 | version = "0.2.0" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" 337 | 338 | [[package]] 339 | name = "panic-probe" 340 | version = "0.3.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "aa6fa5645ef5a760cd340eaa92af9c1ce131c8c09e7f8926d8a24b59d26652b9" 343 | dependencies = [ 344 | "cortex-m", 345 | "defmt", 346 | ] 347 | 348 | [[package]] 349 | name = "paste" 350 | version = "1.0.14" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 353 | 354 | [[package]] 355 | name = "pio" 356 | version = "0.2.1" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3" 359 | dependencies = [ 360 | "arrayvec", 361 | "num_enum", 362 | "paste", 363 | ] 364 | 365 | [[package]] 366 | name = "proc-macro-error" 367 | version = "1.0.4" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 370 | dependencies = [ 371 | "proc-macro-error-attr", 372 | "proc-macro2", 373 | "quote", 374 | "syn 1.0.109", 375 | "version_check", 376 | ] 377 | 378 | [[package]] 379 | name = "proc-macro-error-attr" 380 | version = "1.0.4" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 383 | dependencies = [ 384 | "proc-macro2", 385 | "quote", 386 | "version_check", 387 | ] 388 | 389 | [[package]] 390 | name = "proc-macro2" 391 | version = "1.0.66" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" 394 | dependencies = [ 395 | "unicode-ident", 396 | ] 397 | 398 | [[package]] 399 | name = "quote" 400 | version = "1.0.33" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 403 | dependencies = [ 404 | "proc-macro2", 405 | ] 406 | 407 | [[package]] 408 | name = "radium" 409 | version = "0.7.0" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" 412 | 413 | [[package]] 414 | name = "rand_core" 415 | version = "0.6.4" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 418 | 419 | [[package]] 420 | name = "rp-pico" 421 | version = "0.7.0" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "aab28f6f4e19cec2d61b64cdd685e69794b81c579fd3b765579c46018fe616d0" 424 | dependencies = [ 425 | "cortex-m", 426 | "cortex-m-rt", 427 | "fugit", 428 | "rp2040-hal", 429 | "usb-device", 430 | ] 431 | 432 | [[package]] 433 | name = "rp2040-boot2" 434 | version = "0.2.1" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "3c773ec49b836077aa144b58dc7654a243e1eecdb6cf0d25361ae7c7600fabd8" 437 | dependencies = [ 438 | "crc-any", 439 | ] 440 | 441 | [[package]] 442 | name = "rp2040-hal" 443 | version = "0.8.2" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "1369bb84862d7f69391a96606b2f29a00bfce7f29a749e23d5f01fc3f607ada0" 446 | dependencies = [ 447 | "cortex-m", 448 | "critical-section", 449 | "embedded-dma", 450 | "embedded-hal", 451 | "fugit", 452 | "itertools", 453 | "nb 1.1.0", 454 | "paste", 455 | "pio", 456 | "rand_core", 457 | "rp2040-hal-macros", 458 | "rp2040-pac", 459 | "usb-device", 460 | "vcell", 461 | "void", 462 | ] 463 | 464 | [[package]] 465 | name = "rp2040-hal-macros" 466 | version = "0.1.0" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | checksum = "86479063e497efe1ae81995ef9071f54fd1c7427e04d6c5b84cde545ff672a5e" 469 | dependencies = [ 470 | "cortex-m-rt", 471 | "proc-macro2", 472 | "quote", 473 | "syn 1.0.109", 474 | ] 475 | 476 | [[package]] 477 | name = "rp2040-pac" 478 | version = "0.4.0" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "9192cafbb40d717c9e0ddf767aaf9c69fee1b4e48d22ed853b57b11f6d9f3d7e" 481 | dependencies = [ 482 | "cortex-m", 483 | "cortex-m-rt", 484 | "vcell", 485 | ] 486 | 487 | [[package]] 488 | name = "rtic-core" 489 | version = "1.0.0" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" 492 | 493 | [[package]] 494 | name = "rtic-monotonic" 495 | version = "1.0.0" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" 498 | 499 | [[package]] 500 | name = "rtic-syntax" 501 | version = "1.0.3" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "5f5e215601dc467752c2bddc6284a622c6f3d2bab569d992adcd5ab7e4cb9478" 504 | dependencies = [ 505 | "indexmap", 506 | "proc-macro2", 507 | "quote", 508 | "syn 1.0.109", 509 | ] 510 | 511 | [[package]] 512 | name = "rust-dap" 513 | version = "0.2.0" 514 | dependencies = [ 515 | "bitflags", 516 | "bitvec", 517 | "defmt", 518 | "embedded-hal", 519 | "heapless", 520 | "nb 0.1.3", 521 | "num_enum", 522 | "usb-device", 523 | ] 524 | 525 | [[package]] 526 | name = "rust-dap-raspberrypi-pico" 527 | version = "0.2.0" 528 | dependencies = [ 529 | "cortex-m", 530 | "cortex-m-rt", 531 | "cortex-m-rtic", 532 | "defmt", 533 | "defmt-rtt", 534 | "embedded-hal", 535 | "heapless", 536 | "nb 0.1.3", 537 | "panic-halt", 538 | "panic-probe", 539 | "rp-pico", 540 | "rust-dap", 541 | "rust-dap-rp2040", 542 | "usb-device", 543 | "usbd-serial", 544 | ] 545 | 546 | [[package]] 547 | name = "rust-dap-rp2040" 548 | version = "0.2.0" 549 | dependencies = [ 550 | "bitvec", 551 | "cortex-m", 552 | "cortex-m-rt", 553 | "cortex-m-rtic", 554 | "defmt", 555 | "embedded-hal", 556 | "fugit", 557 | "heapless", 558 | "nb 0.1.3", 559 | "panic-halt", 560 | "pio", 561 | "rp2040-boot2", 562 | "rp2040-hal", 563 | "rust-dap", 564 | "usb-device", 565 | "usbd-serial", 566 | ] 567 | 568 | [[package]] 569 | name = "rustc_version" 570 | version = "0.2.3" 571 | source = "registry+https://github.com/rust-lang/crates.io-index" 572 | checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 573 | dependencies = [ 574 | "semver 0.9.0", 575 | ] 576 | 577 | [[package]] 578 | name = "rustc_version" 579 | version = "0.4.0" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 582 | dependencies = [ 583 | "semver 1.0.18", 584 | ] 585 | 586 | [[package]] 587 | name = "scopeguard" 588 | version = "1.2.0" 589 | source = "registry+https://github.com/rust-lang/crates.io-index" 590 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 591 | 592 | [[package]] 593 | name = "semver" 594 | version = "0.9.0" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 597 | dependencies = [ 598 | "semver-parser", 599 | ] 600 | 601 | [[package]] 602 | name = "semver" 603 | version = "1.0.18" 604 | source = "registry+https://github.com/rust-lang/crates.io-index" 605 | checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" 606 | 607 | [[package]] 608 | name = "semver-parser" 609 | version = "0.7.0" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 612 | 613 | [[package]] 614 | name = "spin" 615 | version = "0.9.8" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 618 | dependencies = [ 619 | "lock_api", 620 | ] 621 | 622 | [[package]] 623 | name = "stable_deref_trait" 624 | version = "1.2.0" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 627 | 628 | [[package]] 629 | name = "syn" 630 | version = "1.0.109" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 633 | dependencies = [ 634 | "proc-macro2", 635 | "quote", 636 | "unicode-ident", 637 | ] 638 | 639 | [[package]] 640 | name = "syn" 641 | version = "2.0.32" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" 644 | dependencies = [ 645 | "proc-macro2", 646 | "quote", 647 | "unicode-ident", 648 | ] 649 | 650 | [[package]] 651 | name = "tap" 652 | version = "1.0.1" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 655 | 656 | [[package]] 657 | name = "thiserror" 658 | version = "1.0.49" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" 661 | dependencies = [ 662 | "thiserror-impl", 663 | ] 664 | 665 | [[package]] 666 | name = "thiserror-impl" 667 | version = "1.0.49" 668 | source = "registry+https://github.com/rust-lang/crates.io-index" 669 | checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" 670 | dependencies = [ 671 | "proc-macro2", 672 | "quote", 673 | "syn 2.0.32", 674 | ] 675 | 676 | [[package]] 677 | name = "unicode-ident" 678 | version = "1.0.11" 679 | source = "registry+https://github.com/rust-lang/crates.io-index" 680 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" 681 | 682 | [[package]] 683 | name = "usb-device" 684 | version = "0.2.9" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" 687 | 688 | [[package]] 689 | name = "usbd-serial" 690 | version = "0.1.1" 691 | source = "registry+https://github.com/rust-lang/crates.io-index" 692 | checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" 693 | dependencies = [ 694 | "embedded-hal", 695 | "nb 0.1.3", 696 | "usb-device", 697 | ] 698 | 699 | [[package]] 700 | name = "vcell" 701 | version = "0.1.3" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 704 | 705 | [[package]] 706 | name = "version_check" 707 | version = "0.9.4" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 710 | 711 | [[package]] 712 | name = "void" 713 | version = "1.0.2" 714 | source = "registry+https://github.com/rust-lang/crates.io-index" 715 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 716 | 717 | [[package]] 718 | name = "volatile-register" 719 | version = "0.2.1" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" 722 | dependencies = [ 723 | "vcell", 724 | ] 725 | 726 | [[package]] 727 | name = "wyz" 728 | version = "0.5.1" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" 731 | dependencies = [ 732 | "tap", 733 | ] 734 | --------------------------------------------------------------------------------