Skip to content

Commit

Permalink
hiffy: Remove 'rng' feature.
Browse files Browse the repository at this point in the history
Fixup app.toml files for boards that were still enabling this feature.
  • Loading branch information
flihp committed Jun 24, 2024
1 parent 3e05573 commit 6406f56
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 48 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions app/demo-stm32h7-nucleo/app-h743.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ notifications = ["socket"]

[tasks.hiffy]
name = "task-hiffy"
features = ["h743", "stm32h7", "i2c", "gpio", "spi", "rng"]
features = ["h743", "stm32h7", "i2c", "gpio", "spi"]
priority = 4
max-sizes = {flash = 32768, ram = 32768 }
stacksize = 2048
start = true
task-slots = ["sys", "i2c_driver", "rng_driver"]
task-slots = ["sys", "i2c_driver"]

[tasks.idle]
name = "task-idle"
Expand Down
4 changes: 2 additions & 2 deletions app/gimletlet/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ inherit = "base-gimletlet2.toml"
features = ["dump"]

[tasks.hiffy]
features = ["h753", "stm32h7", "i2c", "gpio", "qspi", "rng", "hash", "sprot"]
task-slots = ["hash_driver", "hf", "i2c_driver", "rng_driver", "sprot", "sys", "update_server", "user_leds"]
features = ["h753", "stm32h7", "i2c", "gpio", "qspi", "hash", "sprot"]
task-slots = ["hash_driver", "hf", "i2c_driver", "sprot", "sys", "update_server", "user_leds"]

[tasks.jefe]
features = ["dump"]
Expand Down
4 changes: 2 additions & 2 deletions app/lpc55xpresso/app-sprot.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ request_reset = ["update_server"]
[tasks.hiffy]
name = "task-hiffy"
priority = 5
features = ["lpc55", "gpio", "rng"]
features = ["lpc55", "gpio"]
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 2048
start = true
task-slots = ["gpio_driver", "rng_driver", "update_server"]
task-slots = ["gpio_driver", "update_server"]

[tasks.idle]
name = "task-idle"
Expand Down
4 changes: 2 additions & 2 deletions app/lpc55xpresso/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ request_reset = ["update_server"]
[tasks.hiffy]
name = "task-hiffy"
priority = 5
features = ["lpc55", "gpio", "rng"]
features = ["lpc55", "gpio"]
max-sizes = {flash = 32768, ram = 16384 }
stacksize = 2048
start = true
task-slots = ["gpio_driver", "rng_driver", "update_server"]
task-slots = ["gpio_driver", "update_server"]

[tasks.idle]
name = "task-idle"
Expand Down
2 changes: 0 additions & 2 deletions task/hiffy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ drv-gimlet-hf-api = { path = "../../drv/gimlet-hf-api", optional = true }
drv-hash-api = { path = "../../drv/hash-api", optional = true }
drv-i2c-api = { path = "../../drv/i2c-api" }
drv-lpc55-gpio-api = { path = "../../drv/lpc55-gpio-api", optional = true }
drv-rng-api = { path = "../../drv/rng-api", optional = true }
drv-sp-ctrl-api = { path = "../../drv/sp-ctrl-api", optional = true }
drv-spi-api = { path = "../../drv/spi-api" }
drv-sprot-api = { path = "../../drv/sprot-api", optional = true }
Expand Down Expand Up @@ -57,7 +56,6 @@ g031 = ["stm32g0", "drv-stm32xx-i2c/g031", "build-i2c/g031"]
g030 = ["stm32g0", "drv-stm32xx-i2c/g030", "build-i2c/g030"]
micro = ["no-ipc-counters"]
panic-messages = ["userlib/panic-messages"]
rng = ["drv-rng-api"]
spctrl = ["drv-sp-ctrl-api"]

# This section is here to discourage RLS/rust-analyzer from doing test builds,
Expand Down
29 changes: 0 additions & 29 deletions task/hiffy/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -998,32 +998,3 @@ pub(crate) fn hash_finalize_sha256(
rval[..hash::SHA256_SZ].copy_from_slice(&sha256sum);
Ok(hash::SHA256_SZ)
}

#[cfg(feature = "rng")]
task_slot!(RNG, rng_driver);

#[cfg(feature = "rng")]
pub(crate) fn rng_fill(
stack: &[Option<u32>],
_data: &[u8],
rval: &mut [u8],
) -> Result<usize, Failure> {
use drv_rng_api::Rng;

if stack.is_empty() {
return Err(Failure::Fault(Fault::MissingParameters));
}
if stack.len() > 1 {
return Err(Failure::Fault(Fault::BadParameter(2)));
}

let frame = &stack[stack.len() - 1..];
let count =
frame[0].ok_or(Failure::Fault(Fault::MissingParameters))? as usize;
if count > rval.len() {
return Err(Failure::Fault(Fault::AccessOutOfBounds));
}

func_err(Rng::from(RNG.get_task_id()).fill(&mut rval[0..count]))?;
Ok(count)
}
4 changes: 0 additions & 4 deletions task/hiffy/src/lpc55.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ pub enum Functions {
(drv_lpc55_gpio_api::Pin, drv_lpc55_gpio_api::Direction),
u32,
),
#[cfg(feature = "rng")]
Rng(usize, drv_rng_api::RngError),
#[cfg(feature = "spi")]
SpiRead((Task, u8, usize, usize), drv_spi_api::SpiError),
#[cfg(feature = "spi")]
Expand Down Expand Up @@ -364,8 +362,6 @@ pub(crate) static HIFFY_FUNCS: &[Function] = &[
gpio_configure,
#[cfg(feature = "gpio")]
gpio_direction,
#[cfg(feature = "rng")]
crate::common::rng_fill,
#[cfg(feature = "spi")]
spi_read,
#[cfg(feature = "spi")]
Expand Down
4 changes: 0 additions & 4 deletions task/hiffy/src/stm32h7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ pub enum Functions {
HashUpdate(u32, drv_hash_api::HashError),
#[cfg(feature = "hash")]
HashFinalize((), drv_hash_api::HashError),
#[cfg(feature = "rng")]
Rng(usize, drv_rng_api::RngError),
}

#[cfg(feature = "i2c")]
Expand Down Expand Up @@ -578,8 +576,6 @@ pub(crate) static HIFFY_FUNCS: &[Function] = &[
hash_update,
#[cfg(feature = "hash")]
hash_finalize_sha256,
#[cfg(feature = "rng")]
crate::common::rng_fill,
];

//
Expand Down

0 comments on commit 6406f56

Please sign in to comment.