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-ojiis1 has quit [Ping timeout: 264 seconds]
<cr1901> jamesmunns: This was very annoying to write, but the basics are done: https://github.com/cr1901/postcard-infomem/blob/main/src/lib.rs
<cr1901> It's all serialized to strings right now for testing/visual inspection, but I'm likely to change that
<re_irc> < (@jamesmunns:beeper.com)> Oh wow, I was wondering why you were impl'ing ser/de for all of those types (rather than derive)
<cr1901> Because NONE OF THEM impl' ser/de
<cr1901> and I lost my patience trying to make the serde-provided workaround work
crabbedhaloablut has quit [Ping timeout: 255 seconds]
crabbedhaloablut has joined #rust-embedded
<re_irc> < (@jamesmunns:beeper.com)> cr1901 oof :(
IlPalazzo-ojiisa has joined #rust-embedded
emerent has quit [Ping timeout: 260 seconds]
emerent has joined #rust-embedded
<re_irc> <riskable> What am I supposed to use for "defmt" and "critical-section" with "rp2040-hal"? If I use "cortex-m = { version = "0.7", features = ["critical-section-single-core"] }" I get errors about "RawRestoreStateInner" trying compile "critical-section". If I get rid of that cortex-m feature flag I get linker errors like this: "rust-lld: error: undefined symbol: _critical_section_1_0_acquire" which suggests I need to "pick an...
<re_irc> ... implementation". How do I do that?
<re_irc> <riskable> I'm using _both_ cores on my RP2040
<re_irc> <riskable> Ahh, I figured it out: Had to add ""critical-section-impl"" to the "features" of "rp2040-hal" in my "Cargo.toml" (which isn't documented yet I don't think)
<re_irc> < (@ithinuel:matrix.org)> Indeed, this feature is enabled by the BSPs but is off by default.
<re_irc> < (@ithinuel:matrix.org)> * default on the hal
bjc has quit [Ping timeout: 260 seconds]
bjc has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
crabbedhaloablut has quit [Remote host closed the connection]
loki_val has joined #rust-embedded
Foxyloxy_ has quit [Quit: Textual IRC Client: www.textualapp.com]
Foxyloxy has joined #rust-embedded
Foxyloxy has quit [Client Quit]
Foxyloxy has joined #rust-embedded
<cr1901> jamesmunns: The include_bytes approcah doesn't work lmao:
<cr1901> [ 1] .info PROGBITS 00001000 0000d4 000004 00 A 0 0 2
<cr1901> size of 4
<cr1901> meaning it put the actual data into .rodata/whatever, and put the _pointer_ to the .rodata in .info
<cr1901> I don't think I can provide a link section to include_bytes!()
<re_irc> < (@jamesmunns:beeper.com)> Ohh, you might be right cr1901
<re_irc> < (@jamesmunns:beeper.com)> https://github.com/rust-lang/rust/issues/70239
<re_irc> < (@jamesmunns:beeper.com)> So yeah, the other approach of actually making a sized byte array is probably better then.
<cr1901> What the hell have I done
<re_irc> < (@jamesmunns:beeper.com)> lmao I love it
<cr1901> Am seeking sincere suggestions to make this look less awful
<re_irc> < (@jamesmunns:beeper.com)> you can also "assert!(infomem.len() <= full_array.len);", asserts in const context will just fail the build
<cr1901> I'm trying to get rid of the need to supply the full array size since it can be inferred by the assignment to VERSION
<re_irc> < (@jamesmunns:beeper.com)> oh! If you also use the experimental postcard MAX_SIZE feature (you might need to impl some traits yourself :/), you can use that as the array size lol
<re_irc> < (@jamesmunns:beeper.com)> cr1901: I have something amazing for you.
<cr1901> That works, and I can turn it into a macro
<re_irc> < (@chrysn:matrix.org)> It's kind of cool it works, but also makes the inability to just say "const EXAMPLE: [u8; _] = include_bytes!(...);" feel quite arbitrary.
Rahix has quit [Quit: ZNC - https://znc.in]
sknebel has quit [Remote host closed the connection]
Rahix has joined #rust-embedded
sknebel has joined #rust-embedded
<re_irc> < (@jamesmunns:beeper.com)> : Yeah, at least also having an "include_bytes_val!()" that returns "[u8; N]" instead of "&[u8]"
<re_irc> < (@jamesmunns:beeper.com)> the problem is mostly that the size is not nameable, I guess?
<re_irc> < (@jamesmunns:beeper.com)> or you'd need to have "[u8; _]", e.g. unspecified size work in const/static position, which isn't supported atm.
<re_irc> < (@jamesmunns:beeper.com)> it's only supported here because I'm doing a two stage thing.
<cr1901> Can confirm this works
<re_irc> < (@jamesmunns:beeper.com)> btw c1901, I might be wrong, but I don't think "#[used]" always does what you want (ensure sections always make it to the binary). I think it's supposed to, but I've had troubles when I don't ALSO have a "KEEP" directive in the linkerscript
<re_irc> < (@jamesmunns:beeper.com)> could be remembering wrong tho
<cr1901> Correct, I got hit by that today
<re_irc> < (@jamesmunns:beeper.com)> IF you want to get way more cursed, or ever want to to see what data is actually in that var (instead of just dumping it to a host or something), you might be interested in databake
<re_irc> < (@jamesmunns:beeper.com)> which (iirc?) basically uses proc macros to build the struct at compile time, so you can get a reference at runtime, and don't have to pay the deser/validation size/cpu usage cost.
<cr1901> I have no idea what the hell that crate is trying to do
<re_irc> < (@jamesmunns:beeper.com)> uhhh, it's basically a serializer that spits out rust code
<re_irc> < (@jamesmunns:beeper.com)> you would want this if you are "rendering" your data at build-rs or proc macro time, and wanted to "just have all the data as static/const vals"
<re_irc> < (@jamesmunns:beeper.com)> icu4x uses it to convert big old tables of data into autogenerated .rs files, instead of include_bytes + postcard-deserializing at runtim
<cr1901> So it's the fancy version of "using println to generate Rust code"
<re_irc> < (@jamesmunns:beeper.com)> Yeah, basically!
<re_irc> < (@jamesmunns:beeper.com)> icu4x uses it to convert big old tables of data into autogenerated .rs files, instead of include_bytes + postcard-deserializing at runtime
<cr1901> There's a few bugs, but I now have a mechanism to store binary/env info into info mem using build.rs and a small macro
<cr1901> (The last 64 bytes are calibration data/TI stuff
<cr1901> And yes, #[used] needs to be combined with a linker section marked as keep... so the top level memory.x will need to be modified for any project you use this crate in
<cr1901> (Honestly, once I deploy insns for using this crate, I'd appreciate ppl testing w/ other microcontrollers. I'm guessing most of them have an .info/.config section in flash
IlPalazzo-ojiisa has quit [Ping timeout: 248 seconds]
<re_irc> < (@jamesmunns:beeper.com)> love it :D
<re_irc> < (@jamesmunns:beeper.com)> Gentle reminder, today's Rust release, v1.67.0, is likely to alter struct ordering for repr(Rust) types! If you have unsafe code that starts acting funny after updating, you _probably_ are missing a "repr(C)" somewhere!
<re_irc> < (@jamesmunns:beeper.com)> Also, look at those new targets:
<re_irc> "powerpc64-ibm-aix", "mipsel-sony-psx", "aarch64-unknown-nto-qnx710", and "x86_64-pc-nto-qnx710"
<cr1901> YES LLVM SUPPORTS LOAD DELAY SLOTS FINALLY