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
Gilfoyl3 has quit [Quit: Gilfoyl3]
xnor has joined #rust-embedded
richardeoin has quit [Ping timeout: 248 seconds]
Gilfoyl3 has joined #rust-embedded
Gilfoyl3 has quit [Quit: Gilfoyl3]
Gilfoyl3 has joined #rust-embedded
richardeoin has joined #rust-embedded
Gilfoyl3 has quit [Client Quit]
sroemer has joined #rust-embedded
Gilfoyl3 has joined #rust-embedded
Gilfoyl3 has quit [Client Quit]
k86td has quit [Remote host closed the connection]
Gilfoyl3 has joined #rust-embedded
starblue has quit [Ping timeout: 265 seconds]
starblue has joined #rust-embedded
Gilfoyl3 has quit [Ping timeout: 265 seconds]
Rahix_ has quit [Quit: ZNC - https://znc.in]
Rahix has joined #rust-embedded
pronvis has joined #rust-embedded
MathiasKoch[m] has joined #rust-embedded
<MathiasKoch[m]> double allocation
Makarov has joined #rust-embedded
ello has quit [Remote host closed the connection]
ello has joined #rust-embedded
<thejpster[m]> a random idea popped into my head - instead of using the PAC to create singletons, each peripheral gets a macro that generates a specially named (non-mangled) static variable. Now the singleton nature of the peripheral is guarded by the linker and name collisions. If you want to share the peripheral, put it in a place where both the main thread function and the ISR function can see it.
<thejpster[m]> dirbaio: are you using LTO? If so, codegen is performed by your linker. So maybe check which linker you are using, and that they are bit-for-bit the same? Maybe transfer all the object code from one machine to the other and try using the other machine's linker? Or even check if the object code is the same across the two machines?
sroemer has quit [Ping timeout: 252 seconds]
ben[m] has joined #rust-embedded
<ben[m]> <hadez[m]> "I'm working with a ch32v203k8tx..." <- you should checkout `embedded-hal-bus`
limpkin has quit [Ping timeout: 252 seconds]
starblue has quit [Ping timeout: 265 seconds]
limpkin has joined #rust-embedded
starblue has joined #rust-embedded
Makarov has quit [Quit: Client closed]
Makarov has joined #rust-embedded
<thejpster[m]> dirbaio: other ideas - does your tree compile any C code with `cc`? Is your C compiler the same?
<dirbaio[m]> <thejpster[m]> "dirbaio: are you using LTO? If..." <- it's rust-lld, installed by rustup, and it's identical yep. it also reproduces without LTO though
<dirbaio[m]> thejpster[m]: no C code, just Rust. (it does link precompiled .a libs from Nordic, but it also reproduces with the embassy examples which are pure rust so it's not that...)
<dirbaio[m]> it seems it really is just rust itself
<dirbaio[m]> asm code in the object files is different before linking, so it's not the linker
<thejpster[m]> but it's the same rustc binary?
<thejpster[m]> so rustc is pulling something from the environment, or it's one of the libraries it's linked to
<thejpster[m]> you sure you don't have RUSTFLAGS="-Copt-level=3" ? ;)
<dirbaio[m]> I also tried "transplanting" all env vars from arch to ubuntu, no change :D
<thejpster[m]> you could replace rustc with a shell script that logs all environment and arguments to disk and then runs the real rustc
<thejpster[m]> but we're getting desperate
<dirbaio[m]> 100% sure no rustflags. they would show up in rustc invocations in cargo -v...
<thejpster[m]> I don't think they would
<thejpster[m]> I think rustc reads them and not cargo?
<dirbaio[m]> hmmmmm
<dirbaio[m]> I think it's just a Cargo thing?
<dirbaio[m]> rustc just reads argv
<dirbaio[m]> at least all the docs I can find on RUSTFLAGS are Cargo, not rustc
<dirbaio[m]> the annoying thing is Cargo puts different fingerprints on the artifacts
<dirbaio[m]> so you can't simply hash them and compare
<thejpster[m]> yeah, maybe you're right
<thejpster[m]> what's the input to the fingerprint? weird that they aren't the same
<dirbaio[m]> yeah actually that's a very good question
<dirbaio[m]> i'm not sure exactly, it's a hash of everything that could cause changes to a crate
<thejpster[m]> I guess you want "reproduceable builds with rust" or something
<dirbaio[m]> version, deps, rustflags, rust version
<thejpster[m]> uid 0, path is /rustc, etc.
<dirbaio[m]> yeah i've tried googling, but everything I find always starts with "ensure you have same version of compiler, os, etc" 🫠
<dirbaio[m]> I can already get reproducible builds if I use locally the same docker image CI uses
<dirbaio[m]> I was just hoping that's avoidable
<dirbaio[m]> I don't want bit-by-bit reproducible builds, I just want CI not to output a binary that's 10kb bigger than local :D
<Koen[m]> Unreproducible builds as a service 😁
<thejpster[m]> well, yeah, if the whole OS is part of making it repeatable than that begs the question ... why?
<thejpster[m]> can it really be libz?
<dirbaio[m]> exactly my question 😭
<JamesMunns[m]> oh wait
<JamesMunns[m]> change the paths dirbaio
<JamesMunns[m]> try putting them all at some base /demo path
<dirbaio[m]> docker on arch vs ubuntu, both with the repo mounted at /code, they still gave different results 🫠
<JamesMunns[m]> damn
<dirbaio[m]> lol so the path where rustc is installed changes the results
<JamesMunns[m]> lolol
<dirbaio[m]> arch was /home/dirbaio/.rustup, ubuntu was /home/ubuntu/.rustup
<dirbaio[m]> changing ubuntu to /home/dirbaio
<dirbaio[m]> now ubuntu is 100 bytes bigger than arch, instead of 10k bigger
<dirbaio[m]> STILL different
<JamesMunns[m]> I wonder if the bin path (and other weird metadata) acts as a hash/prng seed
<dirbaio[m]> yea
<dirbaio[m]> target/.rustc_info.json seems to imply hte path gets hashed
<dirbaio[m]> that's how I found it
<JamesMunns[m]> I know sometimes longer paths end up inhibiting opts sometimes just due to debuginfo size or other similiar shenanigans that make you run out of "optimizer fuel"
<dirbaio[m]> * target/.rustc_info.json seems to imply the rustc path gets hashed
<dirbaio[m]> the results don't change if I change the path where the repo is though
<JamesMunns[m]> I know there was a reproducible builds project for rust at some point, that I think was able to do them in some controlled case?
<JamesMunns[m]> might be worth hunting for that tracking issue, they've probably at least documented a bunch of things that can impact it
<JamesMunns[m]> https://github.com/rust-lang/rust/issues/34902 was an old one
<JamesMunns[m]> some comments say it has regressed since then tho
<JamesMunns[m]> https://github.com/rust-lang/rust/issues/75362 some notes about paths to libs being important
<M9names[m]> looks like this one is the current tracking issue: https://github.com/rust-lang/rust/issues/129080
<dirbaio[m]> making the rustup path the same makes the fingerprints of some crates match, but not all
Makarov has quit [Ping timeout: 256 seconds]
<thejpster[m]> interesting
<dirbaio[m]> ah only MY crates have a different fingerprint ...
<dirbaio[m]> and the fingerprint json has a "path" key that's different
<dirbaio[m]> makes sense
<dirbaio[m]> trying making BOTH the rustc and repo paths the same...
<dirbaio[m]> takes a while because every time I create a new container it has to clone the insanely bloated CMSIS_5 repo 💩
<dirbaio[m]> yayyyyy. using the exact same path for rustc AND the repo yields the exact same binary
<dirbaio[m]> * same binary across arch and ubuntu
<dirbaio[m]> now how to fix it
<dirbaio[m]> my theory of what's happening is
<dirbaio[m]> - different paths trigger different Cargo fingerprints
<dirbaio[m]> - different crate names cause rustc to emit different code ..??? maybe because order of stuff changes in hashmaps
<dirbaio[m]> - different fingerprints causes different crate names that rustc sees
<thejpster[m]> But .. 10K of changes?
<dirbaio[m]> yeah that worries me as well
<dirbaio[m]> 10k on a 380k firmware
<dirbaio[m]> * 380k firmware seems a lot
<JamesMunns[m]> (2.6%, for anyone else wondering)
<dirbaio[m]> considering i'm sending PRs to defmt to save 1k it's quite demotivating to lose 10k by the compiler rolling the dice wrong
Makarov has joined #rust-embedded
<dirbaio[m]> --remap-path-prefix doesn't work 😭
<dirbaio[m]> it's a rustc thing, cargo still hashes the path
<dirbaio[m]> * the path into the fingerprints
<thejpster[m]> Jorge notes that crate paths end up in panic strings. But I doubt that accounts for much here.
Makarov has quit [Ping timeout: 256 seconds]
<dirbaio[m]> I already made sure to not have panic strings with panic_immediate_abort 😎
<dirbaio[m]> I can't afford them! 😭
<dirbaio[m]> it's the cargo fingerprints
<dirbaio[m]> definitely the cargo fingerprints
<dirbaio[m]> that cause butterfly effect random changes all over the place
<dirbaio[m]> so somehow I have to get Cargo to not hash the paths into them
<thejpster[m]> this is all very troubling
<thejpster[m]> I'm thinking "maybe there's 2% to be gained in terms of code space if I just try a few random usernames"
carpincho has joined #rust-embedded
carpincho has quit [Changing host]
carpincho has joined #rust-embedded
<scorpion2185[m]> can i use probe-rs with st-link v2? (but it does not build)
<thejpster[m]> there's a #probe-rs:matrix.org channel. But also, the instructions say to just install the binary version. It's much easier. And yes it does support ST-Link v2.
<thejpster[m]> if you need to install from source you probably need to use --locked to stop Cargo from upgrading packages.
James[m] has quit [Quit: Idle timeout reached: 172800s]
therealprof[m] has quit [Quit: Idle timeout reached: 172800s]
Makarov has joined #rust-embedded
Makarov9 has joined #rust-embedded
<scorpion2185[m]> <thejpster[m]> "if you need to install from..." <- it worked thanks
Makarov has quit [Ping timeout: 256 seconds]
akshaim[m] has quit [Quit: Idle timeout reached: 172800s]
bartmassey[m] has quit [Quit: Idle timeout reached: 172800s]
berkus[m] has quit [Quit: Idle timeout reached: 172800s]
_whitelogger_ has joined #rust-embedded
rmsyn[m] has quit [Quit: Idle timeout reached: 172800s]
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
burrbull[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has quit [Quit: Idle timeout reached: 172800s]
jessebraham[m] has quit [Quit: Idle timeout reached: 172800s]
danielb[m] has quit [Quit: Idle timeout reached: 172800s]
carpincho has left #rust-embedded [#rust-embedded]
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #rust-embedded
Makarov9 has quit [Quit: Client closed]
_whitelogger_ has quit [Remote host closed the connection]
_whitelogger_ has joined #rust-embedded
_whitelogger_ has quit [Remote host closed the connection]
<JamesMunns[m]> FYI - we've disabled the "ban if a user posts an image after joining" rule from the mod bot
cinemaSundays has joined #rust-embedded
dne has quit [Remote host closed the connection]
dne has joined #rust-embedded
mabez[m] has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has joined #rust-embedded
<jannic[m]> <dirbaio[m]> "- different paths trigger..." <- > <@dirbaio:matrix.org> - different paths trigger different Cargo fingerprints... (full message at <https://catircservices.org/_irc/v1/media/download/Ad4K66AGyP-Zma0DXe5YLnaP_qzPQc1yqYE6iD5YyR4fCO47TNBclR-QFZyhY6rqR3E4i4x1oZ7Qz9mXP9evhVu_8AAAAAAAAGNhdGlyY3NlcnZpY2VzLm9yZy9ISHFFaENRY2RUWU1meFptZVFNVVBaUE0>)
<dirbaio[m]> it might be a bug then 🤔
<dirbaio[m]> it doesn't say anything about the path where rustc itself is installed tho
<dirbaio[m]> it's definitely hashing the path to that...
<jannic[m]> Right! The table in https://doc.rust-lang.org/stable/nightly-rustc/cargo/core/compiler/fingerprint/index.html#fingerprints-and-metadata only says that "rustc" is tracked, but that likely is (or includes) the path.
<dirbaio[m]> (and other --prints)
barafael[m] has joined #rust-embedded
<barafael[m]> I'm using the smart-leds crate. The LEDs I have seem to have swapped R and G. Is there a way to compensate for that inside smart-leds?
<barafael[m]> I mean, i can just core::mem::swap the two values
_whitelogger_ has joined #rust-embedded
<JamesMunns[m]> <barafael[m]> "I'm using the smart-leds crate..." <- SK6818?
<JamesMunns[m]> SK6812?
<JamesMunns[m]> JamesMunns[m]: If so: yeah, I always just swap those two :p
cinemaSundays has quit [Quit: Connection closed for inactivity]