key2 has quit [Read error: Connection reset by peer]
borneoa_ has quit [Read error: Connection reset by peer]
devanagram has quit [Read error: Connection reset by peer]
NishanthMenon has quit [Write error: Connection reset by peer]
nohit has quit [Ping timeout: 268 seconds]
abg has quit [Ping timeout: 250 seconds]
key2 has joined #openocd
borneoa_ has joined #openocd
devanagram has joined #openocd
dreamcat4 has joined #openocd
borneoa_ has quit [Ping timeout: 268 seconds]
devanagram has quit [Ping timeout: 264 seconds]
dreamcat4 has quit [Ping timeout: 256 seconds]
key2 has quit [Ping timeout: 264 seconds]
devanagram has joined #openocd
key2 has joined #openocd
borneoa_ has joined #openocd
nohit has joined #openocd
dreamcat4 has joined #openocd
Steffanx- has joined #openocd
mithro has joined #openocd
abg has joined #openocd
NishanthMenon has joined #openocd
tsal has quit [Ping timeout: 240 seconds]
tsal has joined #openocd
Hawk777 has joined #openocd
cluelessperson has quit [Ping timeout: 256 seconds]
cluelessperson has joined #openocd
nerozero has joined #openocd
key2 has quit [Ping timeout: 256 seconds]
devanagram has quit [Ping timeout: 256 seconds]
key2 has joined #openocd
devanagram has joined #openocd
Haohmaru has joined #openocd
tomtastic has quit [Ping timeout: 240 seconds]
tomtastic has joined #openocd
Haohmaru has quit []
Hawk777 has quit [Quit: Leaving.]
Haohmaru has joined #openocd
xantoz has joined #openocd
devanagram has quit [Read error: Connection reset by peer]
key2 has quit [Read error: No route to host]
dreamcat4 has quit [Ping timeout: 264 seconds]
mithro has quit [Ping timeout: 268 seconds]
NishanthMenon has quit [Ping timeout: 260 seconds]
Steffanx- has quit [Ping timeout: 256 seconds]
abg has quit [Ping timeout: 260 seconds]
Steffanx- has joined #openocd
nohit_ has joined #openocd
key2 has joined #openocd
devanagram has joined #openocd
nohit has quit [Ping timeout: 268 seconds]
borneoa_ has quit [Ping timeout: 268 seconds]
nohit_ is now known as nohit
dreamcat4 has joined #openocd
mithro has joined #openocd
NishanthMenon has joined #openocd
abg has joined #openocd
borneoa_ has joined #openocd
JakeSays has quit [Ping timeout: 260 seconds]
JakeSays has joined #openocd
key2 has quit [Ping timeout: 256 seconds]
nohit has quit [Ping timeout: 260 seconds]
devanagram has quit [Ping timeout: 250 seconds]
borneoa_ has quit [Ping timeout: 240 seconds]
dreamcat4 has quit [Ping timeout: 250 seconds]
Steffanx- has quit [Ping timeout: 264 seconds]
NishanthMenon has quit [Ping timeout: 240 seconds]
abg has quit [Ping timeout: 250 seconds]
mithro has quit [Ping timeout: 264 seconds]
mithro has joined #openocd
Steffanx- has joined #openocd
NishanthMenon has joined #openocd
abg has joined #openocd
borneoa_ has joined #openocd
dreamcat4 has joined #openocd
key2 has joined #openocd
nohit has joined #openocd
devanagram has joined #openocd
emeb has joined #openocd
Hawk777 has joined #openocd
Haohmaru has quit []
capin has joined #openocd
capin is now known as ipatch
BorgCuba has joined #openocd
<BorgCuba>
Hi ppl, how can I teach openocd to erase/write/read flash for my device?
<BorgCuba>
I know the procedure and registers from the datasheet
<Hawk777>
If it’s a chip type that is supported, you would need to just write a config file for the board. If it’s not, you would need to write C code. If it’s very similar to a device that is already supported, you might be able to add it to an existing flash driver; otherwise, you would need to write a fresh Flash driver. Assuming it’s something like an ordinary on-board microcontroller Flash, look in src/flash/nor for examples.
<PaulFertser>
BorgCuba: where's device id register at according to the vendor doc?
<BorgCuba>
should be the same address: 0x40015800
<BorgCuba>
Ahh, F0
<PaulFertser>
BorgCuba: it's M0 too so 0x40015800 should be used in your case. You can run openocd with -d2 and you'll see what addresses really get accessed when.
nerozero has quit [Ping timeout: 250 seconds]
<karlp>
is it actually m0 and not m0+?
<karlp>
ah no, that particular stm32 line is from unkonwn devid.
<BorgCuba>
PaulFertser, mdw 0x40015800 gives 0
<karlp>
you're options for permanent are to figure out a way of identifying it, but I can't se anything obvious in that chinese datasheet
<karlp>
or, as a hack, just change the default case to fill in the params you want for your part, instead of rejecting as unknown...
<PaulFertser>
BorgCuba: probably the datasheet isn't too accurate then.
<karlp>
there's also a line on determining flash size, which may not be implemented on that target either.
<karlp>
the stm32f1 impl doesn't really have any hooks for "just pretend it's an f1 with these params..." the way pyocd does.
<BorgCuba>
PaulFertser, section 5.23.1 says that the address of DBGMCU_IDCODE is 0x40015800 and the value should read 0x20000440
<karlp>
which document have you guys got?
<PaulFertser>
BorgCuba: looks like they really tried to mimic stm32f05x then :)
<karlp>
you said it's not reading 0x440 though anyway?
<karlp>
the datasheet on nerdralph doesn't have any section 5 beyond "TBD"
<karlp>
and you say that's reading zero though? at 0x40015800?
<BorgCuba>
yes, but maybe mdw does not work for that address?
<BorgCuba>
how would you read the idcode?
<BorgCuba>
Btw, could you open that URL?
<karlp>
yeah, that doc looks way better.
<PaulFertser>
BorgCuba: mdw it is
<karlp>
I was just trying to see if it needs anything insyscfg turned on to access ram or anything weird.
<karlp>
but nothing obvious.
<karlp>
it seems to try _really_ hard to mimic the f050, with the right part id and all, unlike the APM32 someone was trying here the other day.
<karlp>
even has the flash size register documented.
<karlp>
run it again with -d3 and see all the addresses it access, and what really returns, but it definitelys appears to be not following the datasheet....
<karlp>
(are you sure it's that hk32 and not another type of clone?)
<bencoh>
so now they clone chips, not just boards? funny
<BorgCuba>
btw, it is -D -b binary -m arm -Mforce-thumb for objdump
<PaulFertser>
BorgCuba: probably the first page was overwritten later by some other tests
<BorgCuba>
PaulFertser, could be
<BorgCuba>
still I did not manage to read the idcode
<PaulFertser>
BorgCuba: ignore it, try to treat it as if it's an stm32f0 device with 128 bytes page size
<BorgCuba>
PaulFertser, do stm32 targets initialize clocks at startup?
<BorgCuba>
there are RCC bits for the DBGMCU but enabling the DBMCU and resetting it does not yield an IDCODE != 0
<PaulFertser>
BorgCuba: not by default, but debug clock is generic and should be enabled by OpenOCD.
<BorgCuba>
yeah, and the flash is also readable
<BorgCuba>
so some clocks should be running
<BorgCuba>
PaulFertser, without idcode and flash-size this device would not fit in with stm32-flash drivers I fear or what do you think?
<PaulFertser>
BorgCuba: wouldn't fit upstream but you should first see if it works at all as a quick hack.
<BorgCuba>
PaulFertser, so you suggest I should remove the idcode check and hardcode flash size, build openocd and then try to flash the hk32 with the stm32 driver?
<BorgCuba>
general question: will risc-v bury arm?
<BorgCuba>
Btw, does openocd read erased flash as all 0 or 1?
<PaulFertser>
BorgCuba: different MCUs have different erase flash bits.
<BorgCuba>
I just entered the erase sequence manually. But after reading it back its mostly 0 but some bits are set, i.e. occasionally you can see a 1 2 4 8.
<BorgCuba>
Maybe its due to my very cheap setup: 2 pull up resistors(clk,io), 3 caps, µusb, ch551g (as cmsis-dap usb adapter) and hk32f030
<bencoh>
are you certain the erase really "worked" though?
<BorgCuba>
bencoh, how can I be sure?
<BorgCuba>
What I could verify is that the memory looks more 0ish now
<bencoh>
that's a good start I guess
<BorgCuba>
because I dumped 0x8000000 before and after the erase
<BorgCuba>
good night boys
BorgCuba has quit [Quit: Leaving]
crabbedhaloablut has quit [Remote host closed the connection]