aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/stm32f4/.cargo/config.toml6
-rw-r--r--examples/stm32f4/.vscode/launch.json33
-rw-r--r--examples/stm32f4/.vscode/tasks.json21
-rw-r--r--examples/stm32f4/Cargo.toml2
-rw-r--r--examples/stm32f4/openocd.cfg5
-rw-r--r--examples/stm32f4/openocd.gdb40
6 files changed, 104 insertions, 3 deletions
diff --git a/examples/stm32f4/.cargo/config.toml b/examples/stm32f4/.cargo/config.toml
index 16efa8e6f..f5a4af51a 100644
--- a/examples/stm32f4/.cargo/config.toml
+++ b/examples/stm32f4/.cargo/config.toml
@@ -1,9 +1,11 @@
1[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
2# replace STM32F429ZITx with your chip as listed in `probe-rs chip list` 2# replace STM32F429ZITx with your chip as listed in `probe-rs chip list`
3runner = "probe-rs run --chip STM32F429ZITx" 3# runner = "probe-rs run --chip STM32F429ZITx"
4runner = "arm-none-eabi-gdb -q -x openocd.gdb"
4 5
5[build] 6[build]
6target = "thumbv7em-none-eabi" 7# target = "thumbv7em-none-eabi"
8target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
7 9
8[env] 10[env]
9DEFMT_LOG = "trace" 11DEFMT_LOG = "trace"
diff --git a/examples/stm32f4/.vscode/launch.json b/examples/stm32f4/.vscode/launch.json
new file mode 100644
index 000000000..59f98070d
--- /dev/null
+++ b/examples/stm32f4/.vscode/launch.json
@@ -0,0 +1,33 @@
1{
2 /*
3 * Requires the Rust Language Server (rust-analyzer) and Cortex-Debug extensions
4 * https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer
5 * https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug
6 */
7 "version": "0.2.0",
8 "configurations": [
9 {
10 /* Configuration for the STM32F446 Discovery board */
11 "type": "cortex-debug",
12 "request": "launch",
13 "name": "Debug (OpenOCD)",
14 "servertype": "openocd",
15 "cwd": "${workspaceRoot}",
16 "preLaunchTask": "Cargo Build (debug)",
17 "runToEntryPoint": "main",
18 "executable": "./target/thumbv7em-none-eabihf/debug/multiprio",
19 /* Run `cargo build --example itm` and uncomment this line to run itm example */
20 // "executable": "./target/thumbv7em-none-eabihf/debug/examples/itm",
21 "device": "STM32F446RET6",
22 "configFiles": [
23 "interface/stlink.cfg",
24 "target/stm32f4x.cfg"
25 ],
26 "postLaunchCommands": [
27 "monitor arm semihosting enable"
28 ],
29 "postRestartCommands": [],
30 "postResetCommands": [],
31 }
32 ]
33} \ No newline at end of file
diff --git a/examples/stm32f4/.vscode/tasks.json b/examples/stm32f4/.vscode/tasks.json
new file mode 100644
index 000000000..3cbed84b4
--- /dev/null
+++ b/examples/stm32f4/.vscode/tasks.json
@@ -0,0 +1,21 @@
1{
2 "version": "2.0.0",
3 "tasks": [
4 {
5 "type": "cargo",
6 "command": "build",
7 "problemMatcher": [
8 "$rustc"
9 ],
10 "args": [
11 "--bin",
12 "multiprio"
13 ],
14 "group": {
15 "kind": "build",
16 "isDefault": true
17 },
18 "label": "Cargo Build (debug)",
19 }
20 ]
21} \ No newline at end of file
diff --git a/examples/stm32f4/Cargo.toml b/examples/stm32f4/Cargo.toml
index 1eb1ae6db..ee7594c95 100644
--- a/examples/stm32f4/Cargo.toml
+++ b/examples/stm32f4/Cargo.toml
@@ -6,7 +6,7 @@ license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
8# Change stm32f429zi to your chip name, if necessary. 8# Change stm32f429zi to your chip name, if necessary.
9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f429zi", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] } 9embassy-stm32 = { version = "0.1.0", path = "../../embassy-stm32", features = ["defmt", "stm32f446re", "unstable-pac", "memory-x", "time-driver-any", "exti", "chrono"] }
10embassy-sync = { version = "0.5.0", path = "../../embassy-sync", features = ["defmt"] } 10embassy-sync = { version = "0.5.0", path = "../../embassy-sync", features = ["defmt"] }
11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] } 11embassy-executor = { version = "0.5.0", path = "../../embassy-executor", features = ["task-arena-size-32768", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
12embassy-time = { version = "0.3.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] } 12embassy-time = { version = "0.3.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768"] }
diff --git a/examples/stm32f4/openocd.cfg b/examples/stm32f4/openocd.cfg
new file mode 100644
index 000000000..e41d52b1a
--- /dev/null
+++ b/examples/stm32f4/openocd.cfg
@@ -0,0 +1,5 @@
1# Sample OpenOCD configuration for the STM32F3DISCOVERY development board
2
3source [find interface/stlink.cfg]
4
5source [find target/stm32f4x.cfg]
diff --git a/examples/stm32f4/openocd.gdb b/examples/stm32f4/openocd.gdb
new file mode 100644
index 000000000..7795319fb
--- /dev/null
+++ b/examples/stm32f4/openocd.gdb
@@ -0,0 +1,40 @@
1target extended-remote :3333
2
3# print demangled symbols
4set print asm-demangle on
5
6# set backtrace limit to not have infinite backtrace loops
7set backtrace limit 32
8
9# detect unhandled exceptions, hard faults and panics
10break DefaultHandler
11break HardFault
12break rust_begin_unwind
13# # run the next few lines so the panic message is printed immediately
14# # the number needs to be adjusted for your panic handler
15# commands $bpnum
16# next 4
17# end
18
19# *try* to stop at the user entry point (it might be gone due to inlining)
20break main
21
22monitor arm semihosting enable
23
24# # send captured ITM to the file itm.fifo
25# # (the microcontroller SWO pin must be connected to the programmer SWO pin)
26# # 8000000 must match the core clock frequency
27# monitor tpiu config internal itm.txt uart off 8000000
28
29# # OR: make the microcontroller SWO pin output compatible with UART (8N1)
30# # 8000000 must match the core clock frequency
31# # 2000000 is the frequency of the SWO pin
32# monitor tpiu config external uart off 8000000 2000000
33
34# # enable ITM port 0
35# monitor itm port 0 on
36
37load
38
39# start the process but immediately halt the processor
40stepi