Skip to content

Move more Core functions to ProbeCore#700

Open
mkeeter wants to merge 4 commits into
masterfrom
mkeeter/remove-more-core-functions
Open

Move more Core functions to ProbeCore#700
mkeeter wants to merge 4 commits into
masterfrom
mkeeter/remove-more-core-functions

Conversation

@mkeeter

@mkeeter mkeeter commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

vid_pid, step, and write_reg are only available on ProbeCore. This PR removes them from the Core trait, adjusting signatures where necessary to force the concrete type.

This comment was marked as resolved.

@mkeeter

mkeeter commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

I had to do a bit of extra wrangling to get the probeless build working; it now skips subcommands which are probe-only, both in the Cargo.toml (optional dependencies) and in codegen (ugly hacks).

Comment thread humility-bin/build.rs
.iter()
.find(|p| metadata[p].name == "humility-bin")
.map(|p| metadata[p].clone())
.unwrap()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turbo-nit: should this maybe be an expect so that, if the build fails, we get an error message that actually tells us what happened?

Comment thread humility-bin/build.rs
Comment on lines +37 to +57
(
// These are everything that can potentially pull in libusb
["probe-rs", "humility-probes-core", "rusb"]
.into_iter()
.collect(),
// We also look at which commands are enabled by the `probes`
// feature on the `humility-bin` crate, then remove them.
metadata
.workspace_members
.iter()
.find(|p| metadata[p].name == "humility-bin")
.map(|p| metadata[p].clone())
.unwrap()
.features["probes"]
.iter()
.flat_map(|p| {
p.strip_prefix("cmd-")
.map(|p| format!("humility-cmd-{p}"))
})
.collect::<BTreeSet<_>>(),
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style nit, take it or leave it: i find throwing all of this in one giant tuple a little hard to follow; what do you think about doing something more like this:

Suggested change
(
// These are everything that can potentially pull in libusb
["probe-rs", "humility-probes-core", "rusb"]
.into_iter()
.collect(),
// We also look at which commands are enabled by the `probes`
// feature on the `humility-bin` crate, then remove them.
metadata
.workspace_members
.iter()
.find(|p| metadata[p].name == "humility-bin")
.map(|p| metadata[p].clone())
.unwrap()
.features["probes"]
.iter()
.flat_map(|p| {
p.strip_prefix("cmd-")
.map(|p| format!("humility-cmd-{p}"))
})
.collect::<BTreeSet<_>>(),
)
// These are everything that can potentially pull in libusb
let banned_deps = ["probe-rs", "humility-probes-core", "rusb"]
.into_iter()
.collect();
// We also look at which commands are enabled by the `probes`
// feature on the `humility-bin` crate, then remove them.
let disabled_cmds = metadata
.workspace_members
.iter()
.find(|p| metadata[p].name == "humility-bin")
.map(|p| metadata[p].clone())
.unwrap()
.features["probes"]
.iter()
.flat_map(|p| {
p.strip_prefix("cmd-")
.map(|p| format!("humility-cmd-{p}"))
})
.collect::<BTreeSet<_>>();
(banned_deps, disabled_cmds)

this is a little more repetitive but i feel like it makes it slightly more obvious which expression corresponds to which variable?

@labbott

labbott commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

I had to do a bit of extra wrangling to get the probeless build working; it now skips subcommands which are probe-only, both in the Cargo.toml (optional dependencies) and in codegen (ugly hacks).

I had hoped to be able to drop this after the probe-rs update but so long as we need to keep CMSIS DAP v1 around we will still need these hacks :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants