<c4017w_>
having some more weird issues with this chip. It has a boot mode selectable with one of the pins. When I start it in boot mode, OpenOCD can debug it fine. When I start it in run mode, I can connect and load firmware fine with GDB, but every time I 'si', it just keeps running and won't halt until I ctlr-c and 'monitor halt' at which point it prints a bunch of 'SWD DPIDR 0x5ba02477' before actually halting.
<c4017w_>
Also, when I target_start_algorithm() in run mode, I get some errors SWD DPIDR 0x5ba02477
<c4017w_>
Error setting register xPSR
<c4017w_>
SWD DPIDR 0x5ba02477
<c4017w_>
Error setting register pc
<c4017w_>
SWD DPIDR 0x5ba02477
<c4017w_>
It works fine in 'boot' mode
<PaulFertser>
c4017w_: huh, that's rather weird indeed
<PaulFertser>
c4017w_: probably in run mode it uses different frequency and your SWD is too high?
<c4017w_>
could be, I'll try turning it way down
<c4017w_>
It still connects though, and I can read memory or whatever
<c4017w_>
PaulFertser, holy crap you're right! Changed from 1 MHz to 100 kHz and now it works. Somethings still not right, because it should be running faster than that, but that's another issue
<PaulFertser>
c4017w_: to get it running faster you likely need to configure clock sources, PLLs etc.
<c4017w_>
I'm doing all that in the reset handler, and I guess the problem is that it was failing to set PC in run mode, so it never got to that code. Just verified that the initial clock is 48 times slower in run mode, so that explains it
<PaulFertser>
c4017w_: you can inspect PC with "reg" right after "reset halt".
<c4017w_>
Wondering what's the best way to handle this. The chip starts up with a 500 kHz clock, so I have to start OpenOCD with a pretty slow clock. My flash loader algorithm will reconfigure MCU clock to 8 MHz once it's running, but how can I increase the adapter speed from inside my flash driver? Is it even a good idea?
<PaulFertser>
c4017w_: not a good idea, no :)
<PaulFertser>
c4017w_: the usual way is to add a couple of "mdw" commands to the reset-init handler.
<PaulFertser>
c4017w_: as one is supposed to do flash operations only after "reset init" (and "program" helper does that automatically)
<PaulFertser>
c4017w_: see e.g. stm32l1x.cfg
<c4017w_>
PaulFertser, ah ok, that's reasonable
Steffann is now known as Steffanx
<c4017w_>
invalid command name mmw?
<PaulFertser>
c4017w_: yes, it's not a command, you need to source a Tcl script that provides it.
<c4017w_>
I'm using mmw inside the reset-init, same as stm32l1. So how/where would I call 'reset init'?
<PaulFertser>
c4017w_: but you need to source mem_helper.tcl