Skip to content

Commit f0e9f43

Browse files
lab05: add solutions (#12)
* solved and added some of the comments * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * fixed solution display * delete unused line * add comments * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * fix build * fix error * fix typo * added comments and used the scale values * added a comment * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> * typo Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com> --------- Co-authored-by: Omer Genan <81963672+genan2003@users.noreply.github.com>
1 parent e9e38e2 commit f0e9f43

19 files changed

Lines changed: 2859 additions & 13 deletions

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,28 @@ target
1919
# and can be added to the global gitignore or merged into this file. For a more nuclear
2020
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
2121
#.idea/
22+
23+
# MacOS
24+
#
25+
## Folder view configuration files
26+
.DS_Store
27+
Desktop.ini
28+
29+
# Thumbnail cache files
30+
._*
31+
Thumbs.db
32+
33+
# Files that might appear on external disks
34+
.Spotlight-V100
35+
.Trashes
36+
37+
# Compiled Python files
38+
*.pyc
39+
40+
# Compiled C++ files
41+
*.out
42+
43+
# Application specific files
44+
venv
45+
node_modules
46+
.sass-cache

Cargo.lock

Lines changed: 95 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
resolver = "3"
3-
members = ["lab01", "lab02", "lab03", "lab04"]
3+
members = ["lab01", "lab02", "lab03", "lab04", "lab05"]
44

55
[workspace.dependencies]
66
# Low level access to Cortex-M processors

codebook.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
words = [
22
"boostrap",
33
"chrono",
4+
"clk",
45
"debouncer",
56
"defmt",
7+
"dma",
68
"dyn",
79
"eabihf",
810
"exti",
11+
"gpdma",
912
"ish",
1013
"linker's",
1114
"mcu",
15+
"microcontroller",
1216
"mille",
17+
"mipidsi",
1318
"moder",
19+
"mosi",
20+
"mpu",
1421
"nmagic",
1522
"pwm",
1623
"pwm's",
@@ -21,4 +28,5 @@ words = [
2128
"tlink",
2229
"uptime",
2330
"vcc",
31+
"xout",
2432
]

lab05/.cargo/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
target = "thumbv8m.main-none-eabihf"
3+
4+
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
5+
runner = "probe-rs run --chip STM32U545RETxQ"
6+
7+
[env]
8+
DEFMT_LOG = "debug"

lab05/Cargo.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[package]
2+
name = "lab05"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
# Low level access to Cortex-M processors
8+
cortex-m.workspace = true
9+
# Boostrap crate for Cortex-M Processors
10+
cortex-m-rt.workspace = true
11+
# Defmt support
12+
defmt.workspace = true
13+
defmt-rtt.workspace = true
14+
# Embedded HAL utilities
15+
embassy-embedded-hal.workspace = true
16+
# Async/await executor
17+
embassy-executor.workspace = true
18+
# Utilities for working with futures, compatible with no_std and not using alloc
19+
embassy-futures.workspace = true
20+
# STM32 HAL Implementation
21+
embassy-stm32.workspace = true
22+
# Synchronization primitives and data structures with async support
23+
embassy-sync.workspace = true
24+
# Timekeeping, delays and timeouts
25+
embassy-time.workspace = true
26+
embedded-graphics = "0.8.1"
27+
embedded-hal = "1.0.0"
28+
embedded-hal-async = "1.0.0"
29+
heapless = "0.9.2"
30+
mipidsi = "0.9.0"
31+
# Panic handler that exits `probe-run` with an error code
32+
panic-probe.workspace = true

lab05/build.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//! This build script copies the `memory.x` file from the crate root into
2+
//! a directory where the linker can always find it at build time.
3+
//! For many projects this is optional, as the linker always searches the
4+
//! project root directory -- wherever `Cargo.toml` is. However, if you
5+
//! are using a workspace or have a more complicated build setup, this
6+
//! build script becomes required. Additionally, by requesting that
7+
//! Cargo re-run the build script whenever `memory.x` is changed,
8+
//! updating `memory.x` ensures a rebuild of the application with the
9+
//! new memory settings.
10+
11+
// use std::env;
12+
// use std::fs::File;
13+
// use std::io::Write;
14+
// use std::path::PathBuf;
15+
16+
fn main() {
17+
// This section is not needed as the `embassy-stm32` crate
18+
// provides `memory.x` and adds it to the linker's path.
19+
//
20+
// If using a crate that does not provide it, please
21+
// uncomment the this section and the related imported
22+
// items.
23+
24+
// Put `memory.x` in our output directory and ensure it's
25+
// on the linker search path.
26+
// let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
27+
// File::create(out.join("memory.x"))
28+
// .unwrap()
29+
// .write_all(include_bytes!("memory.x"))
30+
// .unwrap();
31+
// println!("cargo:rustc-link-search={}", out.display());
32+
33+
// By default, Cargo will re-run a build script whenever
34+
// any file in the project changes. By specifying `memory.x`
35+
// here, we ensure the build script is only re-run when
36+
// `memory.x` is changed.
37+
// println!("cargo:rerun-if-changed=memory.x");
38+
39+
// Prevent the linker from page aligning segments
40+
println!("cargo:rustc-link-arg-bins=--nmagic");
41+
42+
// Required for `cortex-m`
43+
println!("cargo:rustc-link-arg-bins=-Tlink.x");
44+
// Required for `defmt`
45+
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
46+
}

0 commit comments

Comments
 (0)