refacfeat: i think it works with hal?

This commit is contained in:
cscherr 2025-04-17 15:59:01 +02:00
parent 010712412d
commit 965bdc5b8e
Signed by: cscherrNT
GPG key ID: 8E2B45BC51A27EA7
4 changed files with 165 additions and 10 deletions

155
Cargo.lock generated
View file

@ -2,6 +2,21 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 4 version = 4
[[package]]
name = "as-slice"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516"
dependencies = [
"stable_deref_trait",
]
[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]] [[package]]
name = "bare-metal" name = "bare-metal"
version = "0.2.5" version = "0.2.5"
@ -11,19 +26,40 @@ dependencies = [
"rustc_version", "rustc_version",
] ]
[[package]]
name = "bare-metal"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603"
[[package]] [[package]]
name = "bitfield" name = "bitfield"
version = "0.13.2" version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
[[package]]
name = "cast"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
[[package]]
name = "chrono"
version = "0.4.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "cortex-m" name = "cortex-m"
version = "0.7.7" version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9"
dependencies = [ dependencies = [
"bare-metal", "bare-metal 0.2.5",
"bitfield", "bitfield",
"critical-section", "critical-section",
"embedded-hal", "embedded-hal",
@ -66,6 +102,15 @@ dependencies = [
"void", "void",
] ]
[[package]]
name = "embedded-time"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7a4b4d10ac48d08bfe3db7688c402baadb244721f30a77ce360bd24c3dffe58"
dependencies = [
"num",
]
[[package]] [[package]]
name = "nb" name = "nb"
version = "0.1.3" version = "0.1.3"
@ -89,6 +134,69 @@ dependencies = [
"cortex-m-rt", "cortex-m-rt",
"panic-rtt-target", "panic-rtt-target",
"rtt-target", "rtt-target",
"stm32l0xx-hal",
]
[[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.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
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.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
] ]
[[package]] [[package]]
@ -119,6 +227,15 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rtcc"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95973c3a0274adc4f3c5b70d2b5b85618d6de9559a6737d3293ecae9a2fc0839"
dependencies = [
"chrono",
]
[[package]] [[package]]
name = "rtt-target" name = "rtt-target"
version = "0.5.0" version = "0.5.0"
@ -153,6 +270,42 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "stm32l0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37c35ac5e2c330137c257b7254eb4593e3e8312104dedc1880447654cb8dd50f"
dependencies = [
"bare-metal 1.0.0",
"cortex-m",
"cortex-m-rt",
"vcell",
]
[[package]]
name = "stm32l0xx-hal"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e481a2554bbcbb7da494fe3adfc901bbf106f9880c898b22728b3709bf6f22d1"
dependencies = [
"as-slice",
"cast",
"cortex-m",
"cortex-m-rt",
"embedded-hal",
"embedded-time",
"nb 1.1.0",
"rtcc",
"stm32l0",
"void",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.100" version = "2.0.100"

View file

@ -8,7 +8,14 @@ cortex-m = { version = "0.7.7", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.3" cortex-m-rt = "0.7.3"
panic-rtt-target = "0.1.3" panic-rtt-target = "0.1.3"
rtt-target = "0.5.0" rtt-target = "0.5.0"
# hal = { package = "stm32-hal2", version = "1.8.3", features = ["l4x3", "l4rt"] }
hal = { package = "stm32l0xx-hal", version = "0.10.0", features = [
"rt",
"stm32l0x3",
"flash-192",
"ram-20",
# "mcu-STM32L053R8", # does not exist in that crate
] }
[[bin]] [[bin]]
name = "nucleo-l053r8-blink" name = "nucleo-l053r8-blink"

View file

@ -1,8 +0,0 @@
# FLASH 0x08000000 - 0x0802FFFF 192K
# RAM 0x20000000 - 0x20004FFF 20K
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 192K
RAM : ORIGIN = 0x20000000, LENGTH = 20K
}

View file

@ -4,6 +4,7 @@
// We need to use cortex_m here so the linker can find it's critical-section, but we import is as // We need to use cortex_m here so the linker can find it's critical-section, but we import is as
// an underscore since we don't directly use any of its symbols. // an underscore since we don't directly use any of its symbols.
use cortex_m as _; use cortex_m as _;
use cortex_m::delay::Delay;
// The entry import gives us a macro to indicate where the microcontroller should start the // The entry import gives us a macro to indicate where the microcontroller should start the
// program, and also sets up the FPU on our Cortex-M4F. // program, and also sets up the FPU on our Cortex-M4F.
@ -13,6 +14,8 @@ use cortex_m_rt::entry;
use panic_rtt_target as _; use panic_rtt_target as _;
use rtt_target::{rprintln, rtt_init_print}; use rtt_target::{rprintln, rtt_init_print};
use hal as _;
// Start here, and don't ever return from this function. // Start here, and don't ever return from this function.
#[entry] #[entry]
fn main() -> ! { fn main() -> ! {