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

Prefix all package names with defmt- #154

Merged
merged 1 commit into from
Sep 7, 2020
Merged
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: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version = "0.1.0"

[dependencies]
defmt-macros = { path = "macros" }
common = { path = "common" }
defmt-common = { path = "common" }

[workspace]
members = [
Expand Down
4 changes: 2 additions & 2 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
authors = ["The Knurling-rs developers"]
edition = "2018"
license = "MIT OR Apache-2.0"
name = "common"
version = "0.1.0"
name = "defmt-common"
version = "0.1.0"
4 changes: 2 additions & 2 deletions decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
authors = ["The Knurling-rs developers"]
edition = "2018"
license = "MIT OR Apache-2.0"
name = "decoder"
name = "defmt-decoder"
version = "0.1.0"

[dependencies]
defmt-parser = { path = "../parser" }
defmt-common = { path = "../common" }
byteorder = "1"
colored = "2.0.0"
common = { path = "../common" }
leb128 = "0.2.4"
ryu = "1"
4 changes: 2 additions & 2 deletions decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::{
use byteorder::{ReadBytesExt, LE};
use colored::Colorize;

use common::Level;
use defmt_common::Level;
use defmt_parser::{Fragment, Type};

include!(concat!(env!("OUT_DIR"), "/version.rs"));
Expand Down Expand Up @@ -682,7 +682,7 @@ fn zigzag_decode(unsigned: u64) -> i64 {
mod tests {
use std::collections::BTreeMap;

use common::Level;
use defmt_common::Level;

use super::{Frame, Table};
use crate::Arg;
Expand Down
4 changes: 2 additions & 2 deletions elf2table/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
authors = ["The Knurling-rs developers"]
edition = "2018"
license = "MIT OR Apache-2.0"
name = "elf2table"
name = "defmt-elf2table"
version = "0.1.0"

[dependencies]
anyhow = "1.0.32"
decoder = { path = "../decoder" }
defmt-decoder = { path = "../decoder" }
gimli = "0.22.0"

[dependencies.object]
Expand Down
2 changes: 1 addition & 1 deletion elf2table/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
};

use anyhow::{anyhow, bail, ensure};
pub use decoder::Table;
pub use defmt_decoder::Table;
use object::{Object, ObjectSection};

/// Parses an ELF file and returns the decoded `defmt` table
Expand Down
4 changes: 2 additions & 2 deletions qemu-run/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ version = "0.1.0"

[dependencies]
anyhow = "1.0.32"
decoder = { path = "../decoder" }
elf2table = { path = "../elf2table" }
defmt-decoder = { path = "../decoder" }
defmt-elf2table = { path = "../elf2table" }
7 changes: 4 additions & 3 deletions qemu-run/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
};

use anyhow::{anyhow, bail};
use decoder::Table;
use defmt_decoder::Table;
use process::Child;

fn main() -> Result<(), anyhow::Error> {
Expand All @@ -25,7 +25,8 @@ fn notmain() -> Result<Option<i32>, anyhow::Error> {

let path = &args[0];
let bytes = fs::read(path)?;
let table = elf2table::parse(&bytes)?.ok_or_else(|| anyhow!("`.defmt` section not found"))?;
let table =
defmt_elf2table::parse(&bytes)?.ok_or_else(|| anyhow!("`.defmt` section not found"))?;

let mut child = KillOnDrop(
Command::new("qemu-system-arm")
Expand Down Expand Up @@ -84,7 +85,7 @@ fn notmain() -> Result<Option<i32>, anyhow::Error> {
}

fn decode(frames: &mut Vec<u8>, table: &Table) {
while let Ok((frame, consumed)) = decoder::decode(&frames, &table) {
while let Ok((frame, consumed)) = defmt_decoder::decode(&frames, &table) {
println!("{}", frame.display(true));
let n = frames.len();
frames.rotate_left(consumed);
Expand Down
5 changes: 2 additions & 3 deletions src/export.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Formatter, Str};

pub use defmt_common::Level;
pub use defmt_macros::write;
pub use common::Level;

#[cfg(target_arch = "x86_64")]
thread_local! {
Expand Down Expand Up @@ -124,7 +124,6 @@ mod sealed {
}
}


impl Truncate<u16> for u64 {
fn truncate(self) -> u16 {
self as u16
Expand Down Expand Up @@ -154,4 +153,4 @@ mod sealed {

pub fn truncate<T>(x: impl sealed::Truncate<T>) -> T {
x.truncate()
}
}