Skip to content

Commit

Permalink
Completely remove ITM and semihosting
Browse files Browse the repository at this point in the history
We no longer have any need for these features and they are mostly
just sitting around as some copy/paste. Remove them.
  • Loading branch information
labbott committed Sep 14, 2023
1 parent 0ffe007 commit 681282f
Show file tree
Hide file tree
Showing 38 changed files with 26 additions and 157 deletions.
13 changes: 0 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ num = { version = "0.4", default-features = false }
num-derive = { version = "0.3.3", default-features = false, features = ["full-syntax"] }
num-traits = { version = "0.2.12", default-features = false }
panic-halt = { version = "0.2.0", default-features = false }
panic-itm = { version = "0.4.1", default-features = false }
panic-semihosting = { version = "0.5.3", default-features = false }
paste = { version = "1", default-features = false }
path-slash = { version = "0.1.3", default-features = false }
proc-macro2 = { version = "1", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ notifications = ["socket"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h743", "stm32h7", "itm", "i2c", "gpio", "spi", "rng"]
features = ["h743", "stm32h7", "i2c", "gpio", "spi", "rng"]
priority = 4
max-sizes = {flash = 32768, ram = 32768 }
stacksize = 2048
Expand Down
2 changes: 1 addition & 1 deletion app/demo-stm32h7-nucleo/app-h753.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ notifications = ["socket"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "spi", "qspi", "hash"]
features = ["h753", "stm32h7", "i2c", "gpio", "spi", "qspi", "hash"]
priority = 5
max-sizes = {flash = 32768, ram = 32768 }
stacksize = 2048
Expand Down
4 changes: 2 additions & 2 deletions app/gemini-bu/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ task-slots = ["jefe"]

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c1", "i2c3", "i2c4"]
Expand Down Expand Up @@ -103,7 +103,7 @@ task-slots = ["sys"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "spi", "qspi", "hash", "sprot"]
features = ["h753", "stm32h7", "i2c", "gpio", "spi", "qspi", "hash", "sprot"]
priority = 7
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 2048
Expand Down
12 changes: 6 additions & 6 deletions app/gimlet/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ notifications = ["spi-irq"]

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 3
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c2", "i2c3", "i2c4"]
Expand All @@ -89,7 +89,7 @@ notifications = ["i2c2-irq", "i2c3-irq", "i2c4-irq"]

[tasks.spd]
name = "task-spd"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 16384}
uses = ["i2c1"]
Expand All @@ -112,7 +112,7 @@ features = ["gimlet"]

[tasks.thermal]
name = "task-thermal"
features = ["itm", "gimlet"]
features = ["gimlet"]
priority = 5
max-sizes = {flash = 32768, ram = 8192 }
stacksize = 6000
Expand All @@ -122,7 +122,7 @@ notifications = ["timer"]

[tasks.power]
name = "task-power"
features = ["itm", "gimlet"]
features = ["gimlet"]
priority = 6
max-sizes = {flash = 32768, ram = 8192 }
stacksize = 1504
Expand All @@ -132,7 +132,7 @@ notifications = ["timer"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "spi", "qspi", "hash", "sprot"]
features = ["h753", "stm32h7", "i2c", "gpio", "spi", "qspi", "hash", "sprot"]
priority = 5
max-sizes = {flash = 32768, ram = 32768 }
stacksize = 1024
Expand Down Expand Up @@ -191,7 +191,7 @@ notifications = ["flash-irq"]

[tasks.sensor]
name = "task-sensor"
features = ["itm"]
features = []
priority = 4
max-sizes = {flash = 8192, ram = 8192 }
stacksize = 1024
Expand Down
2 changes: 1 addition & 1 deletion app/gimletlet/app-meanwell.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ notifications = ["timer"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "gpio"]
features = ["h753", "stm32h7", "gpio"]
priority = 4
max-sizes = {flash = 32768, ram = 32768}
stacksize = 2048
Expand Down
2 changes: 1 addition & 1 deletion app/gimletlet/app-mgmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ notifications = ["timer"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "gpio", "spi"]
features = ["h753", "stm32h7", "gpio", "spi"]
priority = 3
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 2048
Expand Down
4 changes: 2 additions & 2 deletions app/gimletlet/app-sidecar-emulator.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ task-slots = ["jefe"]

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c3", "i2c4"]
Expand Down Expand Up @@ -78,7 +78,7 @@ notifications = ["timer"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "spi"]
features = ["h753", "stm32h7", "i2c", "gpio", "spi"]
priority = 3
max-sizes = {flash = 32768, ram = 32768}
stacksize = 2048
Expand Down
6 changes: 3 additions & 3 deletions app/gimletlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ task-slots = ["jefe"]

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c2", "i2c3", "i2c4"]
Expand Down Expand Up @@ -138,7 +138,7 @@ notifications = [

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "qspi", "rng", "hash", "sprot"]
features = ["h753", "stm32h7", "i2c", "gpio", "qspi", "rng", "hash", "sprot"]
priority = 7
max-sizes = {flash = 32768, ram = 32768}
stacksize = 2048
Expand Down Expand Up @@ -244,7 +244,7 @@ interrupts = {"usart1.irq" = "usart-irq"}

[tasks.sensor]
name = "task-sensor"
features = ["itm"]
features = []
priority = 5
max-sizes = {flash = 8192, ram = 2048 }
stacksize = 1024
Expand Down
4 changes: 2 additions & 2 deletions app/psc/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ task-slots = ["jefe"]

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c2", "i2c3"]
Expand Down Expand Up @@ -85,7 +85,7 @@ notifications = ["flash-irq"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "sprot"]
features = ["h753", "stm32h7", "i2c", "gpio", "sprot"]
priority = 5
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 1024
Expand Down
10 changes: 5 additions & 5 deletions app/sidecar/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ interrupts = {"spi2.irq" = "spi-irq"}

[tasks.i2c_driver]
name = "drv-stm32xx-i2c-server"
features = ["h753", "itm"]
features = ["h753"]
priority = 2
max-sizes = {flash = 16384, ram = 4096}
uses = ["i2c1", "i2c2", "i2c3", "i2c4"]
Expand All @@ -169,7 +169,7 @@ task-slots = ["sys"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h753", "stm32h7", "itm", "i2c", "gpio", "sprot"]
features = ["h753", "stm32h7", "i2c", "gpio", "sprot"]
priority = 5
max-sizes = {flash = 32768, ram = 32768 }
stacksize = 1024
Expand All @@ -178,7 +178,7 @@ task-slots = ["sys", "i2c_driver", "sprot"]

[tasks.sensor]
name = "task-sensor"
features = ["itm"]
features = []
priority = 4
max-sizes = {flash = 8192, ram = 4096 }
stacksize = 1024
Expand Down Expand Up @@ -250,7 +250,7 @@ notifications = ["timer"]

[tasks.thermal]
name = "task-thermal"
features = ["itm", "sidecar"]
features = ["sidecar"]
priority = 5
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 8096
Expand All @@ -260,7 +260,7 @@ notifications = ["timer"]

[tasks.power]
name = "task-power"
features = ["itm", "sidecar"]
features = ["sidecar"]
priority = 6
max-sizes = {flash = 32768, ram = 8192 }
stacksize = 2048
Expand Down
2 changes: 0 additions & 2 deletions drv/stm32g0-usart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ edition = "2021"

[dependencies]
cortex-m = { workspace = true }
cortex-m-semihosting = { workspace = true }
num-traits = { workspace = true }
stm32g0 = { workspace = true }
zerocopy = { workspace = true }
Expand All @@ -20,7 +19,6 @@ build-util = { path = "../../build/util" }
g031 = ["stm32g0/stm32g031", "drv-stm32xx-sys-api/g031"]
g070 = ["stm32g0/stm32g070", "drv-stm32xx-sys-api/g070"]
g0b1 = ["stm32g0/stm32g0b1", "drv-stm32xx-sys-api/g0b1"]
semihosting = ["userlib/log-semihosting"]

# This section is here to discourage RLS/rust-analyzer from doing test builds,
# since test builds don't work for cross compilation.
Expand Down
1 change: 0 additions & 1 deletion drv/stm32xx-i2c-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ h743 = ["stm32h7/stm32h743", "drv-stm32xx-i2c/h743", "drv-stm32xx-sys-api/h743",
h753 = ["stm32h7/stm32h753", "drv-stm32xx-i2c/h753", "drv-stm32xx-sys-api/h753", "build-i2c/h753"]
g031 = ["stm32g0/stm32g031", "drv-stm32xx-i2c/g031", "drv-stm32xx-sys-api/g031",
"build-i2c/g031", "ringbuf/disabled"]
itm = []

# This section is here to discourage RLS/rust-analyzer from doing test builds,
# since test builds don't work for cross compilation.
Expand Down
2 changes: 0 additions & 2 deletions lib/lpc55-romapi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ edition = "2021"
[features]
default = ["panic-messages"]
panic-messages = []
log-itm = []
log-semihosting = []

[dependencies]
lpc55-pac = { workspace = true }
Expand Down
2 changes: 0 additions & 2 deletions sys/userlib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ edition = "2021"

[features]
panic-messages = []
log-itm = []
log-semihosting = []
log-null = []

[dependencies]
Expand Down
2 changes: 0 additions & 2 deletions sys/userlib/README.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ for use in task programs.
binary size and worst-case stack usage. Generally this feature should only be
set in the top-level task, _not_ in libraries.

- `log-itm` / `log-semihosting`: select one of two backends for the `log!`
macros. If you provide neither, the log macros won't compile.
62 changes: 0 additions & 62 deletions sys/userlib/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,6 @@
pub use bstringify;
pub use paste;

cfg_if::cfg_if! {
if #[cfg(feature = "log-itm")] {
#[macro_export]
macro_rules! sys_log {
($s:expr) => {
unsafe {
let stim = &mut (*cortex_m::peripheral::ITM::PTR).stim[1];
cortex_m::iprintln!(stim, $s);
}
};
($s:expr, $($tt:tt)*) => {
unsafe {
let stim = &mut (*cortex_m::peripheral::ITM::PTR).stim[1];
cortex_m::iprintln!(stim, $s, $($tt)*);
}
};
}
} else if #[cfg(feature = "log-semihosting")] {
#[macro_export]
macro_rules! sys_log {
($s:expr) => {
{ let _ = cortex_m_semihosting::hprintln!($s); }
};
($s:expr, $($tt:tt)*) => {
{ let _ = cortex_m_semihosting::hprintln!($s, $($tt)*); }
};
}
} else if #[cfg(feature = "log-null")] {
#[macro_export]
macro_rules! sys_log {
($s:expr) => {};
($s:expr, $($x:expr),*$(,)?) => {
{
$(
let _ = &$x;
)*
}
};
}
} else {
// Note: we provide macros that contain compile_error, instead of just
// using compile_error here, to allow programs to omit these features
// if they don't use logging.

#[macro_export]
macro_rules! sys_log {
($s:expr) => {
compile_error!(concat!(
"to use sys_log! must enable either ",
"'log-semihosting' or 'log-itm' feature"
))
};
($s:expr, $($tt:tt)*) => {
compile_error!(concat!(
"to use sys_log! must enable either ",
"'log-semihosting' or 'log-itm' feature"
))
};
}
}
}

#[macro_export]
macro_rules! task_slot {
($vis:vis $var:ident, $task_name:ident) => {
Expand Down
2 changes: 0 additions & 2 deletions task/hiffy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ cfg-if.workspace = true

[features]
testsuite = [ "test-api" ]
itm = [ "userlib/log-itm" ]
semihosting = [ "userlib/log-semihosting" ]
i2c = []
gpio = []
spi = []
Expand Down
Loading

0 comments on commit 681282f

Please sign in to comment.