Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ jobs:
arch: linux-x64
- os: macos-latest
arch: macos-arm64
- os: macos-13
arch: macos-x64
runs-on: ${{ matrix.config.os }}

steps:
Expand Down
151 changes: 105 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ hex = "0.4.3"
ihex = "3.0.0"
log = "0.4"
nu-pretty-hex = "0.109"
rusb = "0.9.1"
nusb = "0.2"
simplelog = "0.12.0"
thiserror = "2"
object = { version = "0.38", default-features = false, features = [
Expand All @@ -32,7 +32,7 @@ object = { version = "0.38", default-features = false, features = [
"std",
] }
indicatif = "0.18"
serialport = "4.6"
serialport = "4.7"
libloading = "0.9"
chrono = "0.4"
clap-verbosity-flag = "3"
2 changes: 1 addition & 1 deletion src/commands/control.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Probe control commands. COMMAND_ID = 0x0d

use crate::{probe::WchLinkVariant, RiscvChip};
use crate::{RiscvChip, probe::WchLinkVariant};

use super::*;

Expand Down
6 changes: 4 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum Error {
#[error("{0}")]
Custom(String),
#[error("USB error: {0}")]
Rusb(#[from] rusb::Error),
Usb(nusb::Error),
#[error("WCH-Link not found, please check your connection")]
ProbeNotFound,
#[error("WCH-Link is connected, but is not in RV mode")]
Expand All @@ -21,7 +21,9 @@ pub enum Error {
UnknownLinkVariant(u8),
#[error("Unknown RISC-V Chip: 0x{0:02x}")]
UnknownChip(u8),
#[error("Probe is not attached to an MCU, or debug is not enabled. (hint: use wchisp to enable debug)")]
#[error(
"Probe is not attached to an MCU, or debug is not enabled. (hint: use wchisp to enable debug)"
)]
NotAttached,
#[error("Chip mismatch: expected {0:?}, got {1:?}")]
ChipMismatch(RiscvChip, RiscvChip),
Expand Down
14 changes: 7 additions & 7 deletions src/firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use std::str;

use anyhow::Result;
use object::{
elf::FileHeader32, elf::PT_LOAD, read::elf::FileHeader, read::elf::ProgramHeader, Endianness,
Object, ObjectSection,
Endianness, Object, ObjectSection, elf::FileHeader32, elf::PT_LOAD, read::elf::FileHeader,
read::elf::ProgramHeader,
};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -206,11 +206,11 @@ pub fn read_elf(elf_data: &[u8]) -> Result<Firmware> {
.map_err(|_| anyhow::format_err!("Failed to access data for an ELF segment."))?;
if !segment_data.is_empty() && segment.p_type(endian) == PT_LOAD {
log::debug!(
"Found loadable segment, physical address: {:#010x}, virtual address: {:#010x}, flags: {:#x}",
p_paddr,
p_vaddr,
flags
);
"Found loadable segment, physical address: {:#010x}, virtual address: {:#010x}, flags: {:#x}",
p_paddr,
p_vaddr,
flags
);
let (segment_offset, segment_filesize) = segment.file_range(endian);
let mut section_names = vec![];
for section in binary.sections() {
Expand Down
Loading