GenTooMan has quit [Ping timeout: 250 seconds]
GenTooMan has joined #rust-embedded
fabic has joined #rust-embedded
starblue2 has joined #rust-embedded
starblue1 has quit [Ping timeout: 240 seconds]
agg has quit [*.net *.split]
sauce has joined #rust-embedded
agg has joined #rust-embedded
agg is now known as Guest6056
fabic has quit [Ping timeout: 252 seconds]
fabic has joined #rust-embedded
x56 has joined #rust-embedded
fabic has quit [Ping timeout: 240 seconds]
Foxyloxy has quit [Quit: Textual IRC Client: www.textualapp.com]
Guest6056 has quit [Quit: WeeChat 1.8]
adamgreig has joined #rust-embedded
fabic has joined #rust-embedded
adamgreig is now known as agg
fabic has quit [Ping timeout: 252 seconds]
fabic has joined #rust-embedded
GenTooMan has quit [Quit: Leaving]
GenTooMan has joined #rust-embedded
<re_irc> <@m​rbraindump:m​atrix.org> Hello my dear rust embedded developers. I try to turn on the built-in LED on an FRDM KL25Z board. I use the crate 'mkl25z4'. But it seems like every time I try to actually try to read or write to a register, the program just steps over it. For debugging I use openocd and gdb with 'cargo run'. Here is my...
<re_irc> <@m​rbraindump:m​atrix.org> Is this a syntax problem (aka I am just too stupid for Rust)
<re_irc> ... main.rs: https://pastebin.com/1RJViWCr
<re_irc> <@m​rbraindump:m​atrix.org> Or is this rather a problem of my debugger (aka the code seems to check out)?
<re_irc> <@m​rbraindump:m​atrix.org> Thank you in advance!
<re_irc> <@a​damgreig:m​atrix.org> mrbraindump: do the semihosting prints work, i.e. do you see them in the gdb output?
<re_irc> <@a​damgreig:m​atrix.org> I don't know anything about KL25Z, but the code looks more or less OK... at the end I noticed you set pin 13 as input, but you check pin 12's state
<re_irc> <@a​damgreig:m​atrix.org> on line 77 maybe replace `0x00001000` with `1<<13`?
<re_irc> <@a​damgreig:m​atrix.org> (I guess that's what you meant it to be anyway)
<re_irc> <@a​damgreig:m​atrix.org> debugging by single-stepping is often tricky, especially if you are building in release mode (`--release`) as optimisations can make it very confusing, you could try without release mode and see if that helps
<re_irc> <@a​damgreig:m​atrix.org> (also, maybe you need to enable or configure some clocks for this chip? I don't know about it)
<re_irc> <@m​rbraindump:m​atrix.org> Thank you very much for the hints, I will try them out!
<re_irc> <@m​rbraindump:m​atrix.org> adamgreig: yes i can see the semihosting-prints, that works fine.
<re_irc> <@m​rbraindump:m​atrix.org> adamgreig: ah i can only see them in the openOCD terminal, not in the gdb session.
<re_irc> <@a​damgreig:m​atrix.org> oh, sorry, that's fine too
<re_irc> <@a​damgreig:m​atrix.org> just checking they were showing up at all
<re_irc> <@a​damgreig:m​atrix.org> it could be that it looks like it's stepping over each write because they are optimised into a single memory write, there's no function call left in the final executable, but the write should still take place
<re_irc> <@a​damgreig:m​atrix.org> you could check in gdb by reading the register value yourself afterwards, e.g. `p *(0x40020000 as *const u32)` or similar (replacing that address with the actual full address of the register)
<re_irc> <@m​rbraindump:m​atrix.org> adamgreig: I had a breakpoint at the entry and the messages show up till the first call of a mkl25z4 call in line 38, fter that they stop, could that be optimization too?
<re_irc> <@a​damgreig:m​atrix.org> so you never see "PCR A13 value" from L39 get printed?
<re_irc> <@a​damgreig:m​atrix.org> but you do get "WTF" from L36?
<re_irc> <@m​rbraindump:m​atrix.org> I get the "WTF" from L36, but not "PCR A13 value" from L39
<re_irc> <@a​damgreig:m​atrix.org> that's odd. if you interrupt in gdb (ctrl-c), what's executing? e.g. `backtrace` or `where` in gdb
<re_irc> <@a​damgreig:m​atrix.org> maybe it's gone into a panic handler
<re_irc> <@m​rbraindump:m​atrix.org> It seems to just ignore it. But maybe the error is somewhere else:
<re_irc> <@m​rbraindump:m​atrix.org> I tried to read the PCR-Register I tried to set and it just says `Info : SWD DPIDR 0x0bc11477
<re_irc> <@m​rbraindump:m​atrix.org> Error: Failed to read memory at 0x40049034` So I can't even read the value from there
<re_irc> <@a​damgreig:m​atrix.org> try `set mem inaccessible-by-default off` in gdb too, but sounds like something else could be wrong too
<re_irc> <@a​damgreig:m​atrix.org> there might well be some configuration you need to set first, like enabling clocks or disabling a watchdog or whatever, that will be in the chip's user manual/datasheet
<re_irc> <@a​damgreig:m​atrix.org> if GDB can't read that memory address and gets an error, it's quite possible the chip also cannot read it and is faulting when it tries
<re_irc> <@a​damgreig:m​atrix.org> it might be worth checking out https://github.com/mgottschlag/mkl25z4-hal and https://github.com/mgottschlag/mkl25z4-hal-examples
<re_irc> <@a​damgreig:m​atrix.org> for example, in their blink example here: https://github.com/mgottschlag/mkl25z4-hal-examples/blob/master/src/bin/blink.rs#L52-L53
<re_irc> <@a​damgreig:m​atrix.org> you see they disable the watchdog and configure clocks before trying to use the GPIO
crabbedhaloablut has quit [Remote host closed the connection]
crabbedhaloablut has joined #rust-embedded
<re_irc> <@m​rbraindump:m​atrix.org> Thank you very much! That helps a lot! I will check that out. Thank you for your time
fabic has quit [Ping timeout: 252 seconds]
fabic has joined #rust-embedded
troth has joined #rust-embedded
tokomak has quit [Ping timeout: 250 seconds]
fabic has quit [Ping timeout: 240 seconds]
fabic has joined #rust-embedded
fabic has quit [Ping timeout: 250 seconds]
Rahix has quit [Quit: ZNC - https://znc.in]
Rahix has joined #rust-embedded
GenTooMan has quit [Ping timeout: 240 seconds]
GenTooMan has joined #rust-embedded
ni has quit [Remote host closed the connection]
GenTooMan has quit [Ping timeout: 250 seconds]
GenTooMan has joined #rust-embedded
ni has joined #rust-embedded
<re_irc> <@t​hejpster:m​atrix.org> I've been giving Rust training all day today. So nice to get properly stuck in!
<re_irc> <@a​damgreig:m​atrix.org> to one of my friends it turns out :)
<re_irc> <@a​damgreig:m​atrix.org> (he only had good things to say!)
<re_irc> <@d​khayes117:m​atrix.org> thejpster: Was it embedded focused training?