<re_irc>
<9names (@9names:matrix.org)> time to do some crimes ;)
emerent has quit [Ping timeout: 248 seconds]
emerent has joined #rust-embedded
explore has quit [Quit: Connection closed for inactivity]
xnor has quit [Ping timeout: 272 seconds]
xnor has joined #rust-embedded
explore has joined #rust-embedded
aspe has joined #rust-embedded
aspe has quit [Quit: aspe]
aspe has joined #rust-embedded
aspe has quit [Remote host closed the connection]
aspe has joined #rust-embedded
<re_irc>
<matejcik> what is the current status of the core::fmt bloat issue in embedded builds?
<re_irc>
<matejcik> i have a custom panic handler that makes no use of the passed in value, but I still get the core::fmt stuff built in (unlike what That Article from 2019 says, where just using panic-reset gets rid of it).
<re_irc>
maybe the issue is that I'm building a static lib that gets linked into a C environment later, so the compiler cannot properly optimize it out?
limpkin has quit [Quit: limpkin]
limpkin has joined #rust-embedded
explore has quit [Quit: Connection closed for inactivity]
<re_irc>
<dirbaio> matejcik: rustc is still unable to optimize out panic fmt bloat in some cases, even if it's unused in the panic handler
<re_irc>
<dirbaio> to fully get rid of it, build with "-Zbuild-std=core -Zbuild-std-features=panic_immediate_abort"
<re_irc>
<dirbaio> then panics compile to a single "udf" instruction
<re_irc>
<dirbaio> * instruction, and no "fmt" bloat.
<re_irc>
<matejcik> dirbaio: that looks promising, is that stable or nightly?
<re_irc>
<dirbaio> nightly only
<re_irc>
<dirbaio> no way to do it on stable afaik
<re_irc>
<matejcik> my current solution is panic-never plus a custom unwrap! macro, but it's a pain
<re_irc>
<dirbaio> yeah panic-never is not viable at all in larger projects imo :S
<re_irc>
<dirbaio> I just use nightly in production
<re_irc>
<dirbaio> the productivity improvement is wayyyyyy worth it
<re_irc>
<matejcik> thing is, I kinda want a particular behavior in case of panic, so even with the udf thing I'd still want to "catch" the panics somehow
<re_irc>
<matejcik> i was considering something like a custom implementation of some parts of stdlib (such as panic, slice_error_fail and so on) and then force-linking my versions. but that sounds super brittle and at that point I might just maintain a patch to rustc maybe
<re_irc>
<matejcik> we had nightly in production for a bit, and gradually went back to stable because we could get around all limitations. but yeah using nightly is still in the game
<re_irc>
<James Munns> You should be able to "catch" a UDF in a fault handler
<re_irc>
<mabez> By the way, you only need nightly cargo to do that, you can mix nightly cargo with a stable compiler
<re_irc>
<mabez> Using nightly cargo is less prone to breakage than a nightly compiler which is nice
<re_irc>
<James Munns> (specifically the HardFault handler)
<re_irc>
<James Munns> oh wait, you can use "-Zbuild-std" on nightly cargo with a stable compiler?
<re_irc>
<mabez> James Munns: Yes! We use this trick to use the rust standard library on an esp32c3 on stable
<re_irc>
<James Munns> Huh! TIL.
starblue has quit [Ping timeout: 246 seconds]
aspe has quit [Quit: aspe]
causal has quit [Quit: WeeChat 3.5]
<re_irc>
<Ivan Levitskiy> Any recommendations for creating and writing a text file to a SD card?
<re_irc>
<Ivan Levitskiy> I have the card connected over sdio to a stm32f411. Just tried reading blocks with F4 hal functions and it works
xnor has quit [Ping timeout: 248 seconds]
xnor has joined #rust-embedded
aspe has joined #rust-embedded
aspe has quit [Remote host closed the connection]
<re_irc>
<James Munns> There's a couple of SD card libraries that are no-std compat