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
<hyphened[m]> The code is on Github repo, give me a sec to get the links
<JamesMunns[m]> either way, taking a lot more contextual info, using GDB and breakpoints, to capture register states and things like that around the spooky bits is usually helpful
<holo[m]> hyphened[m]: i try but compiler didnt like it too
<JamesMunns[m]> you have some typos, and you can't really put {unknown} in the type
<JamesMunns[m]> holo[m]: Also, what does the error on the command line when you do `cargo check` say?
<JamesMunns[m]> Both repos are private
<hyphened[m]> Made public
<hyphened[m]> Clone those to the same folder and try to build lpctest on a recent nightly
<holo[m]> JamesMunns[m]: https://pastebin.com/ALzrmnfh
<hyphened[m]> Thats my setup currently
<JamesMunns[m]> You're not using cortex-m-rt?
<hyphened[m]> I was experimenting with dynamic linker scripts based on target so I removed it and spun my own
<hyphened[m]> I think I can switch back in like 5 mins if you want
<dirbaio[m]> 🍿👀
<hyphened[m]> But mainly I just initialize BSS and DATA, then clocks, enable the coprocessor and jump to user main code
<hyphened[m]> The initialization assembly is copied directly from cortex-m-rt (quite shamelessly) 😁
<JamesMunns[m]> Yeah, some of your init stuff and linker script could maybe not be sound
<JamesMunns[m]> like "doing init in Rust" is generally not accepted to be sound
<JamesMunns[m]> dunno if it's the cause of your problem
<hyphened[m]> Could be
<hyphened[m]> What bothers me is that it fails only when the function is not inlined
<hyphened[m]> Cause if it was linker script or init it would fail both times, because all resources are in the same positions
<hyphened[m]> IDEK
<JamesMunns[m]> hyphened[m]: undefined behavior is not required to follow any logic or rules
<JamesMunns[m]> Also i'm a little unclear how you're building your vector table (or the difference between the stack you put in your vector table, vs vector table 0/stack 0?)
<JamesMunns[m]> It would be useful for you to look at:
<JamesMunns[m]> * `nm -nSC` to make sure all the symbols are ending up where you expect them to
<JamesMunns[m]> * objcopy to a bin to make sure your vector table and stuff look reasonable to you
<JamesMunns[m]> I'm not sure what the ABI of your CPU looks like and how vector tables and stuff are supposed to be assembled, compared to "standard" single core cortex-m parts
<hyphened[m]> JamesMunns[m]: There are 3 Vector Tables (when going to unsecure mode there will be 2 more), one for the Reset, until it bootstraps, then 1 for core 0 (along with its stack, which will be protected) and 1 for core1 (same as core 0), the exception handlers are copied from the reset one
<hyphened[m]> This is to account for different memory regions and different cores and operation modes
<hyphened[m]> JamesMunns[m]: > <@jamesmunns:beeper.com> It would be useful for you to look at:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/hFMRtdrvlGVHLFEvWGPCppXm>)
<hyphened[m]> JamesMunns[m]: Core 0 behaves like a single core, core 1 jumps to wahtever address you give it
<JamesMunns[m]> Gotcha! And the stack pointer all looks good according to GDB on init, and just before you go off the edge?
<hyphened[m]> JamesMunns[m]: Yeah mostly
<hyphened[m]> (╯°□°)╯︵ ┻━┻
<JamesMunns[m]> what does mostly mean lol
<hyphened[m]> If i comment line 147 (engine.finish()) everything works again even if not inlined
<hyphened[m]> And I just realized that I'm not protecting the VTable with the MPU
<JamesMunns[m]> really just saying: undefined behavior is spooky and can break unrelated things for any reason it feels like
<JamesMunns[m]> like, if your code is doing spooky things, the compiler is probably having a field day
<hyphened[m]> Yeap, it's both fun and distressing at the same time
<hyphened[m]> JamesMunns[m]: 🤣🤣
<hyphened[m]> i'm gonna steal that one
<JamesMunns[m]> I'd probably suggest:
<JamesMunns[m]> * go back to cortex-m-rt, it's a well reviewed, solid starting foundation
<JamesMunns[m]> * be real careful and verify each thing you do in the startup sequence, especially around linker script layout, memory initialization, and vector table assembly (at compiler or startup time)
<JamesMunns[m]> take small steps, one at a time, and lots of git commits, so you can step and diff
<JamesMunns[m]> I don't have any specific "a hah that's the problem", but a lot of that startup code looks sus, and you really shouldn't be initializing rust with rust, the abstract machine requires that "the world makes sense" before Rust starts executing
<hyphened[m]> JamesMunns[m]: > <@jamesmunns:beeper.com> I'd probably suggest:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/AkeMRPlWHLXKwCUcDWwquXsT>)
<hyphened[m]> A thousand thanks for helping me James Munns dirbaio
<hyphened[m]> JamesMunns[m]: Well that's a bummer, assembly it is then
<JamesMunns[m]> yeah, we used to do this, and it generally worked, EXCEPT when you started merging the `c-m-rt` code INTO your application project, at which point rustc would start "seeing through walls" and miscompiling UB
<JamesMunns[m]> though that was long ago, and it might even be more aggressive now.
<holo[m]> When i commented unused code, and try to change it according to compiler info i get:
<holo[m]> * When i commented unused code, and try to change it according to compiler info i get ⬆️
<GrantM11235[m]> <GrantM11235[m]> "Is someone going to submit it to..." <- Be the change you want to see in the world: https://github.com/rust-lang/this-week-in-rust/pull/5052
emerent has quit [Ping timeout: 246 seconds]
emerent has joined #rust-embedded
<StephenD[m]> This is probably a silly question but how does one deal with multiple delays with rp-hal?
<StephenD[m]> Or is the norm to just have one and wrap it in a mutex and pass it all over the place
<M9names[m]> Timer is clonable, make as many as you need
<StephenD[m]> Ty! Was not aware of the timer
mpiechotka[m] has quit [Quit: Idle timeout reached: 172800s]
Foxyloxy has joined #rust-embedded
Foxyloxy_ has quit [Ping timeout: 276 seconds]
notgull has joined #rust-embedded
notgull has quit [Ping timeout: 245 seconds]
IlPalazzo-ojiisa has joined #rust-embedded
notgull has joined #rust-embedded
<holo[m]> <holo[m]> "image.png" <- Is it possible at all to pass trait with associated type as parameter function?
notgull has quit [Ping timeout: 252 seconds]
crabbedhaloablut has quit [Read error: Connection reset by peer]
crabbedhaloablut has joined #rust-embedded
a2800276 has joined #rust-embedded
sjm42[m] has quit [Quit: Idle timeout reached: 172800s]
<holo[m]> With trail and errors i get in to something like that:
<holo[m]> how it can not be object if we can make something like that:
<holo[m]> `let mut i2c = i2c::I2c::new_async(p.I2C1, scl, sda, Irqs, Config::default());`
<dirbaio[m]> you can't use dyn with async traits
<K900> You can't currently make traits with async methods dyn
<holo[m]> i just followed compilar advices. Is there posibility to achieve it at all? I want to pass i2c as argument to my structure:
<K900> You could make it generic
<holo[m]> thanks, let me try this
<dirbaio[m]> don't create a separate generic param for the error type... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/PfisJtXLChmPFcdVLtOkDiGL>)
<dirbaio[m]> that was needed in the 0.2 days to force different traits to have the same error type (for example `where T: InputPin<Error = E> + OutputPin<Error = E>`)
<dirbaio[m]> the 1.0 traits are designed so you never need that anymore
<dirbaio[m]> s/never/rarely/
<holo[m]> it was so easy with your advice to satisfy compiler 🙂
<holo[m]> will proceed now and how it will work. i have one more question, when i was trying to understand it i checked this i2c trait:
<holo[m]> where can i read about this construction, mainly im not understand that : ErrorType after generic type. What it is?
<K900> That means this trait extends `ErrorType`
<holo[m]> ahh, thank you!
<holo[m]> * now and see how it
jsolano has quit [Quit: leaving]
jsolano has joined #rust-embedded
<JamesMunns[m]> Hey Peter Hansen it looks like the outlining fix SHOULD be in the next nightly, could you give it a spin tomorrow?
dngrs[m] has joined #rust-embedded
<dngrs[m]> Supertrait: the hero we need
<dngrs[m]> <holo[m]> "image.png" <- btw code screenshots have a few disadvantages (screen readers get left out, they take more space, can't be found by search or copy pasted to edit/comment on, etc). You can post syntax highlighted code by putting it in triple backticks and adding `rust` to the first backticks, like so:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/BBzoqJiAQrqafAUQgpSFPzJj>)
<dngrs[m]> in related QOL news, if you want a less ad-polluted pastebin than pastebin dot com there is https://dpaste.org/
<dngrs[m]> > <@holo:matrix.org> sent an image.... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/bHIuzxnAwRkFjDLTUvFmbPrN>)
a2800276 has quit [Quit: leaving]
a2800276 has joined #rust-embedded
<sympatron[m]> Have you tried embedded-hal-compat?
<dirbaio[m]> not supporting old HALs is also an option 🙃
Farooq has quit [Quit: Idle timeout reached: 172800s]
jannic[m] has quit [Quit: Idle timeout reached: 172800s]
danielb[m] has quit [Quit: Idle timeout reached: 172800s]
notgull has joined #rust-embedded
mabez[m] has quit [Quit: Idle timeout reached: 172800s]
adamgreig[m] has quit [Quit: Idle timeout reached: 172800s]
Danilo[m] has joined #rust-embedded
<Danilo[m]> embedded-hal-mock 0.10.0 is now published! It includes:... (full message at <https://catircservices.org/_matrix/media/v3/download/catircservices.org/GUWDKuLpyZQpRRrzuNXqcXZv>)
sirhcel[m] has quit [Quit: Idle timeout reached: 172800s]
notgull has quit [Ping timeout: 260 seconds]
leonardvdj[m] has quit [Quit: Idle timeout reached: 172800s]
<holo[m]> <dngrs[m]> "btw code screenshots have a..." <- i was using this but somone told me to not paste block of codes
<holo[m]> holo[m]: i will be using it again in that case
<JamesMunns[m]> I mean like 3-4 line snippets are fine
<JamesMunns[m]> You were posting like 20-40+ lines or whole files when I asked you to please not do that.
<holo[m]> JamesMunns[m]: ahh ok, undestand now
<JamesMunns[m]> Still, linking to a repo by line is still likely nicer.
ragarnoy[m] has quit [Quit: Idle timeout reached: 172800s]
<vollbrecht[m]> element auto detects long code sections and box them for scrolling(if you put them in a code section), though i don't know how good that works on other client's, so in general best to not assume that it works for everybody
coralreef has joined #rust-embedded