ChanServ changed the topic of #rust-embedded to: Welcome to the Rust Embedded IRC channel! Bridged to #rust-embedded:matrix.org and logged at https://libera.irclog.whitequark.org/rust-embedded, code of conduct at https://www.rust-lang.org/conduct.html
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
rardiol has joined #rust-embedded
starblue1 has quit [Ping timeout: 268 seconds]
starblue1 has joined #rust-embedded
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
rardiol has joined #rust-embedded
causal has quit [Read error: Connection reset by peer]
causal_ has joined #rust-embedded
causal_ has quit [Quit: WeeChat 3.5]
limpkin has quit [Ping timeout: 256 seconds]
rektide_ has quit [Ping timeout: 256 seconds]
limpkin has joined #rust-embedded
rektide has joined #rust-embedded
starblue1 has quit [Ping timeout: 268 seconds]
starblue1 has joined #rust-embedded
crabbedhaloablut has quit [Ping timeout: 268 seconds]
crabbedhaloablut has joined #rust-embedded
cr1901 has quit [Ping timeout: 272 seconds]
cr1901 has joined #rust-embedded
explore has quit [Quit: Connection closed for inactivity]
rardiol has quit [Ping timeout: 268 seconds]
explore has joined #rust-embedded
<re_irc> <James Logan> chrysn: the only way I've found to guarantee that a crate is really no-std compatible (and stays that way) is to add a separate no-std test crate and build that test crate for a target with no OS as part of testing, and require passing tests to merge to main
<re_irc> <James Logan> example test crate for no-std check here: https://github.com/jlogan03/catnip/tree/jlogan/bitfield/test/test_no_std
<re_irc> <James Logan> and the ci workflow that actually builds it to check compatibility is here https://github.com/jlogan03/catnip/blob/jlogan/bitfield/.github/workflows/github-actions.yaml#L29
<re_irc> <James Logan> note that example uses LTO in order to also check panic-never compatibility, but you may not want that for testing no-std compatibility as thoroughly as possible
<re_irc> <James Logan> ^ (uses LTO because otherwise panic branches do not get optimized out, and compilation will always fail with panic-never)
<re_irc> <chrysn (@chrysn:matrix.org)> Nice, thanks, I'll use that!
* re_irc chrysn (@chrysn:matrix.org) reads on what catnip is ... cool: no-std, heapless, minimal ... oh, physically-secured, that's not something I can rely on, making this nice-to-exist but not-for-my-applications.
<re_irc> <James Logan> yeh it's sort of a personal experiment, because I didn't want to use a giant software stack for running a daq on a local network
<re_irc> <James Logan> and I'm a complete newb w.r.t. networking so I'm not making any claims about security
<re_irc> <chrysn (@chrysn:matrix.org)> Hm, the whole trick still does depend on having a platform for which we know that there is no std library for it, right?
<re_irc> <James Logan> yeah which is where the "none" for the target comes in - no OS -> no std
<re_irc> <James Logan> so all that test crate is going to do is show that it can be compiled for a platform that could not possibly have the standard library
<re_irc> <chrysn (@chrysn:matrix.org)> Fair enough. I kept being worried that they add std to platoforms where it makes no sense at all (IMO wasm32-unknown-unknown should not have a std library), but given that "unknown" != "none", hopefully that'd be safe.
<re_irc> <James Logan> yeah that example crate also specified #[no_std]
<re_irc> <James Logan> you can also specify #[no_std] in a library, and crates that depend on that library can either have or not have std and it doesn't break them
<re_irc> <chrysn (@chrysn:matrix.org)> Hm ... if I do rely on a platform not having a std for sure, I can probably just build the main library crate for that platform, with no need for an extra test crate (because I don't do the panic-never tests).
<re_irc> <James Logan> could do, as long as you have a way to actually run it
<re_irc> <James Logan> which is sort of the hangup
<re_irc> <chrysn (@chrysn:matrix.org)> I just want to prove that it builds under forced no_std -- I don't see how it should build and then not run.
<re_irc> <James Logan> good point
<re_irc> <chrysn (@chrysn:matrix.org)> Might not be your precise solution I'm using, but either way -- thanks, after this chat I can move forward (and have something to suggest, eg, to wasmi (https://github.com/paritytech/wasmi/issues/374#issuecomment-1189624740)).
rardiol has joined #rust-embedded
tafa has quit [Quit: ZNC - https://znc.in]
tafa has joined #rust-embedded
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
explore has quit [Quit: Connection closed for inactivity]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
causal has joined #rust-embedded
<re_irc> <explodingwaffle101> been writing / procrastinating writing an i2c device driver, wondering if there is a better way to deal with registers and their fields. https://github.com/tkeksa/lis2dh12/blob/master/src/lib.rs#L633 started off by using the methods from here, which is nicer than the bare e-h methods but still requires a load of const bitmasks, and still not great for dealing with anything that isn't just a true/false. went...
<re_irc> ... looking for other solutioms- found packed_struct, bounded-registers, i2c-reg, but not really a fan of any of them. been wondering- would a macro to generate an api sort of like the one svd2rust makes for pacs be a good way to go about it? might be overcomplicating this, i dunno
<re_irc> <henrik_alser> explodingwaffle101: might wanna take a look at the just released https://docs.rs/mycelium-bitfield/latest/mycelium_bitfield/index.html
<re_irc> <explodingwaffle101> that looks very nice. will take a closer look
<re_irc> <GrantM11235> I've never used it, but I think device-driver (https://crates.io/crates/device-driver) does what you are talking about
<re_irc> <explodingwaffle101> ...that looks even nicer 😅 i swear i spent like 2 hours looking for stuff. i guess my google-fu is not strong enough
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
emerent has quit [Ping timeout: 255 seconds]
emerent has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded