diff --git a/boards/rpi_pico/.cargo/config.toml b/boards/rpi_pico/.cargo/config.toml new file mode 100644 index 0000000..2d214e3 --- /dev/null +++ b/boards/rpi_pico/.cargo/config.toml @@ -0,0 +1,9 @@ +[build] +target = "thumbv6m-none-eabi" + +[target.thumbv6m-none-eabi] +runner = "elf2uf2-rs -d" +#runner = "picotool load -x -t elf" +rustflags = [ + "-C", "link-arg=-Tlink.x", "-C", "link-arg=--nmagic", +] \ No newline at end of file diff --git a/boards/rpi_pico/.gitignore b/boards/rpi_pico/.gitignore new file mode 100644 index 0000000..c41cc9e --- /dev/null +++ b/boards/rpi_pico/.gitignore @@ -0,0 +1 @@ +/target \ No newline at end of file diff --git a/boards/rpi_pico/Cargo.lock b/boards/rpi_pico/Cargo.lock new file mode 100644 index 0000000..edf806b --- /dev/null +++ b/boards/rpi_pico/Cargo.lock @@ -0,0 +1,748 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atomic-polyfill" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30302dda7a66f8c55932ebf208f7def840743ff64d495e9ceffcd97c18f11d39" +dependencies = [ + "cortex-m", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version", +] + +[[package]] +name = "bare-metal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" + +[[package]] +name = "bit_field" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4" + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "byteorder" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cortex-m" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac919ef424449ec8c08d515590ce15d9262c0ca5f0da5b0c901e971a3b783b3" +dependencies = [ + "bare-metal 0.2.5", + "bitfield", + "embedded-hal", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c433da385b720d5bb9f52362fa2782420798e68d40d67bfe4b0d992aba5dfe7" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cortex-m-rtic" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daae9c453d0d5b467ebcdeae7aba537cb45a7de899930ad09f01c8dc42aa531f" +dependencies = [ + "bare-metal 1.0.0", + "cortex-m", + "cortex-m-rtic-macros", + "heapless", + "rtic-core", + "rtic-monotonic", + "version_check", +] + +[[package]] +name = "cortex-m-rtic-macros" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ba355d1639cf8df7c0658f01bd8952d11d49a029309118787eb54afc47a6cf8" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "rtic-syntax", + "syn", +] + +[[package]] +name = "crc-any" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "073375684a58dece169afbdc9879a027f3698118ad3814938316c6002b7aa921" +dependencies = [ + "debug-helper", +] + +[[package]] +name = "critical-section" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e191a5a6f6edad9b679777ef6b6c0f2bdd4a333f2ecb8f61c3e28109a03d70" +dependencies = [ + "bare-metal 1.0.0", + "cfg-if", + "cortex-m", + "riscv", +] + +[[package]] +name = "debug-helper" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76fbd10dce159c002b9c688ae8ab7cd531151e185e0ad360f4bfea3b0eede3a8" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "embedded-hal" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36cfb62ff156596c892272f3015ef952fe1525e85261fa3a7f327bd6b384ab9" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-time" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a4b4d10ac48d08bfe3db7688c402baadb244721f30a77ce360bd24c3dffe58" +dependencies = [ + "num", +] + +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "heapless" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e476c64197665c3725621f0ac3f9e5209aa5e889e02a08b1daf5f16dc5fd952" +dependencies = [ + "atomic-polyfill", + "hash32", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "indexmap" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lock_api" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.0.0", +] + +[[package]] +name = "nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" + +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "panic-halt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812" + +[[package]] +name = "paste" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58" + +[[package]] +name = "pio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "593b4978951e32f8dd5b76203503a9dd8dc4665e4bcb4f7fe8e03e33b9f7abc0" +dependencies = [ + "arrayvec", + "num_enum", + "paste", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "riscv" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6907ccdd7a31012b70faf2af85cd9e5ba97657cc3987c4f13f8e4d2c2a088aba" +dependencies = [ + "bare-metal 1.0.0", + "bit_field", + "riscv-target", +] + +[[package]] +name = "riscv-target" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "rp-pico" +version = "0.3.0" +source = "git+https://github.com/rp-rs/rp-hal.git?rev=8d18abdfc7c0129debba85457d32d32175bf36bd#8d18abdfc7c0129debba85457d32d32175bf36bd" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "embedded-time", + "rp2040-boot2", + "rp2040-hal", + "usb-device", + "usbd-hid", + "usbd-serial", +] + +[[package]] +name = "rp2040-boot2" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b480fe63133f0d639f82ce5a027fee7cac7ac92f67ef1896ee036a6f9737128" +dependencies = [ + "crc-any", +] + +[[package]] +name = "rp2040-hal" +version = "0.4.0" +source = "git+https://github.com/rp-rs/rp-hal.git?rev=8d18abdfc7c0129debba85457d32d32175bf36bd#8d18abdfc7c0129debba85457d32d32175bf36bd" +dependencies = [ + "cortex-m", + "critical-section", + "embedded-hal", + "embedded-time", + "itertools", + "nb 1.0.0", + "paste", + "pio", + "rand_core", + "rp2040-pac", + "usb-device", + "vcell", + "void", +] + +[[package]] +name = "rp2040-pac" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04fc92670038074acf20ad422130b735897937812a1761b17cfc26d56c253f" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "rtic-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" + +[[package]] +name = "rtic-monotonic" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" + +[[package]] +name = "rtic-syntax" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b149ff3177daeee442bb81ef7867d20d3c1ffea8a0a94e46e0e4b876ec4be2" +dependencies = [ + "indexmap", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rust-dap" +version = "0.2.0" +dependencies = [ + "bitflags", + "embedded-hal", + "heapless", + "nb 0.1.3", + "num_enum", + "usb-device", +] + +[[package]] +name = "rust-dap-raspberrypi-pico" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "cortex-m-rtic", + "embedded-hal", + "embedded-time", + "heapless", + "nb 0.1.3", + "panic-halt", + "rp-pico", + "rust-dap", + "usb-device", + "usbd-serial", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" + +[[package]] +name = "spin" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" +dependencies = [ + "lock_api", +] + +[[package]] +name = "ssmarshal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" +dependencies = [ + "encode_unicode", + "serde", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "usb-device" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6be90410d4772074ea49525e2e753b65920b94b57eee21a6ef7b6a6fe6296245" + +[[package]] +name = "usbd-hid" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "183b7e65bbd75512aedf250deda89394c74ae3118b79fe41f159e8503e1d5d7f" +dependencies = [ + "serde", + "ssmarshal", + "usb-device", + "usbd-hid-macros", +] + +[[package]] +name = "usbd-hid-descriptors" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e00430c0b39caf3957aba6c2b2824f8e70e1ac0278941418bf1fe35f9566d64" +dependencies = [ + "bitfield", +] + +[[package]] +name = "usbd-hid-macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bd005b3aa54e62905d99df49a75d11888bb958eb780adb5e8f2029733077df" +dependencies = [ + "byteorder", + "proc-macro2", + "quote", + "serde", + "syn", + "usbd-hid-descriptors", +] + +[[package]] +name = "usbd-serial" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db75519b86287f12dcf0d171c7cf4ecc839149fe9f3b720ac4cfce52959e1dfe" +dependencies = [ + "embedded-hal", + "nb 0.1.3", + "usb-device", +] + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d67cb4616d99b940db1d6bd28844ff97108b498a6ca850e5b6191a532063286" +dependencies = [ + "vcell", +] diff --git a/boards/rpi_pico/Cargo.toml b/boards/rpi_pico/Cargo.toml new file mode 100644 index 0000000..09f1643 --- /dev/null +++ b/boards/rpi_pico/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "rust-dap-raspberrypi-pico" +version = "0.1.0" +authors = ["Kenta IDA "] +edition = "2021" +license = "Apache-2.0" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[profile.release] +debug = 2 + +[dependencies] +rust-dap = { path = "../..", features = ["bitbang", "unproven"] } +rp-pico = { git = "https://github.com/rp-rs/rp-hal.git", rev = "8d18abdfc7c0129debba85457d32d32175bf36bd" } +panic-halt = "0.2" +cortex-m = "0.7" +cortex-m-rt = "0.7" +cortex-m-rtic = "1.0" + +usb-device = { version = "0.2", features = ["control-buffer-256"]} +usbd-serial = "0.1" +nb = "0.1" +heapless = "0.7" +embedded-hal = { version = "0.2.6", features = ["unproven"]} +embedded-time = "0.12" \ No newline at end of file diff --git a/boards/rpi_pico/memory.x b/boards/rpi_pico/memory.x new file mode 100644 index 0000000..070eac7 --- /dev/null +++ b/boards/rpi_pico/memory.x @@ -0,0 +1,15 @@ +MEMORY { + BOOT2 : ORIGIN = 0x10000000, LENGTH = 0x100 + FLASH : ORIGIN = 0x10000100, LENGTH = 2048K - 0x100 + RAM : ORIGIN = 0x20000000, LENGTH = 256K +} + +EXTERN(BOOT2_FIRMWARE) + +SECTIONS { + /* ### Boot loader */ + .boot2 ORIGIN(BOOT2) : + { + KEEP(*(.boot2)); + } > BOOT2 +} INSERT BEFORE .text; \ No newline at end of file diff --git a/boards/rpi_pico/src/line_coding.rs b/boards/rpi_pico/src/line_coding.rs new file mode 100644 index 0000000..18b1ba0 --- /dev/null +++ b/boards/rpi_pico/src/line_coding.rs @@ -0,0 +1,180 @@ +use rp_pico::hal::uart; +use usbd_serial; + +use core::convert::{From, TryFrom}; + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum UartConvertError { + Incompatible, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum UartStopBits { + One, + Two, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub enum UartParityType { + None, + Odd, + Even, +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct UartDataBits(u8); + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct UartConfig { + pub data_bits: UartDataBits, + pub stop_bits: UartStopBits, + pub parity_type: UartParityType, + pub data_rate: u32, +} + +impl From for usbd_serial::StopBits { + fn from(value: UartStopBits) -> Self { + match value { + UartStopBits::One => Self::One, + UartStopBits::Two => Self::Two, + } + } +} +impl TryFrom for UartStopBits { + type Error = UartConvertError; + fn try_from(value: usbd_serial::StopBits) -> Result { + match value { + usbd_serial::StopBits::One => Ok(Self::One), + usbd_serial::StopBits::Two => Ok(Self::Two), + _ => Err(Self::Error::Incompatible), + } + } +} + +impl From for uart::StopBits { + fn from(value: UartStopBits) -> Self { + match value { + UartStopBits::One => Self::One, + UartStopBits::Two => Self::Two, + } + } +} + +impl From for UartStopBits { + fn from(value: uart::StopBits) -> Self { + match value { + uart::StopBits::One => Self::One, + uart::StopBits::Two => Self::Two, + } + } +} + +impl From for usbd_serial::ParityType { + fn from(value: UartParityType) -> Self { + match value { + UartParityType::None => Self::None, + UartParityType::Even => Self::Event, + UartParityType::Odd => Self::Odd, + } + } +} +impl TryFrom for UartParityType { + type Error = UartConvertError; + fn try_from(value: usbd_serial::ParityType) -> Result { + match value { + usbd_serial::ParityType::None => Ok(Self::None), + usbd_serial::ParityType::Event => Ok(Self::Even), + usbd_serial::ParityType::Odd => Ok(Self::Odd), + _ => Err(Self::Error::Incompatible), + } + } +} + +impl From for Option { + fn from(value: UartParityType) -> Self { + match value { + UartParityType::None => None, + UartParityType::Even => Some(uart::Parity::Even), + UartParityType::Odd => Some(uart::Parity::Odd), + } + } +} +impl From> for UartParityType { + fn from(value: Option) -> Self { + match value { + None => Self::None, + Some(uart::Parity::Even) => Self::Even, + Some(uart::Parity::Odd) => Self::Odd, + } + } +} + +impl From for UartDataBits { + fn from(value: uart::DataBits) -> Self { + match value { + uart::DataBits::Five => Self(5), + uart::DataBits::Six => Self(6), + uart::DataBits::Seven => Self(7), + uart::DataBits::Eight => Self(8), + } + } +} +impl From for uart::DataBits { + fn from(value: UartDataBits) -> Self { + match value.0 { + 5 => Self::Five, + 6 => Self::Six, + 7 => Self::Seven, + 8 => Self::Eight, + _ => panic!("Incompative UART data bits."), + } + } +} +impl TryFrom for UartDataBits { + type Error = UartConvertError; + fn try_from(value: u8) -> Result { + match value { + 5 => Ok(Self(5)), + 6 => Ok(Self(6)), + 7 => Ok(Self(7)), + 8 => Ok(Self(8)), + _ => Err(Self::Error::Incompatible), + } + } +} + +impl From for UartConfig { + fn from(value: uart::UartConfig) -> Self { + Self { + data_bits: value.data_bits.into(), + stop_bits: value.stop_bits.into(), + parity_type: value.parity.into(), + data_rate: value.baudrate.0, + } + } +} +impl From<&UartConfig> for uart::UartConfig { + fn from(value: &UartConfig) -> Self { + let mut config = uart::common_configs::_115200_8_N_1; + config.data_bits = value.data_bits.into(); + config.stop_bits = value.stop_bits.into(); + config.parity = value.parity_type.into(); + config.baudrate = embedded_time::rate::Baud(value.data_rate); + config + } +} +impl TryFrom<&usbd_serial::LineCoding> for UartConfig { + type Error = UartConvertError; + fn try_from(value: &usbd_serial::LineCoding) -> Result { + let data_bits = value.data_bits().try_into()?; + let stop_bits = value.stop_bits().try_into()?; + let parity_type = value.parity_type().try_into()?; + let data_rate = value.data_rate(); + Ok(Self { + data_bits, + stop_bits, + parity_type, + data_rate, + }) + } +} \ No newline at end of file diff --git a/boards/rpi_pico/src/main.rs b/boards/rpi_pico/src/main.rs new file mode 100644 index 0000000..0e8609a --- /dev/null +++ b/boards/rpi_pico/src/main.rs @@ -0,0 +1,402 @@ +// Copyright 2021 Kenta Ida +// +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#![no_std] +#![no_main] + +mod line_coding; +mod swdio_pin; + +#[rtic::app(device = rp_pico::hal::pac, peripherals = true)] +mod app { + use panic_halt as _; + + use rust_dap::bitbang::*; + use rust_dap::USB_CLASS_MISCELLANEOUS; + use rust_dap::USB_PROTOCOL_IAD; + use rust_dap::USB_SUBCLASS_COMMON; + + use hal::gpio::{Output, Pin, PushPull}; + use hal::pac; + use rp_pico::hal; + + use hal::usb::UsbBus; + use usb_device::bus::UsbBusAllocator; + + use rust_dap::CmsisDap; + use usb_device::prelude::*; + use usbd_serial::SerialPort; + + use embedded_hal::digital::v2::{OutputPin, ToggleableOutputPin}; + use embedded_hal::serial::{Read, Write}; + + type SwdIoPin = hal::gpio::bank0::Gpio4; + type SwClkPin = hal::gpio::bank0::Gpio2; + type SwdInputPin

= PicoSwdInputPin

; + type SwdOutputPin

= PicoSwdOutputPin

; + type SwdIoInputPin = SwdInputPin; + type SwdIoOutputPin = SwdOutputPin; + type SwClkInputPin = SwdInputPin; + type SwClkOutputPin = SwdOutputPin; + type MySwdIoSet = + SwdIoSet; + + pub struct CycleDelay {} + impl DelayFunc for CycleDelay { + fn cycle_delay(&self, cycles: u32) { + cortex_m::asm::delay(cycles); + } + } + + use crate::line_coding::*; + use crate::swdio_pin::*; + + // UART Interrupt context + const UART_RX_QUEUE_SIZE: usize = 256; + const UART_TX_QUEUE_SIZE: usize = 128; + // UART Shared context + type UartPins = ( + hal::gpio::Pin>, + hal::gpio::Pin>, + ); + type Uart = hal::uart::UartPeripheral; + pub struct UartReader(hal::uart::Reader); + pub struct UartWriter(hal::uart::Writer); + unsafe impl Sync for UartReader {} + unsafe impl Sync for UartWriter {} + unsafe impl Send for UartReader {} + unsafe impl Send for UartWriter {} + + pub struct UartConfigAndClock { + pub config: UartConfig, + pub clock: embedded_time::rate::Hertz, + } + + #[shared] + struct Shared { + uart_reader: Option, + uart_writer: Option, + usb_serial: SerialPort<'static, UsbBus>, + uart_rx_consumer: heapless::spsc::Consumer<'static, u8, UART_RX_QUEUE_SIZE>, + uart_tx_producer: heapless::spsc::Producer<'static, u8, UART_TX_QUEUE_SIZE>, + uart_tx_consumer: heapless::spsc::Consumer<'static, u8, UART_TX_QUEUE_SIZE>, + } + + #[local] + struct Local { + uart_config: UartConfigAndClock, + uart_rx_producer: heapless::spsc::Producer<'static, u8, UART_RX_QUEUE_SIZE>, + usb_bus: UsbDevice<'static, UsbBus>, + usb_dap: CmsisDap<'static, UsbBus, MySwdIoSet, 64>, + usb_led: Pin>, + idle_led: Pin>, + debug_out: Pin>, + debug_irq_out: Pin>, + debug_usb_irq_out: Pin>, + } + + #[init(local = [ + uart_rx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), + uart_tx_queue: heapless::spsc::Queue = heapless::spsc::Queue::new(), + USB_ALLOCATOR: Option> = None, + ])] + fn init(c: init::Context) -> (Shared, Local, init::Monotonics) { + let mut resets = c.device.RESETS; + let sio = hal::Sio::new(c.device.SIO); + let pins = rp_pico::Pins::new( + c.device.IO_BANK0, + c.device.PADS_BANK0, + sio.gpio_bank0, + &mut resets, + ); + + let mut watchdog = hal::Watchdog::new(c.device.WATCHDOG); + let clocks = hal::clocks::init_clocks_and_plls( + rp_pico::XOSC_CRYSTAL_FREQ, + c.device.XOSC, + c.device.CLOCKS, + c.device.PLL_SYS, + c.device.PLL_USB, + &mut resets, + &mut watchdog, + ) + .ok() + .unwrap(); + + let uart_pins = ( + pins.gpio0.into_mode::(), // TxD + pins.gpio1.into_mode::(), // RxD + ); + let uart_config = UartConfigAndClock { + config: UartConfig::from(hal::uart::common_configs::_115200_8_N_1), + clock: clocks.peripheral_clock.into(), + }; + let mut uart = hal::uart::UartPeripheral::new(c.device.UART0, uart_pins, &mut resets) + .enable((&uart_config.config).into(), uart_config.clock) + .unwrap(); + // Enable RX interrupt. Note that TX interrupt is enabled when some TX data is available. + uart.enable_rx_interrupt(); + let (uart_reader, uart_writer) = uart.split(); + let uart_reader = Some(UartReader(uart_reader)); + let uart_writer = Some(UartWriter(uart_writer)); + + let usb_allocator = UsbBusAllocator::new(hal::usb::UsbBus::new( + c.device.USBCTRL_REGS, + c.device.USBCTRL_DPRAM, + clocks.usb_clock, + true, + &mut resets, + )); + c.local.USB_ALLOCATOR.replace(usb_allocator); + let usb_allocator = c.local.USB_ALLOCATOR.as_ref().unwrap(); + + let swdio = MySwdIoSet::new( + PicoSwdInputPin::new(pins.gpio2.into_floating_input()), + PicoSwdInputPin::new(pins.gpio4.into_floating_input()), + CycleDelay {}, + ); + + let usb_serial = SerialPort::new(usb_allocator); + let usb_dap = CmsisDap::new(usb_allocator, swdio); + let usb_bus = UsbDeviceBuilder::new(usb_allocator, UsbVidPid(0x6666, 0x4444)) + .manufacturer("fugafuga.org") + .product("CMSIS-DAP") + .serial_number("test") + .device_class(USB_CLASS_MISCELLANEOUS) + .device_class(USB_SUBCLASS_COMMON) + .device_protocol(USB_PROTOCOL_IAD) + .composite_with_iads() + .max_packet_size_0(64) + .build(); + let usb_led = pins.led.into_push_pull_output(); + let (uart_rx_producer, uart_rx_consumer) = c.local.uart_rx_queue.split(); + let (uart_tx_producer, uart_tx_consumer) = c.local.uart_tx_queue.split(); + + let mut debug_out = pins.gpio6.into_push_pull_output(); + debug_out.set_low().ok(); + let mut debug_irq_out = pins.gpio28.into_push_pull_output(); + debug_irq_out.set_low().ok(); + let mut debug_usb_irq_out = pins.gpio27.into_push_pull_output(); + debug_usb_irq_out.set_low().ok(); + + pins.gpio7.into_floating_disabled(); // Deassert nRESET pin. + pins.gpio16.into_push_pull_output().set_high().ok(); + let mut idle_led = pins.gpio17.into_push_pull_output(); + idle_led.set_high().ok(); + ( + Shared { + uart_reader, + uart_writer, + usb_serial, + uart_rx_consumer, + uart_tx_producer, + uart_tx_consumer, + }, + Local { + uart_config, + uart_rx_producer, + usb_bus, + usb_dap, + usb_led, + idle_led, + debug_out, + debug_irq_out, + debug_usb_irq_out, + }, + init::Monotonics(), + ) + } + + #[idle(shared = [uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], local = [idle_led])] + fn idle(mut c: idle::Context) -> ! { + loop { + (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( + |usb_serial, uart_tx_producer| { + while uart_tx_producer.ready() { + if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { + uart_tx_producer.enqueue(data).unwrap(); + } else { + break; + } + } + }, + ); + (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( + |uart, uart_tx_consumer| { + let uart = uart.as_mut().unwrap(); + while let Some(data) = uart_tx_consumer.peek() { + if uart.0.write(*data).is_ok() { + uart_tx_consumer.dequeue().unwrap(); + } else { + break; + } + } + }, + ); + + // Process RX data. + (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( + |usb_serial, uart_rx_consumer| { + while let Some(data) = uart_rx_consumer.peek() { + match write_usb_serial_byte_cs(usb_serial, *data) { + Ok(_) => { + let _ = uart_rx_consumer.dequeue().unwrap(); + } + _ => break, + } + } + usb_serial.flush().ok(); + }, + ); + + c.local.idle_led.toggle().ok(); + } + } + + #[task( + binds = UART0_IRQ, + priority = 2, + shared = [uart_reader], + local = [uart_rx_producer, debug_out, debug_irq_out], + )] + fn uart_irq(mut c: uart_irq::Context) { + c.local.debug_irq_out.set_high().ok(); + while c.local.uart_rx_producer.ready() { + if let Ok(data) = c + .shared + .uart_reader + .lock(|uart| uart.as_mut().unwrap().0.read()) + { + c.local.debug_out.toggle().ok(); + 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. + } else { + break; + } + } + c.local.debug_irq_out.set_low().ok(); + } + + #[task( + binds = USBCTRL_IRQ, + priority = 1, + shared = [uart_reader, uart_writer, usb_serial, uart_rx_consumer, uart_tx_producer, uart_tx_consumer], + local = [usb_bus, usb_dap, uart_config, usb_led, debug_usb_irq_out], + )] + fn usbctrl_irq(mut c: usbctrl_irq::Context) { + c.local.debug_usb_irq_out.set_high().ok(); + + let poll_result = c + .shared + .usb_serial + .lock(|usb_serial| c.local.usb_bus.poll(&mut [usb_serial, c.local.usb_dap])); + if !poll_result { + c.local.debug_usb_irq_out.set_low().ok(); + return; // Nothing to do at this time... + } + // Process DAP commands. + c.local.usb_dap.process().ok(); + + // Process TX data. + (&mut c.shared.usb_serial, &mut c.shared.uart_tx_producer).lock( + |usb_serial, uart_tx_producer| { + while uart_tx_producer.ready() { + if let Ok(data) = read_usb_serial_byte_cs(usb_serial) { + uart_tx_producer.enqueue(data).unwrap(); + } else { + break; + } + } + }, + ); + (&mut c.shared.uart_writer, &mut c.shared.uart_tx_consumer).lock( + |uart, uart_tx_consumer| { + let uart = uart.as_mut().unwrap(); + while let Some(data) = uart_tx_consumer.peek() { + if uart.0.write(*data).is_ok() { + uart_tx_consumer.dequeue().unwrap(); + } else { + break; + } + } + }, + ); + + // Process RX data. + (&mut c.shared.usb_serial, &mut c.shared.uart_rx_consumer).lock( + |usb_serial, uart_rx_consumer| { + while let Some(data) = uart_rx_consumer.peek() { + match write_usb_serial_byte_cs(usb_serial, *data) { + Ok(_) => { + let _ = uart_rx_consumer.dequeue().unwrap(); + } + _ => break, + } + } + usb_serial.flush().ok(); + }, + ); + + // Check if the UART transmitter must be re-configured. + if let Ok(expected_config) = c + .shared + .usb_serial + .lock(|usb_serial| UartConfig::try_from(usb_serial.line_coding().clone())) + { + let config = UartConfig::from(c.local.uart_config.config.clone()); + if expected_config != config { + (&mut c.shared.uart_reader, &mut c.shared.uart_writer).lock(|reader, writer| { + reader.as_mut().unwrap().0.disable_rx_interrupt(); + let disabled = + Uart::join(reader.take().unwrap().0, writer.take().unwrap().0).disable(); + let enabled = disabled + .enable((&expected_config).into(), c.local.uart_config.clock) + .unwrap(); + c.local.uart_config.config = expected_config.into(); + let (new_reader, new_writer) = enabled.split(); + reader.replace(UartReader(new_reader)); + writer.replace(UartWriter(new_writer)); + reader.as_mut().unwrap().0.enable_rx_interrupt(); + }); + } + } + + c.local.usb_led.toggle().ok(); + c.local.debug_usb_irq_out.set_low().ok(); + } + + fn read_usb_serial_byte_cs(usb_serial: &mut SerialPort) -> Result { + let mut buf = [0u8; 1]; + match usb_serial.read(&mut buf) { + Ok(1) => Ok(buf[0]), + Ok(0) => Err(UsbError::WouldBlock), + Ok(_) => panic!("USB Serial read extra data."), + Err(err) => Err(err), + } + } + + fn write_usb_serial_byte_cs( + usb_serial: &mut SerialPort, + data: u8, + ) -> Result<(), UsbError> { + let buf = [data; 1]; + match usb_serial.write(&buf) { + Ok(1) => Ok(()), + Ok(0) => Err(UsbError::WouldBlock), + Ok(_) => panic!("USB Serial wrote extra data."), + Err(err) => Err(err), + } + } +} diff --git a/boards/rpi_pico/src/swdio_pin.rs b/boards/rpi_pico/src/swdio_pin.rs new file mode 100644 index 0000000..c77ca23 --- /dev/null +++ b/boards/rpi_pico/src/swdio_pin.rs @@ -0,0 +1,127 @@ + +use embedded_hal::digital::v2::{InputPin, OutputPin, IoPin, PinState}; +use rp_pico::hal::gpio::{Pin, PinId, Input, Output, Disabled, Floating, PushPull, OutputOverride}; + +pub struct PicoSwdInputPin +where + I: PinId +{ + pin: Pin>, +} + +impl PicoSwdInputPin +where + I: PinId +{ + pub fn new(pin: Pin>) -> Self { + Self { + pin: pin, + } + } +} + +impl InputPin for PicoSwdInputPin +where + I: PinId +{ + type Error = core::convert::Infallible; + fn is_high(&self) -> Result { + self.pin.is_high() + } + fn is_low(&self) -> Result { + self.pin.is_low() + } +} + + +impl IoPin, PicoSwdOutputPin> for PicoSwdInputPin +where + I: PinId, +{ + type Error = core::convert::Infallible; + fn into_input_pin(self) -> Result, Self::Error> { + Ok(self) + } + fn into_output_pin(mut self, state: PinState) -> Result, Self::Error> { + let output_override = if state == PinState::High { OutputOverride::AlwaysHigh } else { OutputOverride::AlwaysLow }; + self.pin.set_output_override(output_override); + let mut output_pin = self.pin.into_push_pull_output(); + output_pin.set_output_override(OutputOverride::DontInvert); + let mut new_pin = PicoSwdOutputPin::new(output_pin); + new_pin.set_state(state)?; + Ok(new_pin) + } +} +pub struct PicoSwdOutputPin +where + I: PinId, +{ + pin: Pin>, +} + +impl PicoSwdOutputPin +where + I: PinId, +{ + pub fn new(pin: Pin>) -> Self { + Self { + pin: pin, + } + } +} + +impl OutputPin for PicoSwdOutputPin +where + I: PinId, +{ + type Error = core::convert::Infallible; + fn set_high(&mut self) -> Result<(), Self::Error> { + self.pin.set_high() + } + fn set_low(&mut self) -> Result<(), Self::Error> { + self.pin.set_low() + } + fn set_state(&mut self, state: embedded_hal::digital::v2::PinState) -> Result<(), Self::Error> { + self.pin.set_state(state) + } +} + + +impl IoPin, PicoSwdOutputPin> for PicoSwdOutputPin +where + I: PinId, +{ + type Error = core::convert::Infallible; + fn into_input_pin(self) -> Result, Self::Error> { + let new_pin = self.pin.into_floating_input(); + Ok(PicoSwdInputPin::new(new_pin)) + } + fn into_output_pin(mut self, state: PinState) -> Result, Self::Error> { + self.set_state(state)?; + Ok(self) + } +} + +pub struct PicoSwdPin +where + I: PinId, +{ + pin: Pin>, +} + +impl IoPin, PicoSwdOutputPin> for PicoSwdPin +where + I: PinId, +{ + type Error = core::convert::Infallible; + fn into_input_pin(self) -> Result, Self::Error> { + let input_pin = self.pin.into_floating_input(); + Ok(PicoSwdInputPin::new(input_pin)) + } + fn into_output_pin(self, state: PinState) -> Result, Self::Error> { + let output_pin = self.pin.into_push_pull_output(); + let mut new_pin = PicoSwdOutputPin::new(output_pin); + new_pin.set_state(state)?; + Ok(new_pin) + } +} diff --git a/boards/xiao_rp2040/.vscode/launch.json b/boards/xiao_rp2040/.vscode/launch.json deleted file mode 100644 index 4510789..0000000 --- a/boards/xiao_rp2040/.vscode/launch.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Debug", - "type": "cortex-debug", - "request": "launch", - "servertype": "external", - "cwd": "${workspaceRoot}", - "runToMain": true, - "executable": "target/thumbv6m-none-eabi/debug/rust-dap-xiao", - "device": "ATSAMD21G18", - "gdbPath": "gdb-multiarch", - "gdbTarget": "localhost:3333", - "svdFile": "ATSAMD21G18A.svd", - "runToEntryPoint": "main", - "preLaunchTask": "build rust-dap-xiao", - "showDevDebugOutput": false - } - ] -} \ No newline at end of file diff --git a/boards/xiao_rp2040/.vscode/tasks.json b/boards/xiao_rp2040/.vscode/tasks.json deleted file mode 100644 index 660e525..0000000 --- a/boards/xiao_rp2040/.vscode/tasks.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - // tasks.json の形式に関するドキュメントについては - // https://go.microsoft.com/fwlink/?LinkId=733558 を参照してください - "version": "2.0.0", - "tasks": [ - { - "type": "cargo", - "command": "build", - "problemMatcher": [ - "$rustc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "label": "build rust-dap-xiao" - } - ] -} \ No newline at end of file