zjason` has quit [Remote host closed the connection]
zjason` has joined #openocd
joconor has quit [Ping timeout: 265 seconds]
joconor has joined #openocd
Hawk777 has joined #openocd
joconor has quit [Read error: Connection reset by peer]
joconor has joined #openocd
Hawk777 has quit [Quit: Leaving.]
MGF_Fabio has joined #openocd
Haohmaru has joined #openocd
merethan has joined #openocd
<gamiee>
Hello. I am working on Flash bank driver for RISC-V chip. To avoid having another assembly code in OpenOCD, I want to re-use BootROM functions for initializing everything necessary for flashing. Sadly, some of the functions uses global variables (stored in RAM), so I will backup the area, write data it needs, and after procedure it will restore it. Is this good? Or I rather should use another approach?
<Haohmaru>
is this the "helper firmware" openocd puts onto the target to make flashing faster?
<gamiee>
Haohmaru: actually I want to avoid "helper firmware" at all, and instead, call BootROM functions (through simple trampoline).
<Haohmaru>
no clue then, i'm unfamiliar with risc-v
<Haohmaru>
stick around till the others wake up
<gamiee>
Haohmaru: I got trampoline working, I am just wondering if this is okay to do, mainly the part, where I backup some RAM areas whose BROM func uses for some information.
<Haohmaru>
*shrug*
<gamiee>
Also, the trampoline is simple and uses existing stuff in OpenOCD. Right now, I am just constructing two instructions, one which jumps to func, and second bkpt (ebreak on RISC-V), writing it to the work-area, and execute it through "run_algorithm" API. Although, I probably will rework this to use PROGBUF, what is small buffer within RISC-V Debug Module, where debug probe can put small instructions to execute, so I don't even need work-area.
cyrozap_ has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
<gamiee>
(+ everything executed from progmem is in highest elevation, what is nice)
<Haohmaru>
as i have no clue about most of those details, in overall it sounds okay ;P~
cyrozap has joined #openocd
<karlp>
gamiee: most of the flashing algorithms rely on having a defined work area of ram, and we never try and save or back it up,
<karlp>
so I'd say just let the flashing algorithm use globabls if i tneeds them...
<gamiee>
karlp: Hi! So I can treat that when the flashing by openocd happens, it can "modify" anything, as there is expectation that the chip will be reset after flashing is done?
<karlp>
that's always been my understandinga s a user, and it certainly seems inline with existing behaviour as far as I can tell.
<karlp>
at least as far as within the "work area" defined.
<Haohmaru>
if the typical scenario is to (erase the chip? and) flash a new firmware and then run it - the RAM shouldn't make much difference
<karlp>
fwiw, we're going to end up with riscv compiled sources sooner or later anyway, not all rv targets will have bootrom available.
<karlp>
(you can noramlly write the flash helpers in C instead of assembly anyway....)
<Haohmaru>
there may be rare cases where the RAM is used in exotic ways, for example my bootloader uses a small chunk in the beginning of RAM to store a special structure with which it "communicates" with the firmware
<Haohmaru>
thus i don't clear this chunk of ram on reset
<Haohmaru>
but this is "exotic"
<Haohmaru>
and if i'm gonna be poking with debugger, then i'll probably be putting a new bootloader anyway
<gamiee>
when I can use BootROM functions just fine. (and in case of needing to do tiny reg manipulations, I will do that from driver through JTAG).
<gamiee>
karlp , Haohmaru : why I am thinking about this is that in future, there might be things like eFuse manipulation or other features, which might not need reset after them being done, but yeah, generally, reset is expected after flash, so I guess it should be fine and I don't need to do any backups. And yeah, I know I can write loaders in C, but I wanted to generally avoid to write any helpers/loaders to not add into OpenOCD another platform-related code,
<Haohmaru>
no idea about that, but i guess if you want to not disturb the RAM, you could maybe first read the chunk of RAM via openocd, store it in a buffer on openocd's side (aka on the Computer), do your thing, and at the end write it back to the target?
<gamiee>
Haohmaru: that's exactly what I was thinking of doing, backing up the area I will use and might disturb another code. But from this conversation, I think it's not needed, as we expect reset, and if any feature which doesn't need reset will be added, backing up can be added as well.
<Haohmaru>
well, alternatively, someone should point out a usecase/scenario or a situation where you might legitimately need to "write a pile of flash via openocd" without resetting the target
<Haohmaru>
i'm not too familiar with the whole thing so i don't know
<gamiee>
there is scenario when user wants to only read the flash. In that case, we don't need to reset after.
<Haohmaru>
i suspected something like that
<Haohmaru>
oh, actually, now i remember, when i debugged an xmega, and it failed to load the debug symbols (or i failed to supply it properly) the program (the IDE maybe) basically read the whole binary from the target so it can at least show me the "ASM" at the current position and stuff like that
<Haohmaru>
backing up the RAM temporarily into openocd's memory and then restoring it shouldn't be too difficult if the amount of RAM needed is known
<gamiee>
Haohmaru: It's just few bytes which needs to be backed up from RAM. (work-area is in TCM, which is automatically backed up by openocd) So I guess it should be fine.
cyrozap has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
<karlp>
Haohmaru: it's definitely not required to do a reset after flashing, just common.
<karlp>
sometim es you're flashing a different section...
<Haohmaru>
that too
cyrozap has joined #openocd
cyrozap has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
cyrozap has joined #openocd
cyrozap has quit [Client Quit]
cyrozap has joined #openocd
cyrozap has quit [Quit: ZNC 1.8.2+deb3.1+deb12u1 - https://znc.in]
cyrozap has joined #openocd
nerozero has quit [Remote host closed the connection]