-
Notifications
You must be signed in to change notification settings - Fork 327
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
openocd does not allow to query status of dcsr.ebreak{u,s,m} #918
openocd does not allow to query status of dcsr.ebreak{u,s,m} #918
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) As for the riscv_ebreak_* OpenOCD's internal configuration flags:
I agree that there should be a way how the user can view the current settings (a "getter"). This applies to not only to commands riscv set_ebreak*
, but in general to all configuration commands.
I am not in favor of putting it into riscv info
. The output of riscv info
would become a mixture of the detected hardware capabilities and current OpenOCD's settings, which are two different sets of information.
The getters had already been discussed a little here:
- riscv: implement maskisr steponly command #681 (comment)
- riscv: implement maskisr steponly command #681 (comment)
@timsifive Since this topic has re-occurred, I recommend to discuss and agree on how the config getters should look like. I don't have strong preferences, but would like it to be:
- consistent (at least in the RISC-V target)
- intuitive and easy for the user, if possible
- done in such a way that it passes upstream review
(2) As for adding dcsr.ebreak*
values to riscv info
:
I recommend to not add any information that can be read equally easy by the existing commands (reg
, get_reg
) and possibly some bit-masking.
Furthermore, items of riscv info
would ideally be documented so that the user knows what they mean. That's another reason why to not add more items (unless the benefits of having them there are large enough).
244d45e
to
caa9250
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks all right to me overall - thanks. I have only few smaller suggestions.
Note that I am out of office until Oct 9 so I won't be able make another review of this change. But since it is almost complete, that should not be an issue. I'll leave the last quick check + merge to @timsifive.
src/target/riscv/riscv.c
Outdated
RISCV_INFO(r); | ||
|
||
if (CMD_ARGC == 0) { | ||
command_print(CMD, "riscv_ebreakm enabled = %d", r->riscv_ebreakm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally - if you like:
command_print(CMD, "riscv_ebreakm enabled = %d", r->riscv_ebreakm); | |
command_print(CMD, "riscv_ebreakm enabled = %s", r->riscv_ebreakm ? "yes" : "no"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, that now it much easier to parse output of this command than with your suggestion, so I would like to leave it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow existing OpenOCD commands. E.g. handle_poll_command() prints out a boolean value, and it uses:
command_print(CMD, "background polling: %s", jtag_poll_get_enabled() ? "on" : "off");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
src/target/riscv/riscv.c
Outdated
@@ -4196,6 +4214,7 @@ COMMAND_HANDLER(handle_info) | |||
riscv_enumerate_triggers(target) == ERROR_OK; | |||
riscv_print_info_line_if_available(CMD, "hart", "trigger_count", | |||
r->trigger_count, trigger_count_available); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whitespace change (blank line) can now be reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed. Addressed.
src/target/riscv/riscv.c
Outdated
if (CMD_ARGC == 0) { | ||
command_print(CMD, "riscv_ebreakm enabled = %d", r->riscv_ebreakm); | ||
return ERROR_OK; | ||
} else if (CMD_ARGC != 1) { | ||
LOG_ERROR("Command takes 0 or 1 parameters"); | ||
return ERROR_COMMAND_SYNTAX_ERROR; | ||
} | ||
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], riscv_ebreakm); | ||
|
||
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], r->riscv_ebreakm); | ||
return ERROR_OK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability, I recommend this structure. Applies to all the three commands.
if (CMD_ARGC == 0) {
command_print(CMD, "riscv_ebreakm enabled = %d", r->riscv_ebreakm);
return ERROR_OK;
} else if (CMD_ARGC == 1) {
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], r->riscv_ebreakm);
return ERROR_OK;
} else {
LOG_ERROR("Command takes 0 or 1 parameters");
return ERROR_COMMAND_SYNTAX_ERROR;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
caa9250
to
7c60e0a
Compare
src/target/riscv/riscv.c
Outdated
RISCV_INFO(r); | ||
|
||
if (CMD_ARGC == 0) { | ||
command_print(CMD, "riscv_ebreakm enabled = %d", r->riscv_ebreakm); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow existing OpenOCD commands. E.g. handle_poll_command() prints out a boolean value, and it uses:
command_print(CMD, "background polling: %s", jtag_poll_get_enabled() ? "on" : "off");
Extend riscv set_ebreak* commands. Now it can be called without args to print current value. riscv_ebreak* flags are moved to riscv_info struct. Change-Id: Ib46e6b6dfc0117599c7f6715c7aaf113e63bd7dc Signed-off-by: Kirill Radkin <[email protected]>
7c60e0a
to
ee2bc80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for this improvement.
Extend riscv set_ebreak* commands.
Now it can be called without args to print current value.
riscv_ebreak* flags are moved to riscv_info struct.