<re_irc>
< (@jamesmunns:beeper.com)> Does anyone know if relocatable code works on the bare metal RISC-V targets?
<re_irc>
< (@jamesmunns:beeper.com)> I know (think?) cortex m still has problems with pic/pie/ropi stuff
<re_irc>
< (@dirbaio:matrix.org)> it works if you have a loader that applies relocations somehow, same as cortex-m
<re_irc>
< (@dirbaio:matrix.org)> cortex-m's ropi/rwpi is an attempt to not need a loader, that's what's broken
<re_irc>
< (@dirbaio:matrix.org)> +such
<re_irc>
< (@jamesmunns:beeper.com)> Oh, I thought cortex m was missing something that properly generated relocation symbols or something
<re_irc>
< (@dirbaio:matrix.org)> (and I don't think there's a rwpi/ropi equivalent for riscv)
<re_irc>
< (@dirbaio:matrix.org)> afaik "normal" PIC/PIE works for cortex-m
<re_irc>
< (@dirbaio:matrix.org)> I've never used it myself so don't quote me on that tho
<re_irc>
< (@jamesmunns:beeper.com)> Oh huh.
<re_irc>
< (@adamgreig:matrix.org)> yea, the problem is that ropi/rwpi requires specialist codegen to use a sort of platform ABI to agree on a relocation base
<re_irc>
< (@adamgreig:matrix.org)> afaik there's no equivalent for r-v?
<re_irc>
< (@jamesmunns:beeper.com)> Huh. Seems like I need to go learn how all the pic/pie stuff actually works, and what it would take to write a loader
<re_irc>
< (@wucke13:matrix.org)> With regard to this, I have a new confusion: "static AtomicUsize" and "static Cell<...>" initialized with 0 both are put after the ebss, not in the ebss. If any other number than 0 is used for intialization, they are correctly placed in the data section.
madb_ has quit [Changing host]
madb_ has joined #rust-embedded
madb_ is now known as madb
IlPalazzo-ojiisa has joined #rust-embedded
starblue has quit [Ping timeout: 268 seconds]
starblue has joined #rust-embedded
brazuca has joined #rust-embedded
<re_irc>
< (@korken89:matrix.org)> Looks like a shitposts but that is serious (trying to solve the N+1 limit in const generics):
<re_irc>
< (@korken89:matrix.org)> Turns out that the codegen for this is surprisingly good
<re_irc>
< (@korken89:matrix.org)> (when you use it that is)
<re_irc>
< (@dirbaio:matrix.org)> wow, cursed! :D
<re_irc>
< (@dirbaio:matrix.org)> fails miri because "self.buf.as_ptr()" has provenance for only "buf"
<re_irc>
< (@dirbaio:matrix.org)> using "self as *const _ as *const T" instead passes
brazuca has quit [Quit: Client closed]
<re_irc>
< (@dirbaio:matrix.org)> I think this trick is similar to what "generic_array" does? engineer a struct that has the right layout for X items, then cast it to a slice
<re_irc>
< (@korken89:matrix.org)> Probably
<re_irc>
< (@korken89:matrix.org)> It's just annoying that const generics are so limited
<re_irc>
< (@korken89:matrix.org)> If it looks like a slice, quacks like a slice, walks like a slice ... is it a slice? :D
<re_irc>
< (@dirbaio:matrix.org)> Python says yes
<re_irc>
< (@korken89:matrix.org)> xD
brazuca has joined #rust-embedded
emerent has quit [Ping timeout: 264 seconds]
emerent has joined #rust-embedded
<re_irc>
< (@jamesmunns:beeper.com)> btw, the "right" way to do this is (and pass provenance) is to use "*mut Test"/"NonNull<Test>" and "addr_of_mut"
<re_irc>
< (@jamesmunns:beeper.com)> oh, yeah, what dirbaio said. A little less cursed:
<re_irc>
<Charles ⚡️> this thing has an FPU so it'd be nice if i could use it
<re_irc>
<Stephen D> hmm
<re_irc>
<Stephen D> Yeah that would be ideal
<re_irc>
<Charles ⚡️> also this is hardware xy-problem anyway i think
<re_irc>
<Charles ⚡️> i think i really just need more sensitive sensors
Abhishek_ has quit [Quit: Connection closed for inactivity]
brazuca has quit [Ping timeout: 260 seconds]
seds_ has joined #rust-embedded
cyrozap_ has joined #rust-embedded
a2800276_ has joined #rust-embedded
<re_irc>
< (@dkhayes117:matrix.org)> I have a "&[u8]" that I'm feeding into "serde_json::from_slice(&packet.payload[..])?" and I'm getting an error which I've tried to debug but haven't had any luck. Any Ideas?
<re_irc>
< (@dirbaio:matrix.org)> yea but what's the actual "T" that causes the error?
<re_irc>
< (@dirbaio:matrix.org)> I think the error means it found a "map" (a JSON object I guess? ie"{}") and it expected "unit"
<re_irc>
< (@dirbaio:matrix.org)> I think "unit" is a Rust struct like "struct Foo;", with no fields
<re_irc>
< (@dirbaio:matrix.org)> so maybe it doesn't allow deserializing a "{}" into that?
<re_irc>
< (@dkhayes117:matrix.org)> Ohhh, I think I see the problem. I didn't define the type when I call that function, so it was unknown. Below shows the added type, which I will try now.
<re_irc>
let read : TempSensor = golioth.lightdb_read_state(device_id.await?;
<re_irc>
< (@dirbaio:matrix.org)> ahh "unit" is "()"
<re_irc>
< (@dirbaio:matrix.org)> makes sense then :D
<re_irc>
< (@dkhayes117:matrix.org)> So simple, but needed someone to ask me an obvious question to see it :P
<re_irc>
< (@dkhayes117:matrix.org)> Thanks!
<re_irc>
< (@dirbaio:matrix.org)> nothing like a rubber duck :P
<re_irc>
< (@halfbit:matrix.org)> : oh, using golioth with rust on embedded? neat!
<re_irc>
< (@halfbit:matrix.org)> or is this something entirely different hah
crabbedhaloablut has quit [Quit: No Ping reply in 180 seconds.]
crabbedhaloablut has joined #rust-embedded
<re_irc>
< (@dkhayes117:matrix.org)> Yep, I've already got one project working with the nrf9160. Now I'm porting `golioth-rs` to use `Embassy` and `nrf-modem`
<re_irc>
< (@halfbit:matrix.org)> Interesting
IlPalazzo-ojiisa has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
madb has quit [Ping timeout: 260 seconds]
<re_irc>
<harcrow> Hi everyone. I'm a hardware person trying to keep up with the embedded FW world, so bear with me. I have an STM32F4 and am trying to understand how to derive some of the syntax from the stm32f4xx-hal documentation. To declare a type alias for a peripheral, I've seen in this example