Closed TimMThomas closed 6 months ago
-d3
parameter passed? This enables verbose logging. It will help us to identify the problem.-l
command line option to redirect logs to file.work-area-virt
for now.The resulting log file may be quite large. Please, zip/tar it.
Also if it is possible - would you kindly attach the binary of you application (presuming there is no IP-sensitive information there). This may help too (though, not strictly required).
- @TimMThomas could you please run OpenOCD with
-d3
parameter passed? This enables verbose logging. It will help us to identify the problem.
Sure, here you go, a run without the work-area-virt
:
openocd_log.zip
Also if it is possible - would you kindly attach the binary of you application (presuming there is no IP-sensitive information there). This may help too (though, not strictly required).
That is no problem, it is for the time being simply one of the sample applications provided by zephyr. zephyr_elf.zip
@TimMThomas that's a peculiarity of your application (zephyr).
It seems that at the startup zephyr configures memory regions and forbids writes to text section (or whatever memory region where the code resides). For example once code reaches 0x800003b2 the memory becomes non-writable.
When you ask gdb to set a breakpoint, it tries to set "software breakpoint" by attempting to re-write memory of application and injecting ebreak
instruction. Since memory is not writable - this operation fails.
You have several options here:
hbreak
command.@TimMThomas oh, and I've almost forgot! You have a third option, actually. You can enable "system bus" access for spike, by passing this argument: --dm-sba=32
(to spike). This way if accessing via abstract command/progbuf fails, OpenOCD will try to set breakpoints via sysbus access which seems to be excluded from pmp checks.
@aap-sc thanks for your help! Yes, i based my kconfig files on the qemu part of zephyr and i oversaw that pmp was enabled. The `--dm-sba=32' argument works flawlessly. Interestingly enough, hardware breakpoints do not work on my end when pmp is enabled.
Interestingly enough, hardware breakpoints do not work on my end when pmp is enabled.
A verbose openocd -d3
log might shed some light on why that is.
Hey everyone, I hope this is the right place for this, if not i will probably create soonish a WIP pull request for Zephyr. Im in the process of porting Zephyr to Spike. That was thankfully relatively easy, and im able to run sample applications with no problems. I am also able to connect with openocd (both this one, and the upstream one) and then use gdb.
Single stepping, changing local variables etc. with gdb works, but as soon as i try to add a breakpoint, openocd reports that it fails to write to memory (for both upstream and this one).
The example application from spike's readme works, so my guess is it is either a misconfiguration of openocd from my side or of spike. Has anyone an idea why this is happening?
Spike commandline (running the zephyr synchronization example):
openocd config file. I also tried to add a
$_TARGETNAME configure -work-area-virt 0x80000000
but the results are the same with it:openocd log, after just opening gdb, adding a breakpoint and continuing: