This repository was archived by the owner on Feb 21, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Enhance bmputil-cli target power
#57
Open
P-Storm
wants to merge
5
commits into
blackmagic-debug:main
Choose a base branch
from
P-Storm:feat/target-power
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f1246fc
remote: Add get_target_voltage and use this in power argument
P-Storm 65be5f7
remote: Added commands REMOTE_SRST_GET and REMOTE_PWR_GET
P-Storm 9fcb31b
remote: Moved RemoteCommands into a struct and renamed SRST to NRST
P-Storm 40f82b4
remote: RemoteCommands cleanup & Code review
P-Storm 28efff9
remote: removed the explicit lifetime
P-Storm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,25 +25,49 @@ mod protocol_v3; | |
| mod protocol_v4; | ||
| pub mod riscv_debug; | ||
|
|
||
| /// This is the max possible size of a remote protocol packet which a hard limitation of the | ||
| /// firmware on the probe - 1KiB is all the buffer that could be spared. | ||
| pub const REMOTE_MAX_MSG_SIZE: usize = 1024; | ||
| pub struct RemoteCommands; | ||
|
|
||
| /// Start of message marker for the protocol | ||
| pub const REMOTE_SOM: u8 = b'!'; | ||
| /// End of message marker for the protocol | ||
| pub const REMOTE_EOM: u8 = b'#'; | ||
| /// Response marker for the protocol | ||
| pub const REMOTE_RESP: u8 = b'&'; | ||
| impl RemoteCommands | ||
| { | ||
| /// This command asks the probe if the reset pin is on | ||
| pub const GET_NRST: &str = "!Gz#"; | ||
| /// This command asks the probe if power is being supplied to the target | ||
| pub const GET_TARGET_POWER_STATE: &str = "!Gp#"; | ||
| /// This command asks the probe what it's protocol version is | ||
| pub const HL_CHECK: &str = "!HC#"; | ||
| /// This command asks the probe to initialise JTAG comms to any connected targets | ||
| pub const JTAG_INIT: &str = "!JS#"; | ||
| pub const NRST_TARGET_VOLTAGE: &str = "!GV#"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unsure what happened here, but this one isn't documented now and the constant is misnamed for what it does - this retrieves the target voltage. |
||
| /// This command asks the probe to the reset pin state | ||
| pub const SET_NRST: &str = "!GZ#"; | ||
| /// This command asks the probe to set the power state to the target | ||
| pub const SET_TARGET_POWER_STATE: &str = "!GP#"; | ||
| /// This command asks to start remote protocol communications with the probe | ||
| pub const START: &str = "+#!GA#"; | ||
| } | ||
|
|
||
| pub struct RemoteResponse; | ||
|
|
||
| /// Probe response was okay and the data returned is valid | ||
| pub const REMOTE_RESP_OK: u8 = b'K'; | ||
| /// Probe found an error with a request parameter | ||
| pub const REMOTE_RESP_PARERR: u8 = b'P'; | ||
| /// Probe encountered an error executing the request | ||
| pub const REMOTE_RESP_ERR: u8 = b'E'; | ||
| /// Probe does not support the request made | ||
| pub const REMOTE_RESP_NOTSUP: u8 = b'N'; | ||
| impl RemoteResponse | ||
| { | ||
| /// End of message marker for the protocol | ||
| pub const EOM: u8 = b'#'; | ||
| /// This is the max possible size of a remote protocol packet which a hard limitation of the | ||
| /// firmware on the probe - 1KiB is all the buffer that could be spared. | ||
| pub const MAX_MSG_SIZE: usize = 1024; | ||
|
Comment on lines
+55
to
+57
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NB: this constant is not specific to the response - it sets the request max length too. |
||
| /// Response marker for the protocol | ||
| pub const RESP: u8 = b'&'; | ||
| /// Probe encountered an error executing the request | ||
| pub const RESP_ERR: u8 = b'E'; | ||
| /// Probe does not support the request made | ||
| pub const RESP_NOTSUP: u8 = b'N'; | ||
| /// Probe response was okay and the data returned is valid | ||
| pub const RESP_OK: u8 = b'K'; | ||
| /// Probe found an error with a request parameter | ||
| pub const RESP_PARERR: u8 = b'P'; | ||
| /// Start of message marker for the protocol | ||
| pub const SOM: u8 = b'!'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is part of the request not response - same for EOM above. It's the RESP marker that indicates the start of a response. |
||
| } | ||
|
|
||
| pub type TargetAddr32 = u32; | ||
| pub type TargetAddr64 = u64; | ||
|
|
@@ -112,6 +136,8 @@ pub trait BmdRemoteProtocol | |
| fn supported_architectures(&self) -> Result<Option<TargetArchitecture>>; | ||
| fn supported_families(&self) -> Result<Option<TargetFamily>>; | ||
| fn get_target_power_state(&self) -> Result<bool>; | ||
| fn get_nrst_voltage(&self) -> Result<f32>; | ||
| fn get_nrst_val(&self) -> Result<bool>; | ||
| } | ||
|
|
||
| /// Types implementing this trait provide raw SWD access to targets over the BMD remote protocol | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.