Skip to content
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.

How to do abstract memory access by using gdb? #180

Open
thomascp opened this issue Oct 9, 2019 · 3 comments
Open

How to do abstract memory access by using gdb? #180

thomascp opened this issue Oct 9, 2019 · 3 comments

Comments

@thomascp
Copy link

thomascp commented Oct 9, 2019

Hi,

In our board, there is a module mapped into CPU, but not mapped into the system bus.
So I can not access the registers of this module by using 'x address' in gdb.
Our hardware guy told me, 'General philosophy here is to use abstract memory commands to get to the internal core memories (DCCM/ICCM/internal module) using the debugger.'.
I read some parts of riscv debug spec, but get nothing about how to execute abstract memory commands in gdb.
Could anyone help me here? Thanks!

BR,
Peng

@timsifive
Copy link
Contributor

Generally speaking gdb doesn't have a concept of different kinds of memory accesses (although it can be aware of where flash is).
In theory you could send a command to the debug monitor to tell it what kind of memory accesses to use from now (or even fancier, for certain address ranges) but OpenOCD doesn't have support for that either. The closest we have is "riscv set_prefer_sba" but that doesn't do what you want. It would make sense to modify and rename that command so it lets you specify the order that memory accesses should be tried in (progbuf, sba, and abstract).

@thomascp
Copy link
Author

Hi @timsifive ,

I am an embedded software engineer, this is not what I am good at.
Talk about 'It would make sense to modify and rename that command so it lets you specify the order that memory accesses should be tried in (progbuf, sba, and abstract).'
Which piece of code is it in gdb? Thank you!

BR,
Peng

@timsifive
Copy link
Contributor

There is no code in gdb. This is all in OpenOCD: https://github.com/riscv/riscv-openocd/blob/9aac179cf28fe2af49efd6eeccc6cfcea9b2db3b/src/target/riscv/riscv.c#L1915

You can file an issue there, but I won't have time to get to this in quite a while. If you want to put together a pull request I'll be happy to review it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants