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
<cr1901> (Tho it's not my personal preference)
<re_irc> < (@jamesmunns:beeper.com)> I mean, you should be able to make your own semver types with 3xu32 + InfoStr, and impl From<Semver> for that type
<cr1901> Yea, I've already mostly did it, as a matter of fact
<re_irc> < (@jamesmunns:beeper.com)> then you wouldn't need any custom serde code :p
* cr1901 is cranky tonight
<cr1901> API Design Hard
<re_irc> < (@jamesmunns:beeper.com)> I guess you could use all usizes too, since they are also varints. you just couldn't have any of your versions be >= u16::max
<re_irc> < (@jamesmunns:beeper.com)> which... seems reasonable to me :D
<cr1901> I also was able to convert the function to const, which made my other issue go away
<re_irc> < (@jamesmunns:beeper.com)> Also, I'm a little confused why you are using "konst" to parse the usizes - serde/postcard aren't const, so you won't be able to serialize them in const context - and if you're always creating them in a build rs with a heap available, you could just do "env!().parse::<usize>().unwrap()"
<re_irc> < (@jamesmunns:beeper.com)> but I don't totally grok all the stuff you are doing.
<cr1901> I'm not using a build.rs
<cr1901> for the postcard-infomem crate
<cr1901> I don'
<cr1901> t feel like I should have to add one because it's taking forever to make parse<T>() work in const context
<re_irc> < (@jamesmunns:beeper.com)> but why does "this_version" need to be const at all?
<re_irc> < (@jamesmunns:beeper.com)> (where are you actually calling that?)
<cr1901> Oh, it doesn't need to be const, but I don't want to risk this error coming back: https://github.com/rodrimati1992/const_panic/issues/7
<cr1901> It disappeared (even in debug mode!) once the entire function was proven to be const
<cr1901> for some reason...
<re_irc> < (@jamesmunns:beeper.com)> yeah, I don't think you'll ever be _creating_ an "InfoMem" in embedded context, only in std context, right?
<re_irc> < (@jamesmunns:beeper.com)> like, you might _deserialize_ an InfoMem in embedded context, but "creating" one only makes sense from the build rs context
<re_irc> < (@jamesmunns:beeper.com)> (what I'm saying is - you don't have to worry about const_panic at all if you aren't using the konst crate)
<cr1901> right, I don't know why the error went away
<cr1901> once I removed embedded_semver from the crate graph. But it did
<re_irc> < (@jamesmunns:beeper.com)> okay - I totally don't follow, but I won't try to parachute in while you're in the middle of something
<cr1901> Yes, I could use a build.rs- I don't want to
<cr1901> ^Short version
<re_irc> < (@jamesmunns:beeper.com)> you can't call "serialize" in const tho
<re_irc> < (@jamesmunns:beeper.com)> serde traits (or traits in general, really) aren't const.
<re_irc> < (@jamesmunns:beeper.com)> you nominally COULD make a custom const fn that spits out postcard-valid data. but you'd sorta be doing it all by hand
<cr1901> ahh, then nevermind about const
<cr1901> I was using const as a hack to get the compile to work. I'll just use a build script to generate some constants instead
rardiol has joined #rust-embedded
<re_irc> < (@jamesmunns:beeper.com)> cr1901 I get an email notification every time you force push that commit that tags me, just fyi
IlPalazzo-ojiisa has quit [Quit: Leaving.]
fabic_ has quit [Ping timeout: 246 seconds]
starblue has quit [Ping timeout: 252 seconds]
starblue has joined #rust-embedded
rardiol has quit [Ping timeout: 252 seconds]
<cr1901> jamesmunns: Sorry, I did not know GH was stupid like that
fabic_ has joined #rust-embedded
prioritize has quit [Remote host closed the connection]
Dr_Who has quit [Ping timeout: 246 seconds]
fabic_ has quit [Ping timeout: 255 seconds]
<re_irc> < (@korken89:matrix.org)> : Cool!
<re_irc> < (@korken89:matrix.org)> I continued scratching my itch, so I added support for subtopics https://github.com/korken89/async-bus/blob/master/src/main.rs#L3
<re_irc> < (@korken89:matrix.org)> I'm quite amazed at how simple codegen this would be
<re_irc> < (@korken89:matrix.org)> Now I just need to make "broadcast" to work with embedded async and then I got a full topic based message bus with static typing for embedded :D
<re_irc> < (@korken89:matrix.org)> * a "broadcast" that works
<re_irc> < (@korken89:matrix.org)> With static definitions
<re_irc> < (@korken89:matrix.org)> I think that could be quite nice when building a little bit more complex systems
<re_irc> < (@korken89:matrix.org)> It sort of reminds me of Zephyr's message bus, but nice
<re_irc> < (@korken89:matrix.org)> And a lib, so it would work in RTIC and "embassy"
<re_irc> < (@korken89:matrix.org)> I think this itch will be this weekends lib impl :D
<re_irc> < (@korken89:matrix.org)> * weekends'
lehmrob has joined #rust-embedded
<re_irc> < (@thejpster:matrix.org)> Next time we have arm questions, try these people:
<re_irc> < (@thejpster:matrix.org)> They don’t do cortex m but if we don’t ask they never will
<re_irc> < (@9names:matrix.org)> going to ask them about Risc PC support?
<re_irc> < (@thejpster:matrix.org)> Damn. I should do that.
fabic_ has joined #rust-embedded
<re_irc> < (@lulf_:matrix.org)> : that's nice! There is some stuff that seems semi-related here as well https://docs.rs/embassy-sync/0.1.0/embassy_sync/pubsub/struct.PubSubChannel.html
<re_irc> < (@lulf_:matrix.org)> By
<re_irc> < (@lulf_:matrix.org)> : that's nice! There is some stuff that seems semi-related here as well https://docs.rs/embassy-sync/0.1.0/embassy_sync/pubsub/struct.PubSubChannel.html - if you need some embedded primitives similar to the tokio ones
<re_irc> < (@lulf_:matrix.org)> : that's nice! There is already a pubsub channel (and other stuff) in embassy-sync that you could use as well https://docs.rs/embassy-sync/0.1.0/embassy_sync/pubsub/struct.PubSubChannel.html - if you need some embedded primitives similar to the tokio ones
<re_irc> < (@lulf_:matrix.org)> Not to discourage you from writing your own of course :)
<re_irc> < (@korken89:matrix.org)> I saw that one, but wanted to look at supporting infinite sub/pubs
<re_irc> < (@korken89:matrix.org)> I have found a neat trick we do all over the place in RTIC to support "infinite" number of waiters for things
<re_irc> < (@diondokter:matrix.org)> : Ha good luck 😉
<re_irc> < (@korken89:matrix.org)> So one gets infallible interfaces
<re_irc> < (@diondokter:matrix.org)> Though, if you find a way, I'd be really interested
<re_irc> < (@korken89:matrix.org)> (we do it now for "rtic-channel" and "rtic-timerqueue")
<re_irc> < (@korken89:matrix.org)> So one never needs to define the size
<re_irc> < (@korken89:matrix.org)> So that's quite neat IMO :D
<re_irc> < (@korken89:matrix.org)> I really detest the fallible interfaces, and with async we can remove them
<re_irc> < (@korken89:matrix.org)> So it'll be interesting :D
<re_irc> < (@korken89:matrix.org)> : You can have a look at "WaitQueue" in "rticv2" branch
<re_irc> < (@korken89:matrix.org)> It uses this trick the most right now
<re_irc> < (@korken89:matrix.org)> But we use it all over the place
<re_irc> < (@korken89:matrix.org)> More or less we store nodes for intrusive linked lists on the pinned stack of futures
<re_irc> < (@korken89:matrix.org)> Together with a bit of macros you can also allocate static storage for e.g. a subscriber
<re_irc> < (@lulf_:matrix.org)> That would be nice, I don't like all those const params
<re_irc> < (@korken89:matrix.org)> So you don't get the issue of writing to dropped memory
<re_irc> < (@korken89:matrix.org)> I'm quite rewriting a lot for RTIC :)
<re_irc> < (@korken89:matrix.org)> Partly for me learning, partly to get the omnomnom interfaces I want D
<re_irc> < (@korken89:matrix.org)> * :D
<re_irc> < (@korken89:matrix.org)> I'm rewriting a lot for RTIC :)
<re_irc> < (@jamesmunns:beeper.com)> Definitely check out maitakes test suite - if you're writing intrusive stuff like that, you almost certainly want to have a miri test setup, and ideally loom as well if you're doing atomics for lock free stuff as well.
<re_irc> < (@korken89:matrix.org)> PRs welcome ;)
<re_irc> < (@jamesmunns:beeper.com)> Is cool/powerful, is also incredibly easy to introduce subtle soundness bugs
<re_irc> < (@korken89:matrix.org)> Right now I only stress test datastructures with debug_asserts and tokio
<re_irc> < (@diondokter:matrix.org)> Yeah my pubsub uses an array to store the wakers, hence the const sizes
<re_irc> < (@korken89:matrix.org)> Makes perfect sense
<re_irc> < (@korken89:matrix.org)> But yeah, there is a lot of testing that will need to be done
<re_irc> < (@jamesmunns:beeper.com)> You super don't want "write first test never" for stuff like that. I'm happy to help if I can, but I have been humbled repeatedly by maitakes test suite
<re_irc> < (@korken89:matrix.org)> For now "working under stresstesting" is good enough
<re_irc> < (@korken89:matrix.org)> : If you feel like you have time and would like to put the effort I'd welcome it :)
<re_irc> < (@jamesmunns:beeper.com)> At the moment I have no idea what rticv2 even is, so I'd be coming in pretty blind.
<re_irc> < (@jamesmunns:beeper.com)> But yeah, just a reminder there be dragons.
<re_irc> < (@korken89:matrix.org)> RTICv2 is here: https://github.com/rtic-rs/cortex-m-rtic/tree/rticv2
<re_irc> < (@korken89:matrix.org)> : Indeed, dragons and treasure :)
<re_irc> < (@korken89:matrix.org)> There is no other way to do it AFAIK than to use intrusive lists and get the properties we look for
<re_irc> < (@korken89:matrix.org)> Letting async solve the "local alloc" issue during an await is very powerful as a building block
fabic_ has quit [Ping timeout: 246 seconds]
rardiol has joined #rust-embedded
starblue has quit [Ping timeout: 255 seconds]
starblue has joined #rust-embedded
IlPalazzo-ojiisa has joined #rust-embedded
<re_irc> < (@htms:matrix.org)> Does RTIC work with STM32 stop modes? If yes, what is the suggested place to implement power mode change?
<re_irc> < (@ryan-summers:matrix.org)> That depends on the interrupt and the stop mode :) You'll have to read the RM to figure it out
<re_irc> < (@adamgreig:matrix.org)> : in trustzone-m-rt, does the find_veneer business have to search your ns vector table for the right function name hash for each s->ns call? in principle could the linker somehow put the right address in for you (or is that already what happens)?
<re_irc> < (@ryan-summers:matrix.org)> Some stop modes completely power off internal oscillators, so you can't e.g. wake on a UART TX ISR. But you can wake on an external interrupt
<re_irc> < (@ryan-summers:matrix.org)> This is why there's often multiple "low power modes" in the chip - you can only select the maximum sleep your system can tolerate. Other than that, RTIC has no control of the silicon
<re_irc> < (@ryan-summers:matrix.org)> And also no knowledge of it, so you have to read about this yourself
<re_irc> < (@htms:matrix.org)> : I will use LPUART and LPTIM to exit stop mode 2 on stm32l451, so I'm wondering if RTIC will just work after I wake up after stop mode 2 or there are some workarounds.
<re_irc> < (@diondokter:matrix.org)> : So the problem is that that could be done at most in one direction and the library is designed to go on both directions. So theoretically it could be done.
<re_irc> What is possible though (and what I couldn't do because I ran out of time) is to only do the search the first time and put the pointer in a static variable. That should eliminate most performance costs.
<re_irc> < (@dirbaio:matrix.org)> build a 3rd crate that defines the "ABI" and have the two firmware bins depend on that?
<re_irc> < (@thejpster:matrix.org)> This is what Neotron does
<re_irc> < (@adamgreig:matrix.org)> I guess in the worst case you could do a custom linker wrapper like flip-link that resolves the lookups or something
<re_irc> < (@adamgreig:matrix.org)> but i wonder if you could do it with some clever relocations
<re_irc> < (@adamgreig:matrix.org)> tbh even if you just put like a branch to a symbol name in the s side that the linker has to resolve to an ns veneer name at link time... idk
<re_irc> < (@adamgreig:matrix.org)> maybe that should work actually?
<re_irc> < (@adamgreig:matrix.org)> anyway i just wondered after reading your blog post, i haven't touched trustzone at all but the blog post was cool :)
<re_irc> < (@jamesmunns:beeper.com)> also pretty much what mnemos does
fabic_ has joined #rust-embedded
<re_irc> < (@mehmet:grusbv.com)> Hi, what is a simplest way to find a function from PC and and source code?
<re_irc> < (@mehmet:grusbv.com)> * Program Counter
<re_irc> < (@jamesmunns:beeper.com)> addr2line probably
<re_irc> < (@jamesmunns:beeper.com)> if you have the elf file too
<re_irc> < (@mehmet:grusbv.com)> yep
<re_irc> < (@mehmet:grusbv.com)> but unfortunately WindowS?
<re_irc> < (@mehmet:grusbv.com)> * Windows?
<re_irc> < (@mehmet:grusbv.com)> :/
<re_irc> < (@mehmet:grusbv.com)> ah ha found Win
<re_irc> < (@jamesmunns:beeper.com)> like, you're running a program on windows?
<re_irc> < (@jamesmunns:beeper.com)> https://github.com/gimli-rs/addr2line is what I was thinking of
<re_irc> < (@jamesmunns:beeper.com)> I thiiiiink that works with embedded stuff too? The probe-rs folks probably know better than I do
<re_irc> < (@mehmet:grusbv.com)> So cargo install addr2line would work
<re_irc> < (@jamesmunns:beeper.com)> I think so? disclaimer, I've never used it, but have seen other embedded people talk about it
<re_irc> < (@mehmet:grusbv.com)> A binary on the host machine
<re_irc> < (@mehmet:grusbv.com)> Let's see.
<re_irc> < (@mehmet:grusbv.com)> Thanks James.
<re_irc> < (@jamesmunns:beeper.com)> oh, THAT addr2line is a lib, not a bin
<re_irc> < (@jamesmunns:beeper.com)> not sure if there's like an "arm-none-eabi-addr2line"
<re_irc> < (@mehmet:grusbv.com)> Yep
<re_irc> < (@mehmet:grusbv.com)> noticed that
<re_irc> < (@mehmet:grusbv.com)> Letme chack
<re_irc> < (@jamesmunns:beeper.com)> ah there is!
<re_irc> < (@jamesmunns:beeper.com)> which arm-none-eabi-addr2line
<re_irc> /usr/bin/arm-none-eabi-addr2line
<re_irc> < (@mehmet:grusbv.com)> yep
<re_irc> < (@mehmet:grusbv.com)> I have that!
<re_irc> < (@jamesmunns:beeper.com)> so maybe "arm-none-eabi-addr2line -a 0x12345678 ./path/to/elf" ?
<re_irc> < (@jamesmunns:beeper.com)> +-e
<re_irc> < (@jamesmunns:beeper.com)> (need "-e" flag for filename)
emerent has quit [Ping timeout: 248 seconds]
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
emerent has joined #rust-embedded
lehmrob has quit [Quit: Konversation terminated!]
<re_irc> < (@adamgreig:matrix.org)> can anyone think of clever ways for cortex-m-rt to check if a linker script has been set? someone opened https://github.com/rust-embedded/cortex-m/issues/471 about how if you forget to put "-C link-arg=-Tlink.x" etc in your cargo config one way or another, your build works fine but the resulting binary is useless
<re_irc> < (@adamgreig:matrix.org)> one option is that cortex-m-rt could check in its build.rs whether "link-arg=-T" is present in "CARGO_ENCODED_RUSTFLAGS" env var, which helpfully does contain the link-arg stuff
<re_irc> < (@adamgreig:matrix.org)> and I _think_ you have to somehow put that flag into rustflags, whether it's by cargo config or RUSTFLAGS command line arg, to possibly get a working build
<re_irc> < (@adamgreig:matrix.org)> i.e., I can't think of a false positive situation for this check, but I worry there could be one that would annoy someone
<re_irc> < (@adamgreig:matrix.org)> the other candidate is putting something in the linker script and in the lib.rs that interacts to trigger an error if the linker script isn't present (or the default linker script is used) without using any output space, but I haven't found anything quite right for that - iirc anything with an unknown link_section just gets discarded silently, so you can't put a zst into some made up link section that...
<re_irc> ... only a real linker script defines, i don't think
<corecode> you can define a symbol in a linker script, but how do you require its presence from rust?
<re_irc> < (@adamgreig:matrix.org)> you could reference it like we do with _stack_start and stuff
starblue has quit [Ping timeout: 255 seconds]
fabic_ has quit [Ping timeout: 252 seconds]
<re_irc> < (@besselfn:matrix.org)> I'm writing a driver for a sensor with a non-linear response. The data sheet has some data points, and the necessary conversion (i.e. "output = 300 actual = 600; output = 400 actual = 900"). My thought is to just fit a polynomial and call it good, but is there an idiomatic way to build in linear interpolation into rust?
<re_irc> < (@dirbaio:matrix.org)> : this won't work if you set it via build.rs (https://github.com/embassy-rs/embassy/blob/master/examples/nrf52840/build.rs#L33)
<re_irc> < (@adamgreig:matrix.org)> ah, because your build.rs gets called after cortex-m-rt's build.rs does the check? yea, that's annoying
<re_irc> < (@dirbaio:matrix.org)> (btw I think we should change the quickstart to do that. it's much better than setting RUSTFLAGS in .cargo/config.toml)
<re_irc> < (@adamgreig:matrix.org)> I guess even if it didn't, perhaps cargo:rustc-link-arg doesn't end up inside rustflags
<re_irc> < (@adamgreig:matrix.org)> hmm yea
<re_irc> < (@dirbaio:matrix.org)> doesn't rebuild the world if you change it
<re_irc> allows having different linker scripts for different crates, or different bins in the same crate
<re_irc> doesn't break if you run the build from another cwd
<re_irc> < (@adamgreig:matrix.org)> iirc that option didn't exist at the time it was first written but it's nicer now that it is supported
<re_irc> < (@adamgreig:matrix.org)> yea
<re_irc> < (@dirbaio:matrix.org)> yeah, it's quite recent
<re_irc> < (@adamgreig:matrix.org)> nightly cargo in 2021-07-29, stable in 0.57 I think
<re_irc> < (@adamgreig:matrix.org)> yea, dec 2021, that's probably long enough ago to not worry about it being too new
<re_irc> < (@adamgreig:matrix.org)> easier to remember to copy across a build.rs than the hidden .cargo/config too. shame you can't set a default target in cargo.toml yet huh
<re_irc> < (@adamgreig:matrix.org)> but that does leave us without any ways for c-m-rt to check if a linker script was set :p
<re_irc> < (@dirbaio:matrix.org)> I think it's fundamentally impossible :S
<re_irc> < (@2:0x2c.org)> : i meant: to "check", the code could access a special symbol that is defined in the linker script
dc740 has joined #rust-embedded
<re_irc> < (@adamgreig:matrix.org)> yea, just a question of how to do that in a way that doesn't have any runtime impact _and_ isn't removed by the linker merrily deleting everything if you don't have a linker script because no code is ever called lol
<re_irc> < (@2:0x2c.org)> aah, that's the problem, i see
<re_irc> < (@adamgreig:matrix.org)> it seems possible one way or another
<re_irc> < (@dirbaio:matrix.org)> can it set the linker-script itself with that build.rs directive?
<re_irc> < (@dirbaio:matrix.org)> probably not
<re_irc> < (@adamgreig:matrix.org)> don't really want it to anyway because people do use other linker scripts
<re_irc> < (@adamgreig:matrix.org)> though maybe there could be some kind of opt out or a default feature or something
<re_irc> < (@2:0x2c.org)> could you add a secondary linker script that accesses a symbol defined in the linker script that should be included?
<re_irc> < (@2:0x2c.org)> but that might have link order issues
<re_irc> < (@adamgreig:matrix.org)> in any event you can't have a library add a linker flag it seems
<re_irc> < (@2:0x2c.org)> oh ok
dc740 has quit [Remote host closed the connection]
dc740 has joined #rust-embedded
<re_irc> < (@jamesmunns:beeper.com)> good to know, but aw.
<re_irc> < (@dirbaio:matrix.org)> > The majority of DWARF debug records in even a hello world application are dead code with bogus PC ranges all starting at 0.
<re_irc> so, it's _broken_ broken, not just wasted space :D
<re_irc> < (@tiwalun:matrix.org)> I think you just encounter it more often in embedded stuff, since valid code is often actually located near 0.
<re_irc> < (@jamesmunns:beeper.com)> Tbf, i don't think you're actually allowed to deref addr 0 like at all in Rust technically lol
<re_irc> < (@jamesmunns:beeper.com)> Like, we get by a lot on the fact that the linker is putting the reset vector there (usually) and the hardware is loading from that addr for us
<re_irc> < (@jamesmunns:beeper.com)> Not allowed => i think it's always ub to deref the nullptr in rust, which I think is strongly defined as a value of zero
<re_irc> < (@alex:acrawford.com)> Do you remember where you saw that? I'd be interested in reading more.
<re_irc> < (@jamesmunns:beeper.com)> I've seen some discussions (unsafe code guidelines repo?), But if you look at like all the safety invariants of the std/core lib, they say stuff like "no null ptrs"
<re_irc> < (@jamesmunns:beeper.com)> And rust does niche opts, like using a single word for "Option<NonNull<T>>"
<re_irc> < (@jamesmunns:beeper.com)> Which means Some(null_mut()) == None
<re_irc> < (@jamesmunns:beeper.com)> https://github.com/rust-lang/unsafe-code-guidelines/issues/29 looks maybe like what I remembered?
<re_irc> < (@jamesmunns:beeper.com)> (note, this is not "it will ALWAYS be UB to touch the nullptr in Rust", just "llvm might eat your lunch today, and rust makes no promises (yet)".)
<re_irc> < (@jamesmunns:beeper.com)> but yeah, we rarely have to think about it because:
<re_irc> - the linker is the one that puts the vector table there, it doesn't care about Rust's UB guarantees
<re_irc> - _usually_ the vector table is in flash, which you aren't going to touching directly anyway, as you rarely need the initial stack pointer value
<re_irc> < (@jamesmunns:beeper.com)> - the hardware is the one that loads that value at startup, not rust code
<re_irc> < (@jamesmunns:beeper.com)> AND, if you WERE to pass in a null ptr to something like a cortex-m asm function, that's fine! it's just a value until the asm code does something with it, and asm doesn't care about UB!
<re_irc> < (@jamesmunns:beeper.com)> (just don't deref it yourself in Rust)
<re_irc> < (@alex:acrawford.com)> Thanks for digging that up.
<re_irc> < (@jamesmunns:beeper.com)> you'll see:
<re_irc> > the pointer must be non-null and properly aligned
<re_irc> a lot in the safety sections.
<re_irc> Which doesn't play nice with: https://doc.rust-lang.org/src/core/ptr/mod.rs.html#515-517
<re_irc> < (@firefrommoonlight:matrix.org)> When i was learning EDA there were many options and it was hard to find a clear winner
<re_irc> < (@firefrommoonlight:matrix.org)> Now the clear winner is KiCad
<re_irc> < (@firefrommoonlight:matrix.org)> (I guess ALtium is fine if your work has the $$)
<re_irc> < (@firefrommoonlight:matrix.org)> * (ALtium
<re_irc> < (@jamesmunns:beeper.com)> I mean, for personal/digital stuff, yeah, kicad kicks a lot of ass
<re_irc> < (@jamesmunns:beeper.com)> the expensive stuff has a lot of analysis tools that kicad doesn't yet tho, afaik.
<re_irc> < (@jamesmunns:beeper.com)> that being said, kicad is closing the gap more every year, which is dope. it's all I've used since picking up circuit design again a couple years back
<re_irc> < (@jamesmunns:beeper.com)> (it helps I haven't had to do super complex DDR routing or antenna design or multi-ghz shenanigans tho :D )
<re_irc> < (@firefrommoonlight:matrix.org)> Would like to try the expensive ones sometimes
<re_irc> < (@firefrommoonlight:matrix.org)> But I am too poor atm lol
<re_irc> < (@firefrommoonlight:matrix.org)> I did compare most of the free ones though
<re_irc> < (@firefrommoonlight:matrix.org)> KiCad is a shining beacon of how OSS can be outstanding
<re_irc> < (@firefrommoonlight:matrix.org)> One of the best examples I can think of
<re_irc> < (@firefrommoonlight:matrix.org)> I wish there was something on its tier for 3D CAD
<re_irc> < (@firefrommoonlight:matrix.org)> But I recognize that's a tougher problem
<re_irc> < (@k900:0upti.me)> Solvespace isn't terrible
<re_irc> < (@k900:0upti.me)> I mean, "not terrible" isn't exactly a high bar
<re_irc> < (@k900:0upti.me)> But for an open source CAD software it kinda is
<re_irc> < (@stephen:crabsin.space)> : How does it compare to freecad?
<re_irc> < (@firefrommoonlight:matrix.org)> I've been using SolidWorks
<re_irc> < (@firefrommoonlight:matrix.org)> That compares ... favorably... to FreeCad. haven't used SolveSpace
<re_irc> < (@firefrommoonlight:matrix.org)> (Was able to score SW with a discount)
<re_irc> < (@k900:0upti.me)> : Less "WTF just happened" per hour, more "WTF is this feature not implemented" per hour
<re_irc> < (@k900:0upti.me)> But I'd say it's a good tradeoff
<re_irc> < (@stephen:crabsin.space)> : lmao
<re_irc> < (@stephen:crabsin.space)> For fun, I'd like to drive a VGA display (>1MHz clock) with an stm32f411 (100MHz clock). Given how close these frequencies are, should I write inline assembly code so that I can count up the # of cycles required (manually adding in "nop"s as needed? Is there a better way to do this?
<re_irc> < (@jamesmunns:beeper.com)> At least as a mitigation, maybe we could get cargo embed and probe run to give better diagnostics in this case, maybe point to some doc page that explains how to fix it?
starblue has joined #rust-embedded
<re_irc> < (@peter9477:matrix.org)> : For me, idiomatic in Rust or Python always means checking for existing packages. Maybe https://crates.io/crates/lerp ?
<re_irc> < (@2:0x2c.org)> : VGA pixel clock seems to be ~25MHz - seems you'd need to use a hardware peripheral, maybe DMAing?
<re_irc> < (@besselfn:matrix.org)> : That's pretty much exactly what I was looking for. Thanks!
<re_irc> < (@jamesmunns:beeper.com)> The original monotron used three SPI peripherals to generate VGA, I believe
<re_irc> < (@jamesmunns:beeper.com)> (plus some ASM nops and dummy bits to synchronize the three channels?)
dc740 has quit [Remote host closed the connection]
<re_irc> < (@stephen:crabsin.space)> : You can clock it lower just by using larger pixels
<re_irc> < (@stephen:crabsin.space)> The device still sees the smaller pixels, it's just that consecutive pixels will be the same value
<re_irc> < (@dngrs:matrix.org)> oh jeez, instant flashback to 90s XFree86 modeline/pixel clock calculators
jcroisant has joined #rust-embedded
rardiol has quit [Ping timeout: 246 seconds]
rardiol has joined #rust-embedded
starblue has quit [Ping timeout: 246 seconds]
rardiol has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
starblue has joined #rust-embedded
<re_irc> < (@therealprof:matrix.org)> I believe Keith Packard was also involved in that back in the day. Used to work with him many moons ago.
brazuca has joined #rust-embedded
<re_irc> < (@firefrommoonlight:matrix.org)> : What's the sensor, and what's the mapping look like?
<re_irc> < (@firefrommoonlight:matrix.org)> Anyway, this is language-agnostic regardless
<re_irc> /// Utility function to linearly map an input value to an output
<re_irc> < (@firefrommoonlight:matrix.org)> Linear, 1D:
<re_irc> // todo: You may be able to optimize calls to this by having the ranges pre-store
<re_irc> pub fn map_linear(val: f32, range_in: (f32, f32), range_out: (f32, f32)) -> f32 {
<re_irc> < (@firefrommoonlight:matrix.org)> There are various ways of structing the arguments. Like, if you think of it as X/Y points or w/e the API will be different
<re_irc> < (@firefrommoonlight:matrix.org)> Here's an all-in-one for an order-3 poly:
<re_irc> /// Algorithm created from the `P(x)` eq
<re_irc> /// Compute the result of a Lagrange polynomial of order 3.
<re_irc> < (@firefrommoonlight:matrix.org)> Here's an all-in-one for an order-3 poly:
<re_irc> let mut result = 0.;
<re_irc> fn langrange_o3_1d(posit_sample: f64, pt0: (f64, f64), pt1: (f64, f64), pt2: (f64, f64)) -> f64 {
<re_irc> let x = [pt0.0, pt1.0, pt2.0];
<re_irc> < (@firefrommoonlight:matrix.org)> Here's an all-in-one for an order-3 poly:
<re_irc> /// Algorithm created from the `P(x)` eq
<re_irc> /// Compute the result of a Lagrange polynomial of order 3.
<re_irc> < (@firefrommoonlight:matrix.org)> Her'es a different variant of the lin:
<re_irc> /// Utility function to linearly map an input value to an output
<re_irc> /// organization of input parameters)
<re_irc> /// (Similar to `map_linear` function you use in other projects, but with different
<re_irc> < (@firefrommoonlight:matrix.org)> Here's a probably more efficient/clearer order-2 poly where it gives you the coeffs instead of doing it all-in-1:
<re_irc> /// Create an order-2 polynomial based on 2 or 3 calibration points.
<re_irc> /// todo: Return option for 0?
<re_irc> /// This is a general mathematical function, and can be derived using a system of equations.
<re_irc> < (@firefrommoonlight:matrix.org)> Although the arguments there are set up in a quite specific way
<re_irc> < (@firefrommoonlight:matrix.org)> Here's a probably more efficient/clearer order-2 poly where it gives you the coeffs instead of doing it all-in-1:
<re_irc> /// Create an order-2 polynomial based on 2 or 3 calibration points.
<re_irc> fn create_polynomial_terms(pt0: (f32, f32), pt1: (f32, f32), pt2: Option<(f32, f32)>) -> (f32, f32, f32) {
<re_irc> /// This is a general mathematical function, and can be derived using a system of equations.
<re_irc> < (@firefrommoonlight:matrix.org)> Here's a probably more efficient/clearer order-2 poly where it gives you the coeffs instead of doing it all-in-1:
<re_irc> /// `a` is the ^2 term, `b` is the linear term, `c` is the constant term.
<re_irc> /// Create an order-2 polynomial based on 2 or 3 calibration points.
<re_irc> /// This is a general mathematical function, and can be derived using a system of equations.
brazuca has quit [Quit: Client closed]
fabic_ has joined #rust-embedded