Add comments
This commit is contained in:
commit
3adf7aefb9
11 changed files with 1316 additions and 0 deletions
84
.cargo/config.toml
Normal file
84
.cargo/config.toml
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
[build]
|
||||||
|
# Set the default target to match the Cortex-M33 in the RP2350
|
||||||
|
target = "thumbv8m.main-none-eabihf"
|
||||||
|
|
||||||
|
# This is the hard-float ABI for Arm mode.
|
||||||
|
#
|
||||||
|
# The FPU is enabled by default, and float function arguments use FPU
|
||||||
|
# registers.
|
||||||
|
[target.thumbv8m.main-none-eabihf]
|
||||||
|
# Pass some extra options to rustc, some of which get passed on to the linker.
|
||||||
|
#
|
||||||
|
# * linker argument --nmagic turns off page alignment of sections (which saves
|
||||||
|
# flash space)
|
||||||
|
# * linker argument -Tlink.x tells the linker to use link.x as a linker script.
|
||||||
|
# This is usually provided by the cortex-m-rt crate, and by default the
|
||||||
|
# version in that crate will include a file called `memory.x` which describes
|
||||||
|
# the particular memory layout for your specific chip.
|
||||||
|
# * linker argument -Tdefmt.x also tells the linker to use `defmt.x` as a
|
||||||
|
# secondary linker script. This is required to make defmt_rtt work.
|
||||||
|
rustflags = [
|
||||||
|
"-C",
|
||||||
|
"link-arg=--nmagic",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Tlink.x",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Tdefmt.x",
|
||||||
|
"-C",
|
||||||
|
"target-cpu=cortex-m33",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Use picotool for loading.
|
||||||
|
#
|
||||||
|
# Load an elf, skipping unchanged flash sectors, verify it, and execute it
|
||||||
|
runner = "picotool load -u -v -x -t elf"
|
||||||
|
|
||||||
|
# This is the soft-float ABI for Arm mode.
|
||||||
|
#
|
||||||
|
# The FPU is disabled by default, and float function arguments use integer
|
||||||
|
# registers. Only useful for making the `float_test` example give really bad
|
||||||
|
# results on the `f32` benchmark.
|
||||||
|
[target.thumbv8m.main-none-eabi]
|
||||||
|
# Pass some extra options to rustc. See above for descriptions.
|
||||||
|
rustflags = [
|
||||||
|
"-C",
|
||||||
|
"link-arg=--nmagic",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Tlink.x",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Tdefmt.x",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Use picotool for loading.
|
||||||
|
#
|
||||||
|
# Load an elf, skipping unchanged flash sectors, verify it, and execute it
|
||||||
|
runner = "picotool load -u -v -x -t elf"
|
||||||
|
|
||||||
|
# This is the soft-float ABI for RISC-V mode.
|
||||||
|
#
|
||||||
|
# Hazard 3 does not have an FPU and so float function arguments use integer
|
||||||
|
# registers.
|
||||||
|
[target.riscv32imac-unknown-none-elf]
|
||||||
|
# Pass some extra options to rustc, some of which get passed on to the linker.
|
||||||
|
#
|
||||||
|
# * linker argument --nmagic turns off page alignment of sections (which saves
|
||||||
|
# flash space)
|
||||||
|
# * linker argument -Trp235x_riscv.x also tells the linker to use
|
||||||
|
# `rp235x_riscv.x` as a linker script. This adds in RP2350 RISC-V specific
|
||||||
|
# things that the riscv-rt crate's `link.x` requires and then includes
|
||||||
|
# `link.x` automatically. This is the reverse of how we do it on Cortex-M.
|
||||||
|
# * linker argument -Tdefmt.x also tells the linker to use `defmt.x` as a
|
||||||
|
# secondary linker script. This is required to make defmt_rtt work.
|
||||||
|
rustflags = [
|
||||||
|
"-C",
|
||||||
|
"link-arg=--nmagic",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Trp235x_riscv.x",
|
||||||
|
"-C",
|
||||||
|
"link-arg=-Tdefmt.x",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Use picotool for loading.
|
||||||
|
#
|
||||||
|
# Load an elf, skipping unchanged flash sectors, verify it, and execute it
|
||||||
|
runner = "picotool load -u -v -x -t elf"
|
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/target
|
||||||
|
/.direnv
|
||||||
|
/.pre-commit-config.yaml
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
#
|
||||||
|
# already existing elements were commented out
|
||||||
|
|
||||||
|
#/target
|
692
Cargo.lock
generated
Normal file
692
Cargo.lock
generated
Normal file
|
@ -0,0 +1,692 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "arrayvec"
|
||||||
|
version = "0.7.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||||
|
|
||||||
|
[[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 = "bitfield"
|
||||||
|
version = "0.13.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitfield"
|
||||||
|
version = "0.14.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "1.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cortex-m"
|
||||||
|
version = "0.7.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
|
||||||
|
dependencies = [
|
||||||
|
"bare-metal",
|
||||||
|
"bitfield 0.13.2",
|
||||||
|
"embedded-hal 0.2.7",
|
||||||
|
"volatile-register",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cortex-m-rt"
|
||||||
|
version = "0.7.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1"
|
||||||
|
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 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "critical-section"
|
||||||
|
version = "1.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling"
|
||||||
|
version = "0.20.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"darling_macro",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_core"
|
||||||
|
version = "0.20.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||||
|
dependencies = [
|
||||||
|
"fnv",
|
||||||
|
"ident_case",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"strsim",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "darling_macro"
|
||||||
|
version = "0.20.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||||
|
dependencies = [
|
||||||
|
"darling_core",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt"
|
||||||
|
version = "0.3.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"defmt-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt-macros"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb"
|
||||||
|
dependencies = [
|
||||||
|
"defmt-parser",
|
||||||
|
"proc-macro-error",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "defmt-parser"
|
||||||
|
version = "0.3.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "document-features"
|
||||||
|
version = "0.2.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0"
|
||||||
|
dependencies = [
|
||||||
|
"litrs",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "either"
|
||||||
|
version = "1.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embassy-executor"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec648daedd2143466eff4b3e8002024f9f6c1de4ab7666bb679688752624c925"
|
||||||
|
dependencies = [
|
||||||
|
"cortex-m",
|
||||||
|
"critical-section",
|
||||||
|
"document-features",
|
||||||
|
"embassy-executor-macros",
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embassy-executor-macros"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ad454accf80050e9cf7a51e994132ba0e56286b31f9317b68703897c328c59b5"
|
||||||
|
dependencies = [
|
||||||
|
"darling",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-dma"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446"
|
||||||
|
dependencies = [
|
||||||
|
"stable_deref_trait",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-hal"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
|
||||||
|
dependencies = [
|
||||||
|
"nb 0.1.3",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-hal"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-hal-async"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884"
|
||||||
|
dependencies = [
|
||||||
|
"embedded-hal 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-hal-nb"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605"
|
||||||
|
dependencies = [
|
||||||
|
"embedded-hal 1.0.0",
|
||||||
|
"nb 1.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-io"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fnv"
|
||||||
|
version = "1.0.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "frunk"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "874b6a17738fc273ec753618bac60ddaeac48cb1d7684c3e7bd472e57a28b817"
|
||||||
|
dependencies = [
|
||||||
|
"frunk_core",
|
||||||
|
"frunk_derives",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "frunk_core"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3529a07095650187788833d585c219761114005d5976185760cf794d265b6a5c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "frunk_derives"
|
||||||
|
version = "0.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e99b8b3c28ae0e84b604c75f721c21dc77afb3706076af5e8216d15fd1deaae3"
|
||||||
|
dependencies = [
|
||||||
|
"frunk_proc_macro_helpers",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "frunk_proc_macro_helpers"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "05a956ef36c377977e512e227dcad20f68c2786ac7a54dacece3746046fea5ce"
|
||||||
|
dependencies = [
|
||||||
|
"frunk_core",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fugit"
|
||||||
|
version = "0.3.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7"
|
||||||
|
dependencies = [
|
||||||
|
"gcd",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gcd"
|
||||||
|
version = "2.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hash32"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heapless"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||||
|
dependencies = [
|
||||||
|
"hash32",
|
||||||
|
"stable_deref_trait",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ident_case"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itertools"
|
||||||
|
version = "0.13.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
||||||
|
dependencies = [
|
||||||
|
"either",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "litrs"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nb"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
|
||||||
|
dependencies = [
|
||||||
|
"nb 1.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nb"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum"
|
||||||
|
version = "0.5.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9"
|
||||||
|
dependencies = [
|
||||||
|
"num_enum_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_enum_derive"
|
||||||
|
version = "0.5.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pio"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "76e09694b50f89f302ed531c1f2a7569f0be5867aee4ab4f8f729bbeec0078e3"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"num_enum",
|
||||||
|
"paste",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
||||||
|
|
||||||
|
[[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 1.0.109",
|
||||||
|
"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.87"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.37"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "riscv"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2f5c1b8bf41ea746266cdee443d1d1e9125c86ce1447e1a2615abd34330d33a9"
|
||||||
|
dependencies = [
|
||||||
|
"critical-section",
|
||||||
|
"embedded-hal 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "riscv-rt"
|
||||||
|
version = "0.12.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c0d35e32cf1383183e8885d8a9aa4402a087fd094dc34c2cb6df6687d0229dfe"
|
||||||
|
dependencies = [
|
||||||
|
"riscv",
|
||||||
|
"riscv-rt-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "riscv-rt-macros"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a8d100d466dbb76681ef6a9386f3da9abc570d57394e86da0ba5af8c4408486d"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 1.0.109",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp-binary-info"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "534e2a451671116f5b9391cb15fae43b9abdc56817bcaca9a95ed32c3e4c6b38"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp-hal-common"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8288358786b1458fb2caac8c4b40fb529ef4200d6c46467e2695b7a8ba573ae8"
|
||||||
|
dependencies = [
|
||||||
|
"fugit",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp2350-rust-playground"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"embassy-executor",
|
||||||
|
"embedded-hal 1.0.0",
|
||||||
|
"panic-halt",
|
||||||
|
"rp235x-hal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp235x-hal"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ed1714150c427d4be4022ff92dbf26a7e69c4eb7c1eba151c5752299c7c7f165"
|
||||||
|
dependencies = [
|
||||||
|
"bitfield 0.14.0",
|
||||||
|
"cortex-m",
|
||||||
|
"cortex-m-rt",
|
||||||
|
"critical-section",
|
||||||
|
"defmt",
|
||||||
|
"embedded-dma",
|
||||||
|
"embedded-hal 0.2.7",
|
||||||
|
"embedded-hal 1.0.0",
|
||||||
|
"embedded-hal-async",
|
||||||
|
"embedded-hal-nb",
|
||||||
|
"embedded-io",
|
||||||
|
"frunk",
|
||||||
|
"fugit",
|
||||||
|
"gcd",
|
||||||
|
"itertools",
|
||||||
|
"nb 1.1.0",
|
||||||
|
"paste",
|
||||||
|
"pio",
|
||||||
|
"rand_core",
|
||||||
|
"riscv",
|
||||||
|
"riscv-rt",
|
||||||
|
"rp-binary-info",
|
||||||
|
"rp-hal-common",
|
||||||
|
"rp235x-hal-macros",
|
||||||
|
"rp235x-pac",
|
||||||
|
"sha2-const-stable",
|
||||||
|
"usb-device",
|
||||||
|
"vcell",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp235x-hal-macros"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "74edd7a5979e9763bbb98e9746e711bac7464ee3397af7288e6c288ff0d3c764"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rp235x-pac"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ffcb6931deee4242886b5a1df62db5e2555b0eb6ae1e8be101f3ea3e58e65c6"
|
||||||
|
dependencies = [
|
||||||
|
"cortex-m",
|
||||||
|
"cortex-m-rt",
|
||||||
|
"critical-section",
|
||||||
|
"vcell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
|
dependencies = [
|
||||||
|
"semver",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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 = "sha2-const-stable"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5f179d4e11094a893b82fff208f74d448a7512f99f5a0acbd5c679b705f83ed9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "stable_deref_trait"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.109"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.79"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror"
|
||||||
|
version = "1.0.64"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
|
||||||
|
dependencies = [
|
||||||
|
"thiserror-impl",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thiserror-impl"
|
||||||
|
version = "1.0.64"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.79",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "usb-device"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6"
|
||||||
|
dependencies = [
|
||||||
|
"heapless",
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[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.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||||
|
|
||||||
|
[[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.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc"
|
||||||
|
dependencies = [
|
||||||
|
"vcell",
|
||||||
|
]
|
33
Cargo.toml
Normal file
33
Cargo.toml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
[package]
|
||||||
|
name = "rp2350-rust-playground"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rp235x_program"
|
||||||
|
path = "src/main.rs"
|
||||||
|
test = false
|
||||||
|
doctest = false
|
||||||
|
bench = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
embedded-hal = "1.0.0"
|
||||||
|
panic-halt = "0.2.0"
|
||||||
|
rp235x-hal = { version = "0.2.0", features = [
|
||||||
|
"binary-info",
|
||||||
|
"critical-section-impl",
|
||||||
|
"rt",
|
||||||
|
"defmt",
|
||||||
|
] }
|
||||||
|
|
||||||
|
[target.'cfg( target_arch = "arm" )'.dependencies]
|
||||||
|
embassy-executor = { version = "0.5", features = [
|
||||||
|
"arch-cortex-m",
|
||||||
|
"executor-thread",
|
||||||
|
] }
|
||||||
|
|
||||||
|
[target.'cfg( target_arch = "riscv32" )'.dependencies]
|
||||||
|
embassy-executor = { version = "0.5", features = [
|
||||||
|
"arch-riscv32",
|
||||||
|
"executor-thread",
|
||||||
|
] }
|
27
build.rs
Normal file
27
build.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// source https://github.com/rp-rs/rp-hal/blob/main/rp235x-hal-examples/build.rs
|
||||||
|
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Put the linker script somewhere the linker can find it
|
||||||
|
let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
|
||||||
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
|
||||||
|
// The file `memory.x` is loaded by cortex-m-rt's `link.x` script, which
|
||||||
|
// is what we specify in `.cargo/config.toml` for Arm builds
|
||||||
|
let memory_x = include_bytes!("memory.x");
|
||||||
|
let mut f = File::create(out.join("memory.x")).unwrap();
|
||||||
|
f.write_all(memory_x).unwrap();
|
||||||
|
println!("cargo:rerun-if-changed=memory.x");
|
||||||
|
|
||||||
|
// The file `rp235x_riscv.x` is what we specify in `.cargo/config.toml` for
|
||||||
|
// RISC-V builds
|
||||||
|
let rp235x_riscv_x = include_bytes!("rp235x_riscv.x");
|
||||||
|
let mut f = File::create(out.join("rp235x_riscv.x")).unwrap();
|
||||||
|
f.write_all(rp235x_riscv_x).unwrap();
|
||||||
|
println!("cargo:rerun-if-changed=rp235x_riscv.x");
|
||||||
|
|
||||||
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
}
|
27
flake.lock
Normal file
27
flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728241625,
|
||||||
|
"narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
25
flake.nix
Normal file
25
flake.nix
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
}: let
|
||||||
|
# inherit (self) outputs;
|
||||||
|
systems = ["aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux"];
|
||||||
|
forSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
pkgsFor = system: (import nixpkgs {inherit system;});
|
||||||
|
genPkgs = func: (forSystems (system: func (pkgsFor system)));
|
||||||
|
in {
|
||||||
|
devShells = genPkgs (pkgs: {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
packages = with pkgs; [
|
||||||
|
picotool
|
||||||
|
elf2uf2-rs
|
||||||
|
probe-rs
|
||||||
|
rustup
|
||||||
|
flip-link
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
78
memory.x
Normal file
78
memory.x
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* source: https://github.com/rp-rs/rp-hal/blob/main/rp235x-hal-examples/memory.x
|
||||||
|
*/
|
||||||
|
MEMORY {
|
||||||
|
/*
|
||||||
|
* The RP2350 has either external or internal flash.
|
||||||
|
*
|
||||||
|
* 2 MiB is a safe default here, although a Pico 2 has 4 MiB.
|
||||||
|
*/
|
||||||
|
FLASH : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||||
|
/*
|
||||||
|
* RAM consists of 8 banks, SRAM0-SRAM7, with a striped mapping.
|
||||||
|
* This is usually good for performance, as it distributes load on
|
||||||
|
* those banks evenly.
|
||||||
|
*/
|
||||||
|
RAM : ORIGIN = 0x20000000, LENGTH = 512K
|
||||||
|
/*
|
||||||
|
* RAM banks 8 and 9 use a direct mapping. They can be used to have
|
||||||
|
* memory areas dedicated for some specific job, improving predictability
|
||||||
|
* of access times.
|
||||||
|
* Example: Separate stacks for core0 and core1.
|
||||||
|
*/
|
||||||
|
SRAM4 : ORIGIN = 0x20080000, LENGTH = 4K
|
||||||
|
SRAM5 : ORIGIN = 0x20081000, LENGTH = 4K
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Boot ROM info
|
||||||
|
*
|
||||||
|
* Goes after .vector_table, to keep it in the first 4K of flash
|
||||||
|
* where the Boot ROM (and picotool) can find it
|
||||||
|
*/
|
||||||
|
.start_block : ALIGN(4)
|
||||||
|
{
|
||||||
|
__start_block_addr = .;
|
||||||
|
KEEP(*(.start_block));
|
||||||
|
KEEP(*(.boot_info));
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
} INSERT AFTER .vector_table;
|
||||||
|
|
||||||
|
/* move .text to start /after/ the boot info */
|
||||||
|
_stext = ADDR(.start_block) + SIZEOF(.start_block);
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Picotool 'Binary Info' Entries
|
||||||
|
*
|
||||||
|
* Picotool looks through this block (as we have pointers to it in our
|
||||||
|
* header) to find interesting information.
|
||||||
|
*/
|
||||||
|
.bi_entries : ALIGN(4)
|
||||||
|
{
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_start = .;
|
||||||
|
/* Here are the entries */
|
||||||
|
KEEP(*(.bi_entries));
|
||||||
|
/* Keep this block a nice round size */
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_end = .;
|
||||||
|
} > FLASH
|
||||||
|
} INSERT AFTER .text;
|
||||||
|
|
||||||
|
SECTIONS {
|
||||||
|
/* ### Boot ROM extra info
|
||||||
|
*
|
||||||
|
* Goes after everything in our program, so it can contain a signature.
|
||||||
|
*/
|
||||||
|
.end_block : ALIGN(4)
|
||||||
|
{
|
||||||
|
__end_block_addr = .;
|
||||||
|
KEEP(*(.end_block));
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
} INSERT AFTER .uninit;
|
||||||
|
|
||||||
|
PROVIDE(start_to_end = __end_block_addr - __start_block_addr);
|
||||||
|
PROVIDE(end_to_start = __start_block_addr - __end_block_addr);
|
255
rp235x_riscv.x
Normal file
255
rp235x_riscv.x
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
/*
|
||||||
|
* source: https://github.com/rp-rs/rp-hal/blob/main/rp235x-hal-examples/rp235x_riscv.x
|
||||||
|
*/
|
||||||
|
MEMORY {
|
||||||
|
/*
|
||||||
|
* The RP2350 has either external or internal flash.
|
||||||
|
*
|
||||||
|
* 2 MiB is a safe default here, although a Pico 2 has 4 MiB.
|
||||||
|
*/
|
||||||
|
FLASH : ORIGIN = 0x10000000, LENGTH = 2048K
|
||||||
|
/*
|
||||||
|
* RAM consists of 8 banks, SRAM0-SRAM7, with a striped mapping.
|
||||||
|
* This is usually good for performance, as it distributes load on
|
||||||
|
* those banks evenly.
|
||||||
|
*/
|
||||||
|
RAM : ORIGIN = 0x20000000, LENGTH = 512K
|
||||||
|
/*
|
||||||
|
* RAM banks 8 and 9 use a direct mapping. They can be used to have
|
||||||
|
* memory areas dedicated for some specific job, improving predictability
|
||||||
|
* of access times.
|
||||||
|
* Example: Separate stacks for core0 and core1.
|
||||||
|
*/
|
||||||
|
SRAM4 : ORIGIN = 0x20080000, LENGTH = 4K
|
||||||
|
SRAM5 : ORIGIN = 0x20081000, LENGTH = 4K
|
||||||
|
}
|
||||||
|
|
||||||
|
/* # Developer notes
|
||||||
|
|
||||||
|
- Symbols that start with a double underscore (__) are considered "private"
|
||||||
|
|
||||||
|
- Symbols that start with a single underscore (_) are considered "semi-public"; they can be
|
||||||
|
overridden in a user linker script, but should not be referred from user code (e.g. `extern "C" {
|
||||||
|
static mut _heap_size }`).
|
||||||
|
|
||||||
|
- `EXTERN` forces the linker to keep a symbol in the final binary. We use this to make sure a
|
||||||
|
symbol is not dropped if it appears in or near the front of the linker arguments and "it's not
|
||||||
|
needed" by any of the preceding objects (linker arguments)
|
||||||
|
|
||||||
|
- `PROVIDE` is used to provide default values that can be overridden by a user linker script
|
||||||
|
|
||||||
|
- On alignment: it's important for correctness that the VMA boundaries of both .bss and .data *and*
|
||||||
|
the LMA of .data are all `32`-byte aligned. These alignments are assumed by the RAM
|
||||||
|
initialization routine. There's also a second benefit: `32`-byte aligned boundaries
|
||||||
|
means that you won't see "Address (..) is out of bounds" in the disassembly produced by `objdump`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
PROVIDE(_stext = ORIGIN(FLASH));
|
||||||
|
PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM));
|
||||||
|
PROVIDE(_max_hart_id = 0);
|
||||||
|
PROVIDE(_hart_stack_size = 2K);
|
||||||
|
PROVIDE(_heap_size = 0);
|
||||||
|
|
||||||
|
PROVIDE(InstructionMisaligned = ExceptionHandler);
|
||||||
|
PROVIDE(InstructionFault = ExceptionHandler);
|
||||||
|
PROVIDE(IllegalInstruction = ExceptionHandler);
|
||||||
|
PROVIDE(Breakpoint = ExceptionHandler);
|
||||||
|
PROVIDE(LoadMisaligned = ExceptionHandler);
|
||||||
|
PROVIDE(LoadFault = ExceptionHandler);
|
||||||
|
PROVIDE(StoreMisaligned = ExceptionHandler);
|
||||||
|
PROVIDE(StoreFault = ExceptionHandler);
|
||||||
|
PROVIDE(UserEnvCall = ExceptionHandler);
|
||||||
|
PROVIDE(SupervisorEnvCall = ExceptionHandler);
|
||||||
|
PROVIDE(MachineEnvCall = ExceptionHandler);
|
||||||
|
PROVIDE(InstructionPageFault = ExceptionHandler);
|
||||||
|
PROVIDE(LoadPageFault = ExceptionHandler);
|
||||||
|
PROVIDE(StorePageFault = ExceptionHandler);
|
||||||
|
|
||||||
|
PROVIDE(SupervisorSoft = DefaultHandler);
|
||||||
|
PROVIDE(MachineSoft = DefaultHandler);
|
||||||
|
PROVIDE(SupervisorTimer = DefaultHandler);
|
||||||
|
PROVIDE(MachineTimer = DefaultHandler);
|
||||||
|
PROVIDE(SupervisorExternal = DefaultHandler);
|
||||||
|
PROVIDE(MachineExternal = DefaultHandler);
|
||||||
|
|
||||||
|
PROVIDE(DefaultHandler = DefaultInterruptHandler);
|
||||||
|
PROVIDE(ExceptionHandler = DefaultExceptionHandler);
|
||||||
|
|
||||||
|
/* # Pre-initialization function */
|
||||||
|
/* If the user overrides this using the `#[pre_init]` attribute or by creating a `__pre_init` function,
|
||||||
|
then the function this points to will be called before the RAM is initialized. */
|
||||||
|
PROVIDE(__pre_init = default_pre_init);
|
||||||
|
|
||||||
|
/* A PAC/HAL defined routine that should initialize custom interrupt controller if needed. */
|
||||||
|
PROVIDE(_setup_interrupts = default_setup_interrupts);
|
||||||
|
|
||||||
|
/* # Multi-processing hook function
|
||||||
|
fn _mp_hook() -> bool;
|
||||||
|
|
||||||
|
This function is called from all the harts and must return true only for one hart,
|
||||||
|
which will perform memory initialization. For other harts it must return false
|
||||||
|
and implement wake-up in platform-dependent way (e.g. after waiting for a user interrupt).
|
||||||
|
*/
|
||||||
|
PROVIDE(_mp_hook = default_mp_hook);
|
||||||
|
|
||||||
|
/* # Start trap function override
|
||||||
|
By default uses the riscv crates default trap handler
|
||||||
|
but by providing the `_start_trap` symbol external crates can override.
|
||||||
|
*/
|
||||||
|
PROVIDE(_start_trap = default_start_trap);
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.text.dummy (NOLOAD) :
|
||||||
|
{
|
||||||
|
/* This section is intended to make _stext address work */
|
||||||
|
. = ABSOLUTE(_stext);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.text _stext :
|
||||||
|
{
|
||||||
|
/* Put reset handler first in .text section so it ends up as the entry */
|
||||||
|
/* point of the program. */
|
||||||
|
KEEP(*(.init));
|
||||||
|
KEEP(*(.init.rust));
|
||||||
|
. = ALIGN(4);
|
||||||
|
__start_block_addr = .;
|
||||||
|
KEEP(*(.start_block));
|
||||||
|
KEEP(*(.boot_info));
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.trap);
|
||||||
|
*(.trap.rust);
|
||||||
|
*(.text.abort);
|
||||||
|
*(.text .text.*);
|
||||||
|
. = ALIGN(4);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
/* ### Picotool 'Binary Info' Entries
|
||||||
|
*
|
||||||
|
* Picotool looks through this block (as we have pointers to it in our
|
||||||
|
* header) to find interesting information.
|
||||||
|
*/
|
||||||
|
.bi_entries : ALIGN(4)
|
||||||
|
{
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_start = .;
|
||||||
|
/* Here are the entries */
|
||||||
|
KEEP(*(.bi_entries));
|
||||||
|
/* Keep this block a nice round size */
|
||||||
|
. = ALIGN(4);
|
||||||
|
/* We put this in the header */
|
||||||
|
__bi_entries_end = .;
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.rodata : ALIGN(4)
|
||||||
|
{
|
||||||
|
*(.srodata .srodata.*);
|
||||||
|
*(.rodata .rodata.*);
|
||||||
|
|
||||||
|
/* 4-byte align the end (VMA) of this section.
|
||||||
|
This is required by LLD to ensure the LMA of the following .data
|
||||||
|
section will have the correct alignment. */
|
||||||
|
. = ALIGN(4);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.data : ALIGN(32)
|
||||||
|
{
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
__sidata = LOADADDR(.data);
|
||||||
|
_sdata = .;
|
||||||
|
__sdata = .;
|
||||||
|
/* Must be called __global_pointer$ for linker relaxations to work. */
|
||||||
|
PROVIDE(__global_pointer$ = . + 0x800);
|
||||||
|
*(.sdata .sdata.* .sdata2 .sdata2.*);
|
||||||
|
*(.data .data.*);
|
||||||
|
. = ALIGN(32);
|
||||||
|
_edata = .;
|
||||||
|
__edata = .;
|
||||||
|
} > RAM AT > FLASH
|
||||||
|
|
||||||
|
.bss (NOLOAD) : ALIGN(32)
|
||||||
|
{
|
||||||
|
_sbss = .;
|
||||||
|
*(.sbss .sbss.* .bss .bss.*);
|
||||||
|
. = ALIGN(32);
|
||||||
|
_ebss = .;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
.end_block : ALIGN(4)
|
||||||
|
{
|
||||||
|
__end_block_addr = .;
|
||||||
|
KEEP(*(.end_block));
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
/* fictitious region that represents the memory available for the heap */
|
||||||
|
.heap (NOLOAD) :
|
||||||
|
{
|
||||||
|
_sheap = .;
|
||||||
|
. += _heap_size;
|
||||||
|
. = ALIGN(4);
|
||||||
|
_eheap = .;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* fictitious region that represents the memory available for the stack */
|
||||||
|
.stack (NOLOAD) :
|
||||||
|
{
|
||||||
|
_estack = .;
|
||||||
|
. = ABSOLUTE(_stack_start);
|
||||||
|
_sstack = .;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* fake output .got section */
|
||||||
|
/* Dynamic relocations are unsupported. This section is only used to detect
|
||||||
|
relocatable code in the input files and raise an error if relocatable code
|
||||||
|
is found */
|
||||||
|
.got (INFO) :
|
||||||
|
{
|
||||||
|
KEEP(*(.got .got.*));
|
||||||
|
}
|
||||||
|
|
||||||
|
.eh_frame (INFO) : { KEEP(*(.eh_frame)) }
|
||||||
|
.eh_frame_hdr (INFO) : { *(.eh_frame_hdr) }
|
||||||
|
}
|
||||||
|
|
||||||
|
PROVIDE(start_to_end = __end_block_addr - __start_block_addr);
|
||||||
|
PROVIDE(end_to_start = __start_block_addr - __end_block_addr);
|
||||||
|
|
||||||
|
|
||||||
|
/* Do not exceed this mark in the error messages above | */
|
||||||
|
ASSERT(ORIGIN(FLASH) % 4 == 0, "
|
||||||
|
ERROR(riscv-rt): the start of the FLASH must be 4-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(ORIGIN(RAM) % 32 == 0, "
|
||||||
|
ERROR(riscv-rt): the start of the RAM must be 32-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_stext % 4 == 0, "
|
||||||
|
ERROR(riscv-rt): `_stext` must be 4-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_sdata % 32 == 0 && _edata % 32 == 0, "
|
||||||
|
BUG(riscv-rt): .data is not 32-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_sidata % 32 == 0, "
|
||||||
|
BUG(riscv-rt): the LMA of .data is not 32-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_sbss % 32 == 0 && _ebss % 32 == 0, "
|
||||||
|
BUG(riscv-rt): .bss is not 32-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_sheap % 4 == 0, "
|
||||||
|
BUG(riscv-rt): start of .heap is not 4-byte aligned");
|
||||||
|
|
||||||
|
ASSERT(_stext + SIZEOF(.text) < ORIGIN(FLASH) + LENGTH(FLASH), "
|
||||||
|
ERROR(riscv-rt): The .text section must be placed inside the FLASH region.
|
||||||
|
Set _stext to an address smaller than 'ORIGIN(FLASH) + LENGTH(FLASH)'");
|
||||||
|
|
||||||
|
ASSERT(SIZEOF(.stack) > (_max_hart_id + 1) * _hart_stack_size, "
|
||||||
|
ERROR(riscv-rt): .stack section is too small for allocating stacks for all the harts.
|
||||||
|
Consider changing `_max_hart_id` or `_hart_stack_size`.");
|
||||||
|
|
||||||
|
ASSERT(SIZEOF(.got) == 0, "
|
||||||
|
.got section detected in the input files. Dynamic relocations are not
|
||||||
|
supported. If you are linking to C code compiled using the `gcc` crate
|
||||||
|
then modify your build script to compile the C code _without_ the
|
||||||
|
-fPIC flag. See the documentation of the `gcc::Config.fpic` method for
|
||||||
|
details.");
|
||||||
|
|
||||||
|
/* Do not exceed this mark in the error messages above | */
|
84
src/main.rs
Normal file
84
src/main.rs
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
// source: https://github.com/rp-rs/rp-hal/blob/main/rp235x-hal-examples/src/bin/blinky.rs
|
||||||
|
|
||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
|
// Ensure we halt the program on panic (if we don't mention this crate it won't be linked)
|
||||||
|
use panic_halt as _;
|
||||||
|
|
||||||
|
// Alias for our HAL crate
|
||||||
|
use rp235x_hal as hal;
|
||||||
|
|
||||||
|
// Some things we need
|
||||||
|
use embedded_hal::delay::DelayNs;
|
||||||
|
use embedded_hal::digital::OutputPin;
|
||||||
|
|
||||||
|
/// Tell the Boot ROM about our application
|
||||||
|
#[link_section = ".start_block"]
|
||||||
|
#[used]
|
||||||
|
pub static IMAGE_DEF: hal::block::ImageDef = hal::block::ImageDef::secure_exe();
|
||||||
|
|
||||||
|
/// External high-speed crystal on the Raspberry Pi Pico 2 board is 12 MHz.
|
||||||
|
/// Adjust if your board has a different frequency
|
||||||
|
const XTAL_FREQ_HZ: u32 = 12_000_000u32;
|
||||||
|
|
||||||
|
/// Entry point to our bare-metal application.
|
||||||
|
///
|
||||||
|
/// The `#[hal::entry]` macro ensures the Cortex-M start-up code calls this function
|
||||||
|
/// as soon as all global variables and the spinlock are initialised.
|
||||||
|
///
|
||||||
|
/// The function configures the rp235x peripherals, then toggles a GPIO pin in
|
||||||
|
/// an infinite loop. If there is an LED connected to that pin, it will blink.
|
||||||
|
#[hal::entry]
|
||||||
|
fn main() -> ! {
|
||||||
|
// Grab our singleton objects
|
||||||
|
let mut pac = hal::pac::Peripherals::take().unwrap();
|
||||||
|
|
||||||
|
// Set up the watchdog driver - needed by the clock setup code
|
||||||
|
let mut watchdog = hal::Watchdog::new(pac.WATCHDOG);
|
||||||
|
|
||||||
|
// Configure the clocks
|
||||||
|
let clocks = hal::clocks::init_clocks_and_plls(
|
||||||
|
XTAL_FREQ_HZ,
|
||||||
|
pac.XOSC,
|
||||||
|
pac.CLOCKS,
|
||||||
|
pac.PLL_SYS,
|
||||||
|
pac.PLL_USB,
|
||||||
|
&mut pac.RESETS,
|
||||||
|
&mut watchdog,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let mut timer = hal::Timer::new_timer0(pac.TIMER0, &mut pac.RESETS, &clocks);
|
||||||
|
|
||||||
|
// The single-cycle I/O block controls our GPIO pins
|
||||||
|
let sio = hal::Sio::new(pac.SIO);
|
||||||
|
|
||||||
|
// Set the pins to their default state
|
||||||
|
let pins = hal::gpio::Pins::new(
|
||||||
|
pac.IO_BANK0,
|
||||||
|
pac.PADS_BANK0,
|
||||||
|
sio.gpio_bank0,
|
||||||
|
&mut pac.RESETS,
|
||||||
|
);
|
||||||
|
|
||||||
|
// Configure GPIO25 as an output
|
||||||
|
let mut led_pin = pins.gpio25.into_push_pull_output();
|
||||||
|
loop {
|
||||||
|
led_pin.set_high().unwrap();
|
||||||
|
timer.delay_ms(500);
|
||||||
|
led_pin.set_low().unwrap();
|
||||||
|
timer.delay_ms(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Program metadata for `picotool info`
|
||||||
|
#[link_section = ".bi_entries"]
|
||||||
|
#[used]
|
||||||
|
pub static PICOTOOL_ENTRIES: [hal::binary_info::EntryAddr; 3] = [
|
||||||
|
// hal::binary_info::rp_program_name!(),
|
||||||
|
hal::binary_info::rp_cargo_version!(),
|
||||||
|
hal::binary_info::rp_program_description!(c"Blinky Example"),
|
||||||
|
// hal::binary_info::rp_program_url!(),
|
||||||
|
hal::binary_info::rp_program_build_attribute!(),
|
||||||
|
];
|
Loading…
Reference in a new issue