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
IlPalazzo-ojiisa has quit [Quit: Leaving.]
starblue has quit [Ping timeout: 245 seconds]
starblue has joined #rust-embedded
<dngrsspookyvisio> <jannic[m]> "https://media.ccc.de/v/camp2023-..."; <- interesting talk! TIL [perfetto](https://github.com/google/perfetto)
GenTooMan has quit [Remote host closed the connection]
GenTooMan has joined #rust-embedded
CHMchmousset[m] has joined #rust-embedded
<CHMchmousset[m]> <dirbaio[m]> "sadly opensource doesn't pay" <- you can always request funding from NLNet https://nlnet.nl/propose/
<CHMchmousset[m]> They support a very wide range of project, yours might fall in the general theme https://nlnet.nl/project/current.html
crabbedhaloablut has joined #rust-embedded
timokrgr[m] has joined #rust-embedded
<timokrgr[m]> <jannic[m]> "https://media.ccc.de/v/camp2023-..."; <- very nice talk, reminds me of the stuff oxidecomputer is doing with humility and probe-rs
vancz_ has joined #rust-embedded
vancz has quit [*.net *.split]
jsolano has quit [*.net *.split]
jsolano has joined #rust-embedded
<Noah[m]> <CHMchmousset[m]> "you can always request funding..." <- > <@chmousset:matrix.org> you can always request funding from NLNet https://nlnet.nl/propose/
<Noah[m]> > They support a very wide range of project, yours might fall in the general theme https://nlnet.nl/project/current.html
<Noah[m]> the problem with grants is basically that you are constantly applying for grants with no guaranteed outcome :)
starblue has quit [Ping timeout: 256 seconds]
starblue has joined #rust-embedded
badrb[m] has joined #rust-embedded
<badrb[m]> Hey, do you happen to know of any library that can turn a unique ID into a hash that humans can easily read?
<badrb[m]> I need it for my project where I want to generate a user-friendly version of my 64-bit unique ID from my MCU. This will make it easier to provide support out in the field.
<badrb[m]> I found two projects that are quite similar: https://sqids.org/ and https://docs.rs/proquint/latest/proquint/. They both have some drawbacks and unfortunately do not support no-std.
Ablu[m] has joined #rust-embedded
<Ablu[m]> @badrb: if random letters are ok, maybe just use base32?
<badrb[m]> Ablu[m]: I was thinking something shorter and easier to read. https://github.com/bryanmylee/zoo-ids like `FineAntiqueElk` or `pertinentPoshGoldfinch` would be ideal, but what sqids generates `Swd2Mt4u` or `Cj7uZaIi` might work too.
<Ablu[m]> I stole the docker constainer name generation names once and hashed into those, but I do not know any off-the-shelve crates to do this.
<Ablu[m]> https://docs.rs/human-hash/latest/human_hash/ sounds promising after a short Google query
<badrb[m]> Ablu[m]: Oh, this is just what I needed! It's funny that I didn't find it. Thanks, I'll look into it!
<Ablu[m]> badrb[m]: I searched "rust human hash", maybe I got lucky :P
MathiasKoch[m] has joined #rust-embedded
<MathiasKoch[m]> Hi guys.. Before opening a an issue, I just wanted you to confirm that I am not doing something stupid here..... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/YICtCyMpMGHvoSEulepdDElw>)
<MathiasKoch[m]> * Hi guys.. Before opening an issue, I just wanted you to confirm that I am not doing something stupid here..... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/VTuugrscQOQtEMRjBpWCvQZJ>)
<MathiasKoch[m]> Deserializing to `Value` gives correct `serde_json::from_str::<serde_json::Value>(n).unwrap() = Number(1.69234125E12)`
<MathiasKoch[m]> And a further is_f64() on the Value reports true
<MathiasKoch[m]> nice
<MathiasKoch[m]> Guess it's time to hunt for a regression issue somewhere
<MathiasKoch[m]> Huh.. seems like it is related to serde_json value, and the arbitrary_precision feature-flag
emerent has quit [Ping timeout: 258 seconds]
emerent has joined #rust-embedded
<MathiasKoch[m]> * Huh.. seems like it is related to serde_json version, and the arbitrary_precision feature-flag
<diondokter[m]> Hey, I'm having some trouble with my linker script.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/EMfjCXbAfVWVeGZqFUScdMEW>)
<dirbaio[m]> is this for a different RAM region than the main .data/.bss?
<dirbaio[m]> then you want separate sections .axisram and .axidata
<dirbaio[m]> s/axisram/axidata/, s/axidata/axibss/
<JamesMunns[m]> Also, the cmrt init function really only copies between sdata and edata symbols
<JamesMunns[m]> if you need your axisram to be outside of that range, you have to add your own initialization copy, probably changing the asm
<dirbaio[m]> with your own __saxidata, __eaxidata, __siaxidata, __saxibss, __eaxibss symbols
<diondokter[m]> Hmmm right, That's what I thought
<dirbaio[m]> and don't use INSERT BEFORE
<dirbaio[m]> and then copy this and put it in `pre_init`
<JamesMunns[m]> yeah, sdata is INSIDE .data
<diondokter[m]> Ok, so basically I have to make my own infra for that and can't reuse cmrt
<dirbaio[m]> yeah...
<JamesMunns[m]> diondokter[m]: well, probably "fork and tweak" and/or patch
<dirbaio[m]> it should be doable from your own crate, no need to fork
<diondokter[m]> Yeah I don't want to fork
<diondokter[m]> dirbaio[m]: Indeed
<diondokter[m]> Ok, thanks! That's clear enough!
<JamesMunns[m]> oh, is pre_init sound now?
<JamesMunns[m]> I thought it was... questionable since it needed to be Rust? or can it be done with a named global asm section
<dirbaio[m]> yeah it's unsound to do it in Rust, you have to do it in asm
<JamesMunns[m]> but you could have a global asm __pre_init symbol and not use the macro
<dirbaio[m]> yeah... the docs should show how to do that
<dirbaio[m]> and perhaps entirely remove the macro because there's no way to use it soundly?
<dirbaio[m]> perhaps using it with a naked fn is sound?
<dirbaio[m]> or a regular fn if the ONLY thing inside it is an asm!? I don't think so because the compielr can insert accesses to statics in function prologue/epilogue, like canary stack checks
<JamesMunns[m]> idk, imo "using rust at all before the environment is fully set up" is pretty questionable
<JamesMunns[m]> like it might be more likely to work, but still not really sound
<dirbaio[m]> yeah...
dygear[m] has quit [Quit: Idle timeout reached: 172800s]
<JamesMunns[m]> idk much about what you're doing diondokter, I've always used "extra ram areas" as uninit (for like buffers and buffer descriptors), there might be a way to do that at runtime, making something like static cell with an unsafe constructor instead (where you init and get back an `&'static mut` you can use for stuff
<JamesMunns[m]> (if writing your own pre_init is less desired)
<JamesMunns[m]> but yeah, cmrt really only covers the basics of section init as-is
IlPalazzo-ojiisa has joined #rust-embedded
<diondokter[m]> Yeah well, we have a lot of large queues and other data that needs to go in axis ram and the project is already quite complex. I'd rather add a small boot thing than force everything to manually initialize
<JamesMunns[m]> but treat that as "a different approach"/"a workaround" rather than "the right way"
<JamesMunns[m]> gotcha!
<diondokter[m]> Only question I have left is how to differ between the .data and .bss? Normally the compiler does this for you, but I guess I'm gonna need to let people specify it on the data itself?
<JamesMunns[m]> yeah, I don't think there's a way to get automatic splitting
<diondokter[m]> Right. That's ok I guess
<diondokter[m]> But it does suck a bit that the ergonomics get so much worse
<JamesMunns[m]> JamesMunns[m]: (could be wrong, I don't know all of the linker Dark Magic, but the compiler automatically places .data or .bss, but once you specify a region, it just takes that as-is afaik)
<JamesMunns[m]> what sorta data are you initializing it with? you could ensure that all structures have a zero init, which would make it easier
<JamesMunns[m]> but I imagine you have two regions for a reason :)
<diondokter[m]> Rust has done a lot of good work on the compiler and language side. But it feels like there's space for a radically new linker. But there's no glory to be gotten there :P
<JamesMunns[m]> tbf: that's a "compiler problem" not a linker problem
<JamesMunns[m]> compiler picks the sections, linker fills them
<dirbaio[m]> the linker is cuuuuuuursed
<diondokter[m]> JamesMunns[m]: One of the problems is that you get no protection from Rust. You don't need to use unsafe and yet you could have a NonNullPtr be 0 if you place it in BSS
<JamesMunns[m]> (basically: compiler picks/fills the section "buckets", linker empties the buckets and places them in the regions you specify)
<JamesMunns[m]> diondokter[m]: totally fair! OR if you have the flash/the ram region is small, you could go the other way and make it all data
<diondokter[m]> Ok, well more accurately, the section model could maybe be revolutionized
<JamesMunns[m]> yeah, don't let me discourage you from thinking "things could be better", because I totally agree with that :)
<JamesMunns[m]> maybe propose a new link_section_prefix attribute? :p
<JamesMunns[m]> so you get .PREFIX.data
<diondokter[m]> Haha well I've got a colleague who's way deeper into compilers and it's always fun to provoke him into a (often weirdly nuanced) rant about current compilers and linkers
<ryan-summers[m]> diondokter: Don't know if you solved this, but we handle this in Stablizer by manually initializing the section: https://github.com/quartiq/stabilizer/blob/main/src/hardware/setup.rs#L145
<diondokter[m]> ryan-summers[m]: Yeah I took a look what you guys did with the memory.x because I remembered you
<ryan-summers[m]> So it's like our own pre-init, but basically there's just uninitialized memory after we call main()
<diondokter[m]> * remembered you're on stm32h7 too
<diondokter[m]> Is it that much faster?
<ryan-summers[m]> Its not a great solution, but it works
<ryan-summers[m]> ITCM is way faster
<diondokter[m]> Could be fun to try at some point haha
<ryan-summers[m]> I think we put our DSP routines in it and do RAM functions to make it super fast
<ryan-summers[m]> We had issues where the startup was failing because the cache was cold, so we manually put all the funcs in ITCM so we didn't have to worry about cache
<ryan-summers[m]> Context issue for the curious: https://github.com/quartiq/stabilizer/issues/184
<JamesMunns[m]> any issues with "oops called a rust intrinsic outside of RAM, cache miss"?
<ryan-summers[m]> Not that I'm aware of. It's not the end of the world if we have a few inst outside of cache
<JamesMunns[m]> (that's the other usual issue I've seen with ramfuncs, you can't really recursively guarantee ALL instrs live there, esp with intrinsics)
<JamesMunns[m]> yeah, for "just" perf, probably measurably "good enough" :)
<ryan-summers[m]> We did have to manually go through the call chain for the DSP stuff and mark it specifically though
<JamesMunns[m]> bigger deal when you like, disable the flash for a bit and WANT to be running all RAM lol
<JamesMunns[m]> usually it's like "oops that got optimized to memcpy, guess where that lives!"
<ryan-summers[m]> Yeah, that's a bigger issue. Rust intrinsics would definitely bite you there
<JamesMunns[m]> (only way I know to fix that is to make a "separate binary" you load into ram, sorta like a dylib/ROM table, but then FFI and sadness)
M9names[m] has joined #rust-embedded
<M9names[m]> hmm, speaking of such things: i managed to get linker errors the other day trying to put some C code in ram, and call it from rust.
<M9names[m]> precisely because it was trying to call intrinsics that were too far away from the caller.
<JamesMunns[m]> oof, which target? it's been a while since I had to think about trampolines/veneers
<ryan-summers[m]> Why would the C code call rust intrinsics?
<M9names[m]> cortex-m0. ah, maybe intrinsics is the wrong word (i'm tired)
<M9names[m]> it was tripping up on memcpy and friends
<M9names[m]> so i guess just the libc stuff that compiler-builtins or cc bundles?
<diondokter[m]> Oh, here's a fun one too. If you do #[link_section = ".name.with.typo"], then the compiler nor the linker will complain
<diondokter[m]> It works!
<diondokter[m]> Thanks James Munns and dirbaio :D
<diondokter[m]> Now let's see what the team thinks of this and if it survives the PR review haha
<M9names[m]> found one, in case anyone enjoys reading linker errors... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/ejKvqEGtxHXvzwoLJOQbCUgK>)
<M9names[m]> so yeah, just library stuff :(
<JamesMunns[m]> yeah, there's multiple "intrinsics", another overloaded word :)
<JamesMunns[m]> but yeah there's two ways to call in arm, one with shorter range, looks like the compiler picked the shorter one (because that's all it could see/covers all of flash) when you really needed the longer one (to jump between flash/ram)
<JamesMunns[m]> so: I don't know how to fix that, but the problem makes sense :p
M9names[m]1 has joined #rust-embedded
<M9names[m]1> I've solved in the past by tell the compiler to use a different code model, don't think I've ever done it for cortex-m though...
<M9names[m]1> It would probably hurt code perf enough to not make it worthwhile anyway
<JamesMunns[m]> I guess LLVM calls these "range thunks"? https://github.com/llvm/llvm-project/issues/32959
<JamesMunns[m]> but yeah, if you CAN'T recompile/force your staticlib to use long range jumps, the only other answer is a thunk/trampoline/veneer, which I thought the compiler should generate (short jump to something that long jumps), but dunno how to force it to do that
<dirbaio[m]> I think it's the linker that has to generate them?
<JamesMunns[m]> yeah
<JamesMunns[m]> you're right, I said compiler but the linker is supposed to insert thunks
<dirbaio[m]> which is cuuuuursed :D
<dirbaio[m]> linker doing compiler things
<JamesMunns[m]> 9names any chance you are compiling one of them with GCC's LD and the other with LLVM's LLD?
<JamesMunns[m]> like, the staticlib with gcc, then compiling rust and linking with lld? maybe one linker isn't picking up what the other put down, and maybe you could try using the same compiler/linker for both?
<JamesMunns[m]> (well, same linker I guess, clang+rustc + lld, or gcc+rustc + ld)
<M9names[m]1> C compiled with GCC via cc-rs. Same issue when linking with ld or lld.
<M9names[m]1> Didn't get to testing with clang yet...
Foxyloxy has quit [Quit: Textual IRC Client: www.textualapp.com]
Foxyloxy has joined #rust-embedded
crabbedhaloablut has quit [Ping timeout: 258 seconds]
crabbedhaloablut has joined #rust-embedded
danielb[m] has quit [Quit: Idle timeout reached: 172800s]
Darius has quit [Ping timeout: 244 seconds]
Darius has joined #rust-embedded
cr1901_ has joined #rust-embedded
cr1901 has quit [Killed (NickServ (GHOST command used by cr1901_!~cr1901@2601:8d:8600:226:6712:3a8e:7f64:543a))]
cr1901_ is now known as cr1901
<badrb[m]> <Ablu[m]> "I searched "rust human hash..." <- Argh, because of `getrandom` dep of uuid with v4 feature enabled, this doesn't compile for `thumbv7em-none-eabihf`
<jessebraham[m]> Looks like a release never got created for 1.0.0-rc.1 on the embedded-hal repo, by the way
crabbedhaloablut has quit []
nex8192 has left #rust-embedded [Error from remote client]
nex8192 has joined #rust-embedded
cr1901_ has joined #rust-embedded
cr1901 has quit [Ping timeout: 246 seconds]
cr1901__ has joined #rust-embedded
cr1901__ has quit [Read error: Connection reset by peer]
cr1901__ has joined #rust-embedded
cr1901_ has quit [Ping timeout: 246 seconds]
cr1901__ is now known as cr1901
Dr_Who has quit [Read error: Connection reset by peer]
cr1901_ has joined #rust-embedded
cr1901_ has quit [Read error: Connection reset by peer]
cr1901 has quit [Ping timeout: 245 seconds]
cr1901 has joined #rust-embedded
cr1901 has quit [Quit: Leaving]
IlPalazzo-ojiisa has quit [Remote host closed the connection]
cr1901 has joined #rust-embedded
firefrommoonligh has joined #rust-embedded
<firefrommoonligh> * More rust flight controller; changed up the control scheme so it holds attitude... but still flies like rate controls bc the RC input changes the target attitude. Should make feeding into the autopilot smooth.
<firefrommoonligh> More rust flight controller; changed up the control scheme so it holds attitude... but still flies like rate controls bc the RC input changes the target attitude. Should make feeding into the autopilot smooth.