Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upstream port] Adding register types and registers #37

Open
EvgeniiDidin opened this issue Jun 4, 2019 · 7 comments
Open

[Upstream port] Adding register types and registers #37

EvgeniiDidin opened this issue Jun 4, 2019 · 7 comments

Comments

@EvgeniiDidin
Copy link
Member

In case of ARC we have arch-specific registers like "STATUS32", "DEBUG", etc. We use one routine to add default GDB and ARC-specific register types.

In cpu/arc related .tcl script we describe register-types and registers, which are available on target. This requires jimctl command handlers.

@EvgeniiDidin EvgeniiDidin mentioned this issue Jun 4, 2019
5 tasks
@anthony-kolesov
Copy link
Contributor

Note that today some registers which are essential for the debugging have hardcoded definitions. For example here https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/src/target/arc_ocd.c#L195 code uses hardcoded information for STATUS32. Or here https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/src/target/arc32.c#L530 code has hardcoded info on caches.

At the same time there is a more flexible code, like here: https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/src/target/arc32.c#L763, it refers to registers and their field by name, and I consider this code superior, because it doesn't duplicate information on which bit or register name has what meaning - connection through names is better. Although it is still not perfect, for example, in theory parameters of caches can be read and fully configured in TCL scripts as well, I think - that would be even better.

My opinion is that it would be better to replaces instances of code that use hardcoded register definitions with approach that relies on register/field names - it is something that I wanted to do after implementing registers in TCL, but never had the time to do. Though it is possible there could be some functions which are executed very early, before register definitions are read from TCL, so those functions would have to use hardcoded info, but that should use IDENTITY, DEBUG and STATUS32 at most, if at all. However, there is a concern that getting register by name is done by scanning linked list, so log(N), so in some cases you may need to either cache pointer to register object, or keep using the hardcoded definitions.

Also the more of this stuff you'd move to TCL, the more flexible it will be. For example, function https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/blob/master/src/target/arc32.c#L751, that sets up CCM parameters - arc32_common fields can be exposed as TCL properties, then those checks, based on register field values can be done in TCL and then they would set arc32_common fields. Perhaps, this should be done only after the initial upstreaming, though.

@EvgeniiDidin
Copy link
Member Author

Commits, related to adding reg_types:
8f734b0
e12b557

@EvgeniiDidin
Copy link
Member Author

EvgeniiDidin commented Jun 10, 2019

Commit, related to adding registers from tcl:
ace638d

@EvgeniiDidin
Copy link
Member Author

Commit, adding building register caches function:
55d9df4

@EvgeniiDidin
Copy link
Member Author

EvgeniiDidin commented Jun 13, 2019

TODO after JTAG functionality introduction:

  1. Introduce arc_regs_get(set)_core_reg functions
  2. introduce get_register_value and register_get_by_name functions

@EvgeniiDidin EvgeniiDidin changed the title Adding register types and registers [Upstream port] Adding register types and registers Jun 13, 2019
@EvgeniiDidin
Copy link
Member Author

Commit, introducing arc_regs_get(set)_core_reg functions:
2c1c26e
Commit, introducing arc_register_get_by_name:
e6f7cf6

@EvgeniiDidin
Copy link
Member Author

Commits, introducing arc_get_register_field function:
0734496 c13bf9c
Commit, introducing arc_get/set_register_value functions:
3ad1583

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

No branches or pull requests

2 participants