<re_irc>
< (@thalesfragoso:matrix.org)> : Watch out for padding, zerocopy has a trait for this stuff too
<re_irc>
< (@firefrommoonlight:matrix.org)> : This worked - great
starblue has joined #rust-embedded
<re_irc>
< (@firefrommoonlight:matrix.org)> Will check out repr(c) and transmute as well
DepthDeluxe has quit [Ping timeout: 260 seconds]
<re_irc>
< (@dirbaio:matrix.org)> repr(c) is nicer if you have bigger ints, or arrays
<re_irc>
< (@dirbaio:matrix.org)> if it's only a few u8s then array unpack is better/simpler yes
<re_irc>
< (@firefrommoonlight:matrix.org)> I appreciate the insight
<re_irc>
< (@jamesmunns:beeper.com)> : I stared at the screen to try and write a more comprehensive guide on what to/not post, and ended up putting that "at the discretion of the maintainer" line in there.
<re_irc>
< (@jamesmunns:beeper.com)> Always happy to discuss or reconsider decisions I've made.
<re_irc>
< (@jamesmunns:beeper.com)> : Honestly 98% of what is retweeted there is because the acct was tagged.
<re_irc>
< (@jamesmunns:beeper.com)> Occasionally I would catch things from my personal feed.
<re_irc>
< (@jamesmunns:beeper.com)> I don't actively use twitter anymore, bit I do try to check the r-e one at least a few times a week.
bjc` has joined #rust-embedded
emerent_ has joined #rust-embedded
emerent has quit [Killed (calcium.libera.chat (Nickname regained by services))]
<re_irc>
<imi415> Has it been copied to the RAM during startup?
<re_irc>
< (@korken89:matrix.org)> I assume so, the INSERT AFTER .data should place it with .data and be copied
<re_irc>
< (@korken89:matrix.org)> * "INSERT AFTER .data" should place it with ".data"
<re_irc>
< (@korken89:matrix.org)> I'm not sure one can "just assign" a value to it like I do though
<re_irc>
< (@korken89:matrix.org)> and the LD docs are not really helping so far
<re_irc>
< (@dirbaio:matrix.org)> I think the "value" of the symbol is the address though
<re_irc>
< (@korken89:matrix.org)> Hm
<re_irc>
< (@dirbaio:matrix.org)> so perhaps somethign like this works?
<re_irc>
maxnvicprio = .;
<re_irc>
LONG(1234)
<re_irc>
< (@dirbaio:matrix.org)> or you can use the address as the value, that's what defmt does
<re_irc>
< (@dirbaio:matrix.org)> like, if the value is 5 you make the symbol's address be 5. From rust you get the addr, you never deref the symbol
<re_irc>
< (@korken89:matrix.org)> Hmm
<re_irc>
< (@korken89:matrix.org)> Though, I really only need it to be 0, I guess I can try and place it in .bss and let the rest be done by initial zeroing really
<re_irc>
< (@korken89:matrix.org)> I only want to allocate the space for the variable via the linker
<re_irc>
< (@korken89:matrix.org)> So it is actually in RAM
<re_irc>
< (@dirbaio:matrix.org)> goal is to simulate an "extern static"?
<re_irc>
< (@dirbaio:matrix.org)> perhaps you can do it with "extern fn"s to get/set it, and a regular static?
<re_irc>
< (@korken89:matrix.org)> I want to use extern static to access it
<re_irc>
< (@korken89:matrix.org)> But I don't want any crate to "create" it
<re_irc>
< (@korken89:matrix.org)> I'm playing with the idea of having an ABI for maximum NVIC prio for async HALs
<re_irc>
< (@korken89:matrix.org)> In the end it would probably be fine to have it in a crate
<re_irc>
< (@korken89:matrix.org)> In theory it could be part of the "cortex-m-rt" ABI
<re_irc>
< (@korken89:matrix.org)> * ABI, for example
<re_irc>
< (@korken89:matrix.org)> Maybe that's a more sane approach than trying to get the linker to do it
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
<re_irc>
<the tab openoor (spookyvision@{github,cohost})> if anyone is in the mood for a brain teaser - I couldn't find a "no_alloc" solution for this (https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4db4d25831b70d7ae16385c2d888e107). What I'm trying to do: store callbacks for a midi controller, where each knob has a normalized input value in "0.0..1.0" but I want to map every knob to a different output range and...
<re_irc>
... type, so e.g. "0u8..100u8".
<re_irc>
(my current workaround is using functions instead of closures as callbacks, and recreating the "RangeMap" for every invocation)
crabbedhaloablut has quit [Ping timeout: 255 seconds]
crabbedhaloablut has joined #rust-embedded
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
DepthDeluxe has joined #rust-embedded
neceve has joined #rust-embedded
causal has quit [Quit: WeeChat 3.7.1]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc>
<pinkforest-rust> I'm doing some portability changes into cryptographic library and was wondering how do you bench for various targets in embedded world ?
<re_irc>
<pinkforest-rust> We found out that our u64 arithmetrics was faster than u32 in some android armv7 targets :/
<re_irc>
<pinkforest-rust> I have criterion benches but is there a easier/smarter(tm) way that could include something like wasm (I doubt so as very diff targets)
<re_irc>
<pinkforest-rust> I guess I have to just natively do but I was wondering if there is a service(tm)
<re_irc>
< (@dirbaio:matrix.org)> blake2s256 compiles to 5kb 😭
<re_irc>
< (@dirbaio:matrix.org)> i'm on a 32kb flash mcu 😭
<re_irc>
< (@dirbaio:matrix.org)> blake2s256 from the "blake2" crate compiles to 5kb 😭
<re_irc>
< (@dirbaio:matrix.org)> is there a more optimized blake2s crate?
<re_irc>
< (@yatekii:matrix.org)> does someone do automatic CHANGELOG rotations in CI?
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
<re_irc>
< (@thejpster:matrix.org)> I think there’s a crate that fails your pipeline if you change something but don’t put it in the changelog.
<re_irc>
< (@thejpster:matrix.org)> But I’ve always done the change log updates for releases manually, in the release branch.
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
<re_irc>
<James Logan> there's also cargo-semver-checks that can help make sure the version change matches the type of changes made to the code, although it won't help directly with making a changelog
<re_irc>
error: could not compile `firmware` due to previous error; 1 warning emitted
<re_irc>
<imurx> This is probably a bug in their toolchain (because LLVM doesnt currently support xtensa so they have a maintained fork for rust and llvm), right?
<re_irc>
< (@adamgreig:matrix.org)> hmm, maybe, but could well be something to do with how you're using the xtense_lx_rt crate, if no-one here knows it might be worth asking in #esp-rs:matrix.org (https://matrix.to/#/#esp-rs:matrix.org)
<re_irc>
<imurx> Yeah I also suspect that will be the place, I previously tried asking for help in there but got ignored 2 times already 😭
<re_irc>
<imurx> I only managed to make this error happen with fat LTO, so it's surely a bug but a hidden one
<re_irc>
< (@adamgreig:matrix.org)> oh weird, yea
<re_irc>
< (@adamgreig:matrix.org)> sounds a bit cursed, i wonder why more lto makes it end up with duplicate symbols
<re_irc>
<imurx> I just noticed that the crate recommends using opt-level = "z" in debug makes the errors disappear (? but maybe they dont take into if someone tries to use LTO in debug
<re_irc>
< (@adamgreig:matrix.org)> i wouldn't have guessed a bug in their llvm fork vs a bug in a linker script or in the rt crate or something like that, but only appearing _with_ lto is a bit upsetting
<re_irc>
< (@adamgreig:matrix.org)> the error they're talking about there is probably the "the linker ran out of space" error, which seems quite different from what you're getting
<re_irc>
<imurx> you are right
<re_irc>
<imurx> so its an underlying bug/issue in somewhere that yet remains to be found
emerent has quit [Ping timeout: 252 seconds]
emerent_ has joined #rust-embedded
emerent_ is now known as emerent
<re_irc>
<imurx> : seeing the code, I found this on xtensa-lx-rt
<re_irc>
<imurx> I also had DefaultPreInit as one of the duplicate symbol errors
<re_irc>
< (@mabez:matrix.org)> imurx: we recommend 'z' only if your exception handlers get too big. On Xtensa there is a limited size for each exception handler to fit inside
<re_irc>
< (@mabez:matrix.org)> I guess lto could inline something that probably shouldn't be inlined and create two copies of a no_mangle symbol that way?
<re_irc>
< (@mabez:matrix.org)> I don't know if its common to use fat lto or not, I usually just use lto = true
<re_irc>
<imurx> lto = true is the same as fat lto
<re_irc>
<imurx> : im kinda lost when we are talking about linker scripts but cant you do something like rust functions that you tell the compiler to never inline?
<re_irc>
<imurx> "#[inline(never)"
<re_irc>
<imurx> * "#[inline(never)]"
<re_irc>
<the tab openoor (spookyvision@{github,cohost})> (it's still just a hint)
<re_irc>
<imurx> true
<re_irc>
<imurx> welp, for now lets disable lto and test :p
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
DepthDeluxe has quit [Ping timeout: 256 seconds]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
neceve has quit [Remote host closed the connection]
neceve has joined #rust-embedded
DepthDeluxe has joined #rust-embedded
dc740 has quit [Remote host closed the connection]
<re_irc>
< (@firefrommoonlight:matrix.org)> Whatup guys!?! Fearless Concurrency question. So, I have a project that has some safety-related concerns should failures occur. And lots of inputs/outputs! For a sensor I added (barometer), I determined I could probably block a bit to prototype, since the data xfer is only 1 byte write; 6 bytes read. Turns out with the HAL code I have, there's a blocking loop in there that waits for a success...
<re_irc>
... or error flag to be set in the peripheral (STM32 I2C).
<re_irc>
Turns out this a big problem: If the sensor gets disconnected or w/e, the program will hang. Could work around this using a time-based or loop-based timeout, although this would introduce latency consistently if the sensor isn't connected for whatever reason.
<re_irc>
I went to my happy place and just implemented the DMA instead of the blocking read, which sorted it out; now if the sensor becomes disconnected, the TC ISR doesn't fire and the program continues to execute.
<re_irc>
If you use blocking reads for comm protocols (I2C, SPI, UART etc), how do you handle this situation? Or do you only use the blocking for prototyping? Thanks!
<re_irc>
< (@firefrommoonlight:matrix.org)> +(And it doesn't block while reading each byte, as expected)
<re_irc>
< (@firefrommoonlight:matrix.org)> I almost feel like inserting a loop timeout of 100 loops or w/e in the HAL is potentially as dangerous, because then it adds teh latency and you may not even catch it unlike here where the program freezes
<re_irc>
< (@newam:matrix.org)> I do big hammer with watchdogs for that
<re_irc>
< (@firefrommoonlight:matrix.org)> Or mayube just document the blocking functions with a "For prototyping only/be careful?"
<re_irc>
< (@firefrommoonlight:matrix.org)> Will look that up. That's a word I've read a decent amount, but don't know what it means!
<re_irc>
< (@firefrommoonlight:matrix.org)> So watchdog is a hardware periph that if program hangs for a certain time it does a MCU reset?
<re_irc>
< (@newam:matrix.org)> yeah pretty much
<re_irc>
< (@firefrommoonlight:matrix.org)> That definitely sounds useful!
<re_irc>
< (@firefrommoonlight:matrix.org)> I think that would be more for non-periodic weird shit, while this example would still mess everything up since the timeout would keep happening
<re_irc>
< (@firefrommoonlight:matrix.org)> I should still add it for the unknown unknowns. Thx for teh tip!