cr1901 has quit [Read error: Connection reset by peer]
cr1901 has joined #rust-embedded
starblue has quit [Ping timeout: 240 seconds]
starblue has joined #rust-embedded
starblue has quit [Ping timeout: 240 seconds]
starblue has joined #rust-embedded
lehmrob has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
lehmrob has quit [Ping timeout: 265 seconds]
lehmrob has joined #rust-embedded
kenny has joined #rust-embedded
emerent has quit [Ping timeout: 246 seconds]
emerent has joined #rust-embedded
starblue has quit [Ping timeout: 240 seconds]
<re_irc>
<@wassasin:matrix.org> When I try to use static "MaybeUninit<[u8; 400 * 1024]> = MaybeUninit::uninit();" it ends up in "bss" for "mut" or even worse "rodata" when not mut
<re_irc>
<@wassasin:matrix.org> If I understand this correctly it should end up in ".uninit"
<re_irc>
<@diondokter:matrix.org> You can give it an attribute to place it in uninit
<re_irc>
<@dirbaio:matrix.org> rust never places stuff in uninit, only in rodata/data/bss
<re_irc>
<@dirbaio:matrix.org> because I don't think ".uninit" is as standardized
<re_irc>
<@wassasin:matrix.org> : cheers
<re_irc>
<@dirbaio:matrix.org> and because on non-embedded the distinction doesn't matter, because the fresh memory pages the kernel gives you are zero-initialized anyway
<re_irc>
<@dirbaio:matrix.org> rust does:
<re_irc>
immutable? -> .rodata
<re_irc>
otherwise, all bytes are zero or uninit? -> .bss
<re_irc>
otherwise -> .data
<re_irc>
<@wassasin:matrix.org> Yeah so immutable in ".rodata" actually increases the size of the binary
<re_irc>
<@dirbaio:matrix.org> you did ask for 400k of uninit immutable zeros. what's it supposed to do otherwise?
<re_irc>
<@dirbaio:matrix.org> * bytes.
<re_irc>
<@wassasin:matrix.org> Put it in uninit ;)
<re_irc>
<@dirbaio:matrix.org> it's better to use 400k of flash than 400k of RAM. flash is usually bigger
<re_irc>
<@dirbaio:matrix.org> and if you're not going to mutate them, there's no need for them to be in RAM
<re_irc>
<@wassasin:matrix.org> Should be irrelevant whether I need the flash; it is unnecessary to put it in the binary
<re_irc>
<@dirbaio:matrix.org> why do you want 400k that you're never going to write to?
<re_irc>
<@wassasin:matrix.org> For one this is just an example, but if you really want to know, I am trying to trigger an ECC memory corruption interrupt
<re_irc>
<@wassasin:matrix.org> This MCU does not provide a real mechanism to do that, and only the lame instruction of "try to read from uninitialized memory"
<re_irc>
<@dirbaio:matrix.org> oh, lol!
<re_irc>
<@wassasin:matrix.org> Doesn't seem to work though
<re_irc>
<@dirbaio:matrix.org> fun
<re_irc>
<@wassasin:matrix.org> Even though the memory is juggled every time I reboot the device
<re_irc>
<@wassasin:matrix.org> But perhaps the peripheral is not working, so checking that out now
<re_irc>
<@wassasin:matrix.org> The instruction for flash ECC checks is "write multiple times to flash without erasing"
<re_irc>
<@dngrs:matrix.org> is there an established practice to determine (on the firmware side) when a usb-cdc serial device is truly "ready"? Currently I solve this by a 1.5s delay but that kinda sucks
<re_irc>
<@jamesmunns:beeper.com> embassy's serial has an "is device connected", not sure if that is enough
<re_irc>
<@dngrs:matrix.org> : mh, gonna check that out, thx
<re_irc>
<@xiretza:xiretza.xyz> in zephyr you can check the DTR signal, but I don't know if that's an actual USB-CDC thing or just something zephyr emulates
<re_irc>
<@dngrs:matrix.org> IIRC DTR went up too soon, at least with a macos host :/
<re_irc>
<@dngrs:matrix.org> but maybe that's now fixed with a new major macos version release, gonna re-check that too (also I'm not 100% sure the issue is actually on the host side, maybe usb-cdc is too eager)
<re_irc>
<@jamesmunns:beeper.com> I don't want to be too pessimistic, but this feels like the sort of thing that will end up being "what is the standard", "I have found the standard", "everyone breaks the standard in slightly different ways", "im back to waiting 1.5s"
<re_irc>
<@dngrs:matrix.org> yeah, that's not unlikely
<re_irc>
<@jamesmunns:beeper.com> for soupstone I plan to basically send pings until I get an ack. Not sure if it'll be host or client initiated
<re_irc>
<@dngrs:matrix.org> I mean, I get "WouldBlock" if I start writing too early, so I could even make my own DTR state machine
<re_irc>
<@dngrs:matrix.org> (well, ok, that would require me sending random garbage to test the state of affairs, which also isn't optimal)