Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions humility-core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ impl Core for OpenOCDCore {
}

fn read_word_32(&mut self, addr: u32) -> Result<u32> {
let result = self.sendcmd(&format!("mrw 0x{:x}", addr))?;
Ok(result.parse::<u32>()?)
let result = self.sendcmd(&format!("read_memory 0x{:x} 32 1", addr))?;
Ok(parse_int::parse::<u32>(&result)?)
}

fn read_8(&mut self, addr: u32, data: &mut [u8]) -> Result<()> {
Expand Down Expand Up @@ -671,10 +671,12 @@ impl Core for OpenOCDCore {
// in strict alphabetical order by index (!!). (That is, index 100
// comes before, say, index 11.)
//
// In some cases the output may have index as decimal, but value
// as 0x-prefixed hexadecimal.
for val in result.split(' ') {
match index {
None => {
let idx = val.parse::<usize>()?;
let idx = parse_int::parse::<usize>(val)?;

if idx >= data.len() {
bail!("\"{}\": illegal index {}", cmd, idx);
Expand All @@ -689,7 +691,7 @@ impl Core for OpenOCDCore {
}

Some(idx) => {
data[idx] = val.parse::<u8>()?;
data[idx] = parse_int::parse::<u8>(val)?;
index = None;
}
}
Expand Down