Hello,
I'm working on a debug unit for a custom RISC-V CPU and would like to get it working with the SEGGER J-Link debug probe and tools. Currently, the debug unit works fine with OpenOCD + GDB. Also with JLinkExe, I can successfully connect, downloading files, halt the CPU, and step through code. Setting breakpoints and more complicated operations don't work or are buggy and it appears that the reason might be the fact that the data cache is not flushed and that the instruction cache is not invalidated after memory writes. I know that there is no standardized way of doing this, e.g., OpenOCD uses a combination of fence and fence.i instructions.
I'm just curious how the SEGGER debugger is handling caches in general and how I could add the flush/invalidation myself. This must be quite a common problem for other RISC-V CPUs as well, so maybe there is an elegant way to handle this.
Thank you!
I'm working on a debug unit for a custom RISC-V CPU and would like to get it working with the SEGGER J-Link debug probe and tools. Currently, the debug unit works fine with OpenOCD + GDB. Also with JLinkExe, I can successfully connect, downloading files, halt the CPU, and step through code. Setting breakpoints and more complicated operations don't work or are buggy and it appears that the reason might be the fact that the data cache is not flushed and that the instruction cache is not invalidated after memory writes. I know that there is no standardized way of doing this, e.g., OpenOCD uses a combination of fence and fence.i instructions.
I'm just curious how the SEGGER debugger is handling caches in general and how I could add the flush/invalidation myself. This must be quite a common problem for other RISC-V CPUs as well, so maybe there is an elegant way to handle this.
Thank you!