Darius has joined #rust-embedded
radens has joined #rust-embedded
engest has joined #rust-embedded
radens has quit [Quit: Connection closed for inactivity]
fabic has joined #rust-embedded
PyroPeter has quit [Ping timeout: 252 seconds]
PyroPeter has joined #rust-embedded
radens has joined #rust-embedded
engest has quit [Ping timeout: 245 seconds]
fabic has quit [Ping timeout: 260 seconds]
radens has quit [Quit: Connection closed for inactivity]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 260 seconds]
engest has joined #rust-embedded
fabic has joined #rust-embedded
<re_irc> <@moerk:matrix.org> What is the preffered way to do state machine?
<re_irc> <@newam:matrix.org> If you don't need performance just a giant `match`
<re_irc> <@newam:matrix.org> You can make an enum with custom `next` methods or whatever to make the transitions clear.
fabic has quit [Ping timeout: 260 seconds]
<re_irc> <@ryan-summers:matrix.org> Use a crate like smlang
<re_irc> <@ryan-summers:matrix.org> It allows you to quickly define the state and all necessary events + transitions and makes it a hell of a lot cleaner than a giant match
<re_irc> <@sourcebox:matrix.org> So I got RTT working via rtt_target. Initially I wanted to use the existing rtt_logger quote, but this doesn't work and is obviously unmaintained. No repo also. So I put together my own version of it. Of course, I have to find a different name for it now. Any ideas?
<re_irc> <@dirbaio:matrix.org> rtt_logger does work..
<re_irc> <@sourcebox:matrix.org> But it's already taken at crates.io. Or does rtt-logger refer to a different crate?
<re_irc> <@sourcebox:matrix.org> Because the hyphen is normally replaced by underscore.
<re_irc> <@sourcebox:matrix.org> Can shorten it to rtt_log
<Lumpio-> Maybe I should just add log support to rtt-target directly finally
<re_irc> <@sourcebox:matrix.org> That would be the best option.
<re_irc> <@sourcebox:matrix.org> Do you want to have a look at my code? It's not very much.
<re_irc> <@ryan-summers:matrix.org> We definitely use rtt-logger all the time
<re_irc> <@sourcebox:matrix.org> The existing one?
<re_irc> <@ryan-summers:matrix.org> Hmm, never mind, we use `rtt-target` directly because we have to wrap our own logger for interrupt context stuff
<re_irc> <@sourcebox:matrix.org> rtt-target works well.
<re_irc> <@sourcebox:matrix.org> Having a working logger crate or direct support within rtt-target would make switching between different loggers very simple - just one line of code has to be changed to init the desired logger.
<re_irc> <@sourcebox:matrix.org> Ok. I've put this on GitHub if anyone is interested: https://github.com/sourcebox/rtt_log-rs
<Lumpio-> I always talk about I should do this should do that but never get around to it heh
<re_irc> <@sourcebox:matrix.org> Should I publish this on crates.io?
<re_irc> <@sourcebox:matrix.org> Because when you're going to implement it directly, it is rather pointless.
<re_irc> <@ryan-summers:matrix.org> Why not just PR it into `rtt-target` instead?
<re_irc> <@newam:matrix.org> Maybe with `log = { version = "0.4", optional = true }`?
<re_irc> <@newam:matrix.org> Log does add a bit to compile times if I recall correctly.
<re_irc> <@ryan-summers:matrix.org> Yeah, seems like a feature would be easy
<re_irc> <@ryan-summers:matrix.org> But ultimately it's your code :)
<re_irc> <@sourcebox:matrix.org> I would like to leave it up to Lumpio-, I'm sure he has some ideas own his own to integrate it.
<re_irc> <@ryan-summers:matrix.org> I think he was pointing out that he's probably too busy to get around to it, and I empathize with him :P
<re_irc> <@ryan-summers:matrix.org> But again, your choice
<Lumpio-> Busy? Lazy!
<re_irc> <@ryan-summers:matrix.org> Fair enough
<re_irc> <@sourcebox:matrix.org> Lumpio-: my crate is just one file. You take the lib.rs, change it to logger.rs or similar and adapt it to your like.
<re_irc> <@ryan-summers:matrix.org> I think you'd be much more persuasive with a PR where he can say ök";)
<Lumpio-> I had weird ideas about channels and auto init and whatnot but
<Lumpio-> I guess really most people just want rprintln
<Lumpio-> (via log or not)
<re_irc> <@sourcebox:matrix.org> Another thing. I get the RTT messages via probe-run on the console, but VS Code with cortex-debug complains about symbol _SEGGER_RTT not found.
<re_irc> <@sourcebox:matrix.org> Workaround is to specify the address manually. Where do I get this information?
<re_irc> <@newam:matrix.org> sourcebox:matrix.org: I think the magic is `nm --demangle --numeric-sort path/to/your/elf`
<re_irc> <@sourcebox:matrix.org> Will the symbol always have the same address?
<re_irc> <@newam:matrix.org> no
<re_irc> <@newam:matrix.org> Generally you do something like this to find the symbol:
<re_irc> <@newam:matrix.org> ```rs
<re_irc> <@newam:matrix.org> use object::{Object, ObjectSymbol};
<re_irc> <@newam:matrix.org> fn rtt_region() -> anyhow::Result<probe_rs_rtt::ScanRegion> {
<re_irc> <@sourcebox:matrix.org> The symbol exists in the ELF file.
<re_irc> <@sourcebox:matrix.org> I don't want to deal with this, it's the job of the VS Code extension.
<re_irc> <@newam:matrix.org> Yeah, that above code finds the symbol from the ELF
<re_irc> <@sourcebox:matrix.org> If probe-run can do it, the extension should also.
<re_irc> <@newam:matrix.org> if the extension is broke it shouldn't be hard to fix, it's just iterating over symbols
emerent_ has joined #rust-embedded
emerent is now known as Guest353
Guest353 has quit [Killed (iridium.libera.chat (Nickname regained by services))]
emerent_ is now known as emerent
fabic has joined #rust-embedded