├── .gitignore ├── example-esp32c6 ├── rust-toolchain.toml ├── .gitignore ├── .cargo │ └── config.toml ├── Cargo.toml ├── LICENSE-MIT ├── .github │ └── workflows │ │ └── rust_ci.yml ├── src │ └── main.rs ├── LICENSE-APACHE └── Cargo.lock ├── example-esp32h2 ├── rust-toolchain.toml ├── .gitignore ├── .cargo │ └── config.toml ├── Cargo.toml ├── LICENSE-MIT ├── .github │ └── workflows │ │ └── rust_ci.yml ├── src │ └── main.rs ├── LICENSE-APACHE └── Cargo.lock ├── Cargo.toml ├── src ├── main.rs ├── lib.rs ├── trace_decoder.rs └── inst_decoder.rs ├── LICENSE-MIT ├── README.md ├── LICENSE-APACHE └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /example-esp32c6/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" 3 | components = ["rust-src"] 4 | targets = ["riscv32imac-unknown-none-elf"] 5 | 6 | -------------------------------------------------------------------------------- /example-esp32h2/rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" 3 | components = ["rust-src"] 4 | targets = ["riscv32imac-unknown-none-elf"] 5 | 6 | -------------------------------------------------------------------------------- /example-esp32c6/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | -------------------------------------------------------------------------------- /example-esp32h2/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "esp-trace-decoder" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "tracedecode" 8 | path = "src/lib.rs" 9 | 10 | [[bin]] 11 | name = "main" 12 | path = "src/main.rs" 13 | 14 | [dependencies] 15 | clap = { version = "4.4.6", features = ["derive"] } 16 | pretty_env_logger = "0.5.0" 17 | 18 | log = "0.4.20" 19 | object = "0.32.1" 20 | -------------------------------------------------------------------------------- /example-esp32c6/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.riscv32imac-unknown-none-elf] 2 | runner = "espflash flash --monitor" 3 | 4 | 5 | [build] 6 | rustflags = [ 7 | "-C", "link-arg=-Tlinkall.x", 8 | 9 | # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) 10 | # NOTE: May negatively impact performance of produced code 11 | "-C", "force-frame-pointers", 12 | ] 13 | 14 | target = "riscv32imac-unknown-none-elf" 15 | 16 | [unstable] 17 | build-std = ["core"] 18 | -------------------------------------------------------------------------------- /example-esp32h2/.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.riscv32imac-unknown-none-elf] 2 | runner = "espflash flash --monitor" 3 | 4 | 5 | [build] 6 | rustflags = [ 7 | "-C", "link-arg=-Tlinkall.x", 8 | 9 | # Required to obtain backtraces (e.g. when using the "esp-backtrace" crate.) 10 | # NOTE: May negatively impact performance of produced code 11 | "-C", "force-frame-pointers", 12 | ] 13 | 14 | target = "riscv32imac-unknown-none-elf" 15 | 16 | [unstable] 17 | build-std = ["core"] 18 | -------------------------------------------------------------------------------- /example-esp32c6/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-esp32c6" 3 | version = "0.1.0" 4 | authors = ["bjoernQ "] 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | 8 | [dependencies] 9 | hal = { git = "https://github.com/esp-rs/esp-hal/", rev = "663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6", package = "esp32c6-hal", version = "0.5.0" } 10 | esp-backtrace = { version = "0.9.0", features = ["esp32c6", "panic-handler", "exception-handler", "print-uart"] } 11 | esp-println = { version = "0.7.0", features = ["esp32c6"] } 12 | -------------------------------------------------------------------------------- /example-esp32h2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-esp32h2" 3 | version = "0.1.0" 4 | authors = ["bjoernQ "] 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | 8 | [dependencies] 9 | hal = { git = "https://github.com/esp-rs/esp-hal/", rev = "663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6", package = "esp32h2-hal", version = "0.3.0" } 10 | esp-backtrace = { version = "0.9.0", features = ["esp32h2", "panic-handler", "exception-handler", "print-uart"] } 11 | esp-println = { version = "0.7.0", features = ["esp32h2"] } 12 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | use std::path::PathBuf; 3 | use tracedecode::parse_trace; 4 | 5 | #[derive(Parser)] 6 | struct Cli { 7 | trace_file: PathBuf, 8 | 9 | #[arg(short, long)] 10 | elf: Vec, 11 | } 12 | 13 | fn main() { 14 | pretty_env_logger::init(); 15 | 16 | let cli = Cli::parse(); 17 | 18 | let hex_trace = std::fs::read_to_string(&cli.trace_file).unwrap(); 19 | let mut data: Vec = Vec::new(); 20 | 21 | let hex_chars: Vec = hex_trace.chars().into_iter().collect(); 22 | for i in (0..hex_trace.len()).step_by(2) { 23 | let b = u8::from_str_radix(&format!("{}{}", hex_chars[i], hex_chars[i + 1]), 16).unwrap(); 24 | data.push(b); 25 | } 26 | 27 | let elf_files = &cli.elf; 28 | 29 | let execution_path = parse_trace(data, elf_files); 30 | 31 | println!("{:#x?}", &execution_path); 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 esp-rs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example-esp32c6/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright [year] [fullname] 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /example-esp32h2/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright [year] [fullname] 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /example-esp32c6/.github/workflows/rust_ci.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - "**/README.md" 7 | pull_request: 8 | workflow_dispatch: 9 | 10 | env: 11 | CARGO_TERM_COLOR: always 12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 13 | 14 | jobs: 15 | rust-checks: 16 | name: Rust Checks 17 | runs-on: ubuntu-latest 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | action: 22 | - command: build 23 | args: --release 24 | - command: fmt 25 | args: --all -- --check --color always 26 | - command: clippy 27 | args: --all-features --workspace -- -D warnings 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v4 31 | - name: Enable caching 32 | uses: Swatinem/rust-cache@v2 33 | - name: Setup Rust 34 | uses: dtolnay/rust-toolchain@v1 35 | with: 36 | target: riscv32imac-unknown-none-elf 37 | toolchain: nightly 38 | components: rust-src, rustfmt, clippy 39 | - name: Run command 40 | run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }} 41 | -------------------------------------------------------------------------------- /example-esp32h2/.github/workflows/rust_ci.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | paths-ignore: 6 | - "**/README.md" 7 | pull_request: 8 | workflow_dispatch: 9 | 10 | env: 11 | CARGO_TERM_COLOR: always 12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 13 | 14 | jobs: 15 | rust-checks: 16 | name: Rust Checks 17 | runs-on: ubuntu-latest 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | action: 22 | - command: build 23 | args: --release 24 | - command: fmt 25 | args: --all -- --check --color always 26 | - command: clippy 27 | args: --all-features --workspace -- -D warnings 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v4 31 | - name: Enable caching 32 | uses: Swatinem/rust-cache@v2 33 | - name: Setup Rust 34 | uses: dtolnay/rust-toolchain@v1 35 | with: 36 | target: riscv32imac-unknown-none-elf 37 | toolchain: nightly 38 | components: rust-src, rustfmt, clippy 39 | - name: Run command 40 | run: cargo ${{ matrix.action.command }} ${{ matrix.action.args }} 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp-trace-decoder 2 | 3 | This is a decoder for traces generated by the ESP32-C6's / ESP32-H2's RISCV TRACE Encoder. 4 | 5 | ## Usage 6 | 7 | Execute one of the examples (`cargo run --release`). Then copy the dumped trace data and save it as a file. 8 | 9 | Make sure you have access to the ROM ELF files (https://github.com/espressif/esp-rom-elfs) because in order to decode the trace data we need access to all the traced instructions. 10 | 11 | Run the decoder like this: 12 | `cargo run -- YOUR_SAVED_TRACE --elf example-esp32h2\target\riscv32imac-unknown-none-elf\release\example-esp32h2 --elf PATH_TO_ROM_ELF\esp32h2_rev0_rom.elf` 13 | 14 | Then you should see the decoded execution path. 15 | 16 | ## License 17 | 18 | Licensed under either of: 19 | 20 | - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) 21 | - MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) 22 | 23 | at your option. 24 | 25 | ### Contribution 26 | 27 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in 28 | the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without 29 | any additional terms or conditions. 30 | -------------------------------------------------------------------------------- /example-esp32c6/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use hal::{ 5 | clock::ClockControl, peripherals::Peripherals, prelude::*, timer::TimerGroup, trace::*, 6 | }; 7 | use esp_backtrace as _; 8 | use esp_println::{print, println}; 9 | 10 | #[entry] 11 | fn main() -> ! { 12 | let peripherals = Peripherals::take(); 13 | let system = peripherals.SYSTEM.split(); 14 | let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); 15 | 16 | let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); 17 | let mut timer0 = timer_group0.timer0; 18 | timer0.start(1u64.secs()); 19 | 20 | let mut trace = Trace::new(peripherals.TRACE); 21 | let buffer = unsafe { &mut BUFFER[..] }; 22 | trace.start_trace(buffer); 23 | 24 | // traced code 25 | println!("Hello"); 26 | // end traced code 27 | 28 | let res = trace.stop_trace().unwrap(); 29 | println!("{:?}", res); 30 | println!("Copy the trace data to a file and use the CLI to decode"); 31 | for i in res.valid_start_index..(res.valid_start_index + res.valid_length) { 32 | print!("{:02x}", buffer[i % buffer.len()]); 33 | } 34 | println!(); 35 | 36 | loop {} 37 | } 38 | 39 | static mut BUFFER: [u8; 4096 * 4] = [0u8; 4096 * 4]; 40 | -------------------------------------------------------------------------------- /example-esp32h2/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_std] 2 | #![no_main] 3 | 4 | use hal::{ 5 | clock::ClockControl, peripherals::Peripherals, prelude::*, timer::TimerGroup, trace::*, 6 | }; 7 | use esp_backtrace as _; 8 | use esp_println::{print, println}; 9 | 10 | #[entry] 11 | fn main() -> ! { 12 | let peripherals = Peripherals::take(); 13 | let system = peripherals.SYSTEM.split(); 14 | let clocks = ClockControl::boot_defaults(system.clock_control).freeze(); 15 | 16 | let timer_group0 = TimerGroup::new(peripherals.TIMG0, &clocks); 17 | let mut timer0 = timer_group0.timer0; 18 | timer0.start(1u64.secs()); 19 | 20 | let mut trace = Trace::new(peripherals.TRACE); 21 | let buffer = unsafe { &mut BUFFER[..] }; 22 | trace.start_trace(buffer); 23 | 24 | // traced code 25 | println!("Hello"); 26 | // end traced code 27 | 28 | let res = trace.stop_trace().unwrap(); 29 | println!("{:?}", res); 30 | println!("Copy the trace data to a file and use the CLI to decode"); 31 | for i in res.valid_start_index..(res.valid_start_index + res.valid_length) { 32 | print!("{:02x}", buffer[i % buffer.len()]); 33 | } 34 | println!(); 35 | 36 | loop {} 37 | } 38 | 39 | static mut BUFFER: [u8; 4096 * 4] = [0u8; 4096 * 4]; 40 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::path::PathBuf; 2 | pub(crate) mod inst_decoder; 3 | pub(crate) mod trace_decoder; 4 | use object::{File, Object, ObjectSection}; 5 | 6 | use crate::trace_decoder::*; 7 | 8 | #[derive(Debug, Clone, Copy)] 9 | pub enum Error { 10 | Corrupted, 11 | } 12 | 13 | /// Parse the given trace data by using the given ELF files 14 | pub fn parse_trace(data: Vec, elf_files: &Vec) -> Result, Error> { 15 | let mut execution_path = Vec::new(); 16 | 17 | let parsed = parse(&data)?; 18 | 19 | // load elfs 20 | let mut elfs = Vec::new(); 21 | let mut obj_files = Vec::new(); 22 | for elf in elf_files { 23 | let bin_data = std::fs::read(elf).unwrap(); 24 | elfs.push(bin_data); 25 | } 26 | for i in 0..elfs.len() { 27 | let obj_file = object::File::parse(&*elfs[i]).unwrap(); 28 | obj_files.push(obj_file); 29 | } 30 | 31 | log::debug!("Parsed {:#x?}", &parsed); 32 | 33 | let (first_sync, _) = parsed 34 | .iter() 35 | .enumerate() 36 | .find(|(_, packet)| matches!(packet, Packet::Sync(_, _))) 37 | .unwrap(); 38 | log::debug!("first sync packet at index {first_sync}"); 39 | 40 | let last_packet = if let Packet::Support(_, _) = *parsed.last().unwrap() { 41 | parsed.len() - 2 42 | } else { 43 | log::debug!("Last packet is not a support packet. Data corrupted?"); 44 | parsed.len() - 1 45 | }; 46 | 47 | let end_pc = if let Packet::Address(_, addr) = parsed[last_packet] { 48 | addr.address 49 | } else { 50 | log::debug!("No data packet before support ending packet."); 51 | return Err(Error::Corrupted); 52 | }; 53 | 54 | let mut branch_map: Vec = Vec::new(); 55 | let mut current = first_sync; 56 | let mut pc = 0; 57 | let mut uninferable = false; 58 | let mut last_taken_branch_map = None; 59 | 60 | 'outer: loop { 61 | match parsed[current] { 62 | Packet::Sync(_, sync) => { 63 | // should a sync be considered an address for uninferable branches? 64 | pc = sync.address; 65 | 66 | let insn = get_instruction(&obj_files, pc); 67 | // if an inferable branch -> push if it should be taken or not 68 | if crate::inst_decoder::is_inferable_branch(&insn) { 69 | log::debug!( 70 | "sync is an inferable branch, branch taken = {}", 71 | !sync.branch 72 | ); 73 | branch_map.insert(0, !sync.branch); 74 | } 75 | current += 1; 76 | } 77 | Packet::Address(_, address) => { 78 | pc = address.address; 79 | current += 1; 80 | } 81 | Packet::AddressBranchMap(_, map) => { 82 | if uninferable { 83 | pc = map.address; 84 | current += 1; 85 | } else { 86 | if last_taken_branch_map == Some(current) { 87 | current += 1; 88 | } 89 | last_taken_branch_map = Some(current); 90 | let count = if map.branches != 0 { map.branches } else { 32 }; 91 | for i in 0..count { 92 | branch_map.push(((map.branch_map >> i) & 0b1) == 0); 93 | } 94 | } 95 | } 96 | Packet::NoAddressBranchMap(_, map) => { 97 | let count = if map.branches != 0 { map.branches } else { 32 }; 98 | for i in 0..count { 99 | branch_map.push(((map.branch_map >> i) & 0b1) == 0); 100 | } 101 | current += 1; 102 | } 103 | _ => { 104 | current += 1; 105 | continue; 106 | } 107 | } 108 | uninferable = false; 109 | 110 | loop { 111 | if execution_path.is_empty() || execution_path[execution_path.len() - 1] != pc { 112 | execution_path.push(pc); 113 | } 114 | 115 | if pc == end_pc { 116 | break 'outer; 117 | } 118 | 119 | log::debug!("PC={:x}", pc); 120 | let insn = get_instruction(&obj_files, pc); 121 | log::debug!(" Instruction {:x?}", &insn); 122 | 123 | log::debug!( 124 | " {:x?} infer={} uninfer={} jmp-infer={}", 125 | crate::inst_decoder::next_address(&insn, pc), 126 | crate::inst_decoder::is_inferable_branch(&insn), 127 | crate::inst_decoder::is_uninferable_branch(&insn), 128 | crate::inst_decoder::is_inferable_jump(&insn), 129 | ); 130 | if !crate::inst_decoder::is_inferable_branch(&insn) 131 | && !crate::inst_decoder::is_uninferable_branch(&insn) 132 | && !crate::inst_decoder::is_inferable_jump(&insn) 133 | { 134 | pc = crate::inst_decoder::next_address(&insn, pc) 135 | .next_instruction 136 | .unwrap(); 137 | } else if crate::inst_decoder::is_inferable_branch(&insn) { 138 | if branch_map.is_empty() { 139 | log::debug!("empty branch map"); 140 | continue 'outer; 141 | } 142 | 143 | log::debug!("take from branch map"); 144 | let taken = *branch_map.first().unwrap(); 145 | branch_map.remove(0); 146 | let next = crate::inst_decoder::next_address(&insn, pc); 147 | pc = if taken { 148 | next.branched.unwrap() 149 | } else { 150 | next.next_instruction.unwrap() 151 | }; 152 | } else if crate::inst_decoder::is_inferable_jump(&insn) { 153 | let next = crate::inst_decoder::next_address(&insn, pc); 154 | pc = next.next_instruction.unwrap(); 155 | } else if crate::inst_decoder::is_uninferable_branch(&insn) { 156 | log::info!("uninferable branch"); 157 | uninferable = true; 158 | continue 'outer; 159 | } 160 | } 161 | } 162 | 163 | Ok(execution_path) 164 | } 165 | 166 | pub fn get_instruction(obj_files: &Vec>, address: u32) -> Vec { 167 | let mut res = Vec::new(); 168 | for obj_file in obj_files { 169 | for section in obj_file.sections() { 170 | let found = section.data_range(address as u64, 2u64); 171 | if let Ok(Some(data)) = found { 172 | let found = section.data_range(address as u64, 4u64); 173 | if let Ok(Some(data)) = found { 174 | res.extend_from_slice(data); 175 | break; 176 | } 177 | res.extend_from_slice(data); 178 | break; 179 | } 180 | } 181 | 182 | if res.len() > 0 { 183 | break; 184 | } 185 | } 186 | 187 | res 188 | } 189 | -------------------------------------------------------------------------------- /src/trace_decoder.rs: -------------------------------------------------------------------------------- 1 | pub fn parse(data: &[u8]) -> Result, super::Error> { 2 | let mut res = Vec::new(); 3 | let mut reader = Reader::new(&data); 4 | 5 | let mut previous_index = None; 6 | while reader.has_data(8) { 7 | let start_bit_count = reader.current_bit_count(); 8 | 9 | let len = reader.get_bits(5); 10 | let until = start_bit_count + 8 * len as usize; 11 | 12 | if reader.total_bit_count() <= until { 13 | break; 14 | } 15 | 16 | reader.get_bits(3); 17 | 18 | if len == 0 { 19 | continue; 20 | } 21 | 22 | if !reader.has_data(len as usize * 8 - 8) { 23 | break; 24 | } 25 | 26 | let index = reader.get_bits(16); 27 | if let Some(previous) = previous_index { 28 | if previous != index.wrapping_sub(1) { 29 | log::debug!("prev={} index={}", previous, index); 30 | break; 31 | } 32 | } 33 | previous_index = Some(index); 34 | let format = reader.get_bits(2); 35 | 36 | if format == 0b01 { 37 | // format 1 38 | 39 | let branches = reader.get_bits(5); 40 | 41 | let bits = match branches { 42 | 0 => 0, 43 | 1 => 1, 44 | 2..=3 => 3, 45 | 4..=7 => 7, 46 | 8..=15 => 15, 47 | 16..=32 => 31, 48 | _ => return Err(super::Error::Corrupted), 49 | }; 50 | 51 | let branch_map = reader.get_bits(if bits != 0 { bits } else { 31 }); 52 | 53 | if bits != 0 { 54 | let address = reader.get_bits(31); 55 | let bits = match branches { 56 | 1 => 7, 57 | 2..=3 => 5, 58 | 4..=7 => 1, 59 | 8..=15 => 1, 60 | 16..=32 => 0, // ?? TRM says 31 61 | _ => return Err(super::Error::Corrupted), 62 | }; 63 | let notify = reader.get_bits(1); 64 | let updiscon = reader.get_bits(1); 65 | let _sign_extend = reader.get_bits(bits); 66 | 67 | res.push(Packet::AddressBranchMap( 68 | index, 69 | AddressBranchMap { 70 | address: address << 1, 71 | branches: branches as u8, 72 | branch_map, 73 | notify: notify != 0, 74 | updiscon: updiscon != 0, 75 | }, 76 | )) 77 | } else { 78 | let _sign_extend = reader.get_bits(2); 79 | 80 | res.push(Packet::NoAddressBranchMap( 81 | index, 82 | NoAddressBranchMap { 83 | branches: branches as u8, 84 | branch_map, 85 | }, 86 | )) 87 | } 88 | } else if format == 0b10 { 89 | // format 2 90 | 91 | let address = reader.get_bits(31); 92 | let notify = reader.get_bits(1); 93 | let updiscon = reader.get_bits(1); 94 | let _sign_extend = reader.get_bits(5); 95 | 96 | res.push(Packet::Address( 97 | index, 98 | Address { 99 | address: address << 1, 100 | notify: notify != 0, 101 | updiscon: updiscon != 0, 102 | }, 103 | )) 104 | } else if format == 0b11 { 105 | // format 3 106 | 107 | let subformat = reader.get_bits(2); 108 | 109 | if subformat == 0 { 110 | let branch = reader.get_bits(1); 111 | let privilege = reader.get_bits(1); 112 | let address = reader.get_bits(31); 113 | let _sign_extend = reader.get_bits(3); 114 | 115 | res.push(Packet::Sync( 116 | index, 117 | Sync { 118 | address: address << 1, 119 | branch: branch != 0, 120 | privilege: privilege != 0, 121 | }, 122 | )) 123 | } else if subformat == 1 { 124 | let branch = reader.get_bits(1); 125 | let privilege = reader.get_bits(1); 126 | let ecause = reader.get_bits(5); 127 | let interrupt = reader.get_bits(1); 128 | let address = reader.get_bits(31); 129 | let tvalepc = reader.get_bits(32); 130 | let _sign_extend = reader.get_bits(6); 131 | 132 | res.push(Packet::Exception( 133 | index, 134 | Exception { 135 | address: address << 1, 136 | branch: branch != 0, 137 | privilege: privilege != 0, 138 | ecause: ecause as u8, 139 | interrupt: interrupt != 0, 140 | tvalepc, 141 | }, 142 | )) 143 | } 144 | if subformat == 3 { 145 | let enable = reader.get_bits(1); 146 | let qual_status = reader.get_bits(2); 147 | let _sign_extend = reader.get_bits(1); 148 | 149 | res.push(Packet::Support( 150 | index, 151 | Support { 152 | enable: enable != 0, 153 | qual_status: qual_status as u8, 154 | }, 155 | )) 156 | } 157 | } 158 | 159 | reader.skip_until(until); 160 | } 161 | 162 | Ok(res) 163 | } 164 | 165 | #[derive(Debug, Clone, Copy)] 166 | pub struct Sync { 167 | pub branch: bool, 168 | pub privilege: bool, 169 | pub address: u32, 170 | } 171 | 172 | #[derive(Debug, Clone, Copy)] 173 | pub struct Exception { 174 | pub branch: bool, 175 | pub privilege: bool, 176 | pub ecause: u8, 177 | pub interrupt: bool, 178 | pub address: u32, 179 | pub tvalepc: u32, 180 | } 181 | 182 | #[derive(Debug, Clone, Copy)] 183 | pub struct Support { 184 | pub enable: bool, 185 | pub qual_status: u8, 186 | } 187 | 188 | #[derive(Debug, Clone, Copy)] 189 | pub struct Address { 190 | pub address: u32, 191 | pub notify: bool, 192 | pub updiscon: bool, 193 | } 194 | 195 | #[derive(Debug, Clone, Copy)] 196 | pub struct AddressBranchMap { 197 | pub address: u32, 198 | pub branches: u8, 199 | pub branch_map: u32, 200 | pub notify: bool, 201 | pub updiscon: bool, 202 | } 203 | 204 | #[derive(Debug, Clone, Copy)] 205 | pub struct NoAddressBranchMap { 206 | pub branches: u8, 207 | pub branch_map: u32, 208 | } 209 | 210 | #[derive(Debug, Clone, Copy)] 211 | pub enum Packet { 212 | Sync(u32, Sync), 213 | Exception(u32, Exception), 214 | Support(u32, Support), 215 | Address(u32, Address), 216 | AddressBranchMap(u32, AddressBranchMap), 217 | NoAddressBranchMap(u32, NoAddressBranchMap), 218 | } 219 | 220 | struct Reader<'a> { 221 | data: &'a [u8], 222 | index: usize, 223 | current_bit: u8, 224 | bit_count: usize, 225 | } 226 | 227 | impl<'a> Reader<'a> { 228 | pub fn new(data: &'a [u8]) -> Self { 229 | Self { 230 | data, 231 | index: 0, 232 | current_bit: 0, 233 | bit_count: 0, 234 | } 235 | } 236 | 237 | pub fn next_bit(&mut self) -> u32 { 238 | let out = if self.data[self.index] & (1 << self.current_bit as u32) != 0 { 239 | 1 240 | } else { 241 | 0 242 | }; 243 | if self.current_bit < 7 { 244 | self.current_bit += 1 245 | } else { 246 | self.index += 1; 247 | self.current_bit = 0; 248 | }; 249 | self.bit_count += 1; 250 | out 251 | } 252 | 253 | pub fn get_bits(&mut self, bits: usize) -> u32 { 254 | let mut res = 0; 255 | for i in 0..bits { 256 | res |= self.next_bit() << i; 257 | } 258 | res 259 | } 260 | 261 | pub fn current_bit_count(&self) -> usize { 262 | self.bit_count 263 | } 264 | 265 | pub fn skip_until(&mut self, until: usize) { 266 | while self.bit_count < until { 267 | self.next_bit(); 268 | } 269 | } 270 | 271 | pub fn has_data(&self, count: usize) -> bool { 272 | self.bit_count + count <= self.total_bit_count() 273 | } 274 | 275 | pub fn total_bit_count(&self) -> usize { 276 | self.data.len() * 8 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2023 esp-rs 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /example-esp32c6/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /example-esp32h2/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/inst_decoder.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Copy, Clone, PartialEq, Default)] 2 | pub struct RiscvRegisters { 3 | pub pc: u32, 4 | pub registers: [u32; 32], 5 | } 6 | 7 | #[derive(Debug)] 8 | pub struct NextAddress { 9 | pub next_instruction: Option, 10 | pub branched: Option, 11 | } 12 | 13 | pub fn next_address(insn: &[u8], pc: u32) -> NextAddress { 14 | let candidates = estimate_next_inferable_pc(insn, pc); 15 | 16 | let next_instruction = if candidates.len() > 0 { 17 | Some(candidates[0]) 18 | } else { 19 | None 20 | }; 21 | 22 | let branched = if candidates.len() > 1 { 23 | Some(candidates[1]) 24 | } else { 25 | None 26 | }; 27 | 28 | NextAddress { 29 | next_instruction, 30 | branched, 31 | } 32 | } 33 | 34 | pub fn estimate_next_inferable_pc(insn: &[u8], pc: u32) -> Vec { 35 | let mut candiates = Vec::new(); 36 | 37 | let insn_len = if insn[0] & 0b11 == 0b11 { 4 } else { 2 }; 38 | candiates.push(pc + insn_len); 39 | 40 | match insn_len { 41 | 4 => { 42 | let inst = u32::from_le_bytes(insn.try_into().unwrap()); 43 | 44 | if (inst & 0b111_1111) == 0b110_1111 { 45 | // JAL 46 | let offset_20 = (inst & 0b100000000000_00000_000_00000_00000_00) >> 31; 47 | let offset_10_1 = (inst & 0b011111111110_00000_000_00000_00000_00) >> 21; 48 | let offset_19_12 = (inst & 0b000000000000_11111_111_00000_00000_00) >> 12; 49 | let offset_11 = (inst & 0b000000000001_00000_000_00000_00000_00) >> 20; 50 | let offset = (offset_10_1 << 1) 51 | | (offset_11 << 11) 52 | | (offset_19_12 << 12) 53 | | (offset_20 << 20); 54 | 55 | candiates.clear(); 56 | candiates.push(((pc as i64 + sext(offset, 20) as i64) as u32) & !1); 57 | } else if (inst & 0b11111_11) == 0b11000_11 { 58 | // BEQ, BNE, BLT, GE, BLTU, BGEU 59 | let offset_12 = (inst & 0b100000000000_00000_000_00000_00000_00) >> 31; 60 | let offset_10_5 = (inst & 0b011111100000_00000_000_00000_00000_00) >> 25; 61 | let offset_4_1 = (inst & 0b1111_0_00000_00) >> 8; 62 | let offset_11 = (inst & 0b1_00000_00) >> 7; 63 | let offset = 64 | (offset_12 << 12) | (offset_11 << 11) | (offset_10_5 << 5) | (offset_4_1 << 1); 65 | 66 | candiates.push(((pc as i64 + sext(offset, 12) as i64) as u32) & !1); 67 | } 68 | } 69 | 2 => { 70 | let inst = u16::from_le_bytes(insn[0..2].try_into().unwrap()); 71 | 72 | if (inst & 0b111_00000000000_11) == 0b101_00000000000_01 { 73 | // C.J 74 | let imm = ((inst & 0b000_11111111111_00) as u32) >> 2; 75 | let offset_5 = imm & 0b1; 76 | let offset_3_1 = (imm & 0b1110) >> 1; 77 | let offset_7 = (imm & 0b10000) >> 4; 78 | let offset_6 = (imm & 0b100000) >> 5; 79 | let offset_10 = (imm & 0b1000000) >> 6; 80 | let offset_9_8 = (imm & 0b110000000) >> 7; 81 | let offset_4 = (imm & 0b1000000000) >> 9; 82 | let offset_11 = (imm & 0b10000000000) >> 10; 83 | 84 | let offset = (offset_3_1 << 1) 85 | | (offset_4 << 4) 86 | | (offset_5 << 5) 87 | | (offset_6 << 6) 88 | | (offset_7 << 7) 89 | | (offset_9_8 << 8) 90 | | (offset_10 << 10) 91 | | (offset_11 << 11); 92 | 93 | candiates.clear(); 94 | candiates.push(((pc as i64 + sext(offset, 11) as i64) as u32) & !1); 95 | } else if (inst & 0b111_00000000000_11) == 0b110_00000000000_01 { 96 | // C.BEQZ 97 | 98 | let imm6_2 = ((inst & 0b11111_00) as u32) >> 2; 99 | let imm12_10 = ((inst & 0b111_0000000000) as u32) >> 10; 100 | 101 | let offset_5 = imm6_2 & 0b1; 102 | let offset_2_1 = (imm6_2 & 0b110) >> 1; 103 | let offset_7_6 = (imm6_2 & 0b11000) >> 3; 104 | let offset_4_3 = imm12_10 & 0b11; 105 | let offset_8 = (imm12_10 & 0b100) >> 2; 106 | 107 | let offset = (offset_2_1 << 1) 108 | | (offset_4_3 << 3) 109 | | (offset_5 << 5) 110 | | (offset_7_6 << 6) 111 | | (offset_8 << 8); 112 | 113 | candiates.push(((pc as i64 + sext(offset, 8) as i64) as u32) & !1); 114 | } else if (inst & 0b111_00000000000_11) == 0b111_00000000000_01 { 115 | // C.BNEZ 116 | 117 | let imm6_2 = ((inst & 0b11111_00) as u32) >> 2; 118 | let imm12_10 = ((inst & 0b111_0000000000) as u32) >> 10; 119 | 120 | let offset_5 = imm6_2 & 0b1; 121 | let offset_2_1 = (imm6_2 & 0b110) >> 1; 122 | let offset_7_6 = (imm6_2 & 0b11000) >> 3; 123 | let offset_4_3 = imm12_10 & 0b11; 124 | let offset_8 = (imm12_10 & 0b100) >> 2; 125 | 126 | let offset = (offset_2_1 << 1) 127 | | (offset_4_3 << 3) 128 | | (offset_5 << 5) 129 | | (offset_7_6 << 6) 130 | | (offset_8 << 8); 131 | 132 | candiates.push(((pc as i64 + sext(offset, 8) as i64) as u32) & !1); 133 | } else if (inst & 0b111_00000000000_11) == 0b001_00000000000_01 { 134 | // C.JAL 135 | let imm = ((inst & 0b000_11111111111_00) as u32) >> 2; 136 | let offset_5 = imm & 0b1; 137 | let offset_3_1 = (imm & 0b1110) >> 1; 138 | let offset_7 = (imm & 0b10000) >> 4; 139 | let offset_6 = (imm & 0b100000) >> 5; 140 | let offset_10 = (imm & 0b1000000) >> 6; 141 | let offset_9_8 = (imm & 0b110000000) >> 7; 142 | let offset_4 = (imm & 0b1000000000) >> 9; 143 | let offset_11 = (imm & 0b10000000000) >> 10; 144 | 145 | let offset = (offset_3_1 << 1) 146 | | (offset_4 << 4) 147 | | (offset_5 << 5) 148 | | (offset_6 << 6) 149 | | (offset_7 << 7) 150 | | (offset_9_8 << 8) 151 | | (offset_10 << 10) 152 | | (offset_11 << 11); 153 | 154 | candiates.clear(); 155 | candiates.push(((pc as i64 + sext(offset, 11) as i64) as u32) & !1); 156 | } 157 | } 158 | _ => panic!("Unexpected insn_len"), 159 | } 160 | 161 | candiates 162 | } 163 | 164 | pub fn is_inferable_branch(insn: &[u8]) -> bool { 165 | let insn_len = if insn[0] & 0b11 == 0b11 { 4 } else { 2 }; 166 | 167 | match insn_len { 168 | 4 => { 169 | let inst = u32::from_le_bytes(insn.try_into().unwrap()); 170 | 171 | if (inst & 0b11111_11) == 0b11000_11 { 172 | // BEQ, BNE, BLT, BGE, BLTU, BGEU 173 | true 174 | } else { 175 | false 176 | } 177 | } 178 | 2 => { 179 | let inst = u16::from_le_bytes(insn[0..2].try_into().unwrap()); 180 | 181 | if (inst & 0b111_00000000000_11) == 0b110_00000000000_01 { 182 | // C.BEQZ 183 | true 184 | } else if (inst & 0b111_00000000000_11) == 0b111_00000000000_01 { 185 | // C.BNEZ 186 | true 187 | } else { 188 | false 189 | } 190 | } 191 | 192 | _ => panic!("Unexpected insn_len"), 193 | } 194 | } 195 | 196 | pub fn is_inferable_jump(insn: &[u8]) -> bool { 197 | let insn_len = if insn[0] & 0b11 == 0b11 { 4 } else { 2 }; 198 | 199 | match insn_len { 200 | 4 => { 201 | let inst = u32::from_le_bytes(insn.try_into().unwrap()); 202 | 203 | if (inst & 0b111_1111) == 0b110_1111 { 204 | // JAL 205 | true 206 | } else { 207 | false 208 | } 209 | } 210 | 2 => { 211 | let inst = u16::from_le_bytes(insn[0..2].try_into().unwrap()); 212 | 213 | if (inst & 0b111_00000000000_11) == 0b101_00000000000_01 { 214 | // C.J 215 | true 216 | } else if (inst & 0b111_00000000000_11) == 0b001_00000000000_01 { 217 | // C.JAL 218 | true 219 | } else { 220 | false 221 | } 222 | } 223 | 224 | _ => panic!("Unexpected insn_len"), 225 | } 226 | } 227 | 228 | pub fn is_uninferable_branch(insn: &[u8]) -> bool { 229 | let insn_len = if insn[0] & 0b11 == 0b11 { 4 } else { 2 }; 230 | 231 | match insn_len { 232 | 4 => { 233 | let inst = u32::from_le_bytes(insn.try_into().unwrap()); 234 | 235 | if (inst & 0b111_00000_11111_11) == 0b000_00000_11001_11 { 236 | // JALR 237 | true 238 | } else if inst == 0b00110000001000000000000001110011 { 239 | // MRET 240 | true 241 | } else if inst == 0b00000000000000000000000001110011 { 242 | // ECALL 243 | true 244 | } else if inst == 0b00000000000100000000000001110011 { 245 | // EBREAK 246 | true 247 | } else { 248 | false 249 | } 250 | } 251 | 2 => { 252 | let inst = u16::from_le_bytes(insn[0..2].try_into().unwrap()); 253 | 254 | if (inst & 0b111_1_00000_11111_11) == 0b100_00000000000_10 { 255 | // C.JR incl. C.RET 256 | true 257 | } else if (inst & 0b1111_0000_0111_1111) == 0b1001_0000_0000_0010 { 258 | // C.JALR 259 | true 260 | } else if inst == 0b1001000000000010 { 261 | // C.EBREAK 262 | true 263 | } else { 264 | false 265 | } 266 | } 267 | _ => panic!("Unexpected insn_len"), 268 | } 269 | } 270 | 271 | fn sext(value: u32, sign_bit: usize) -> i32 { 272 | if value & (1 << sign_bit) != 0 { 273 | ((0b1 << (sign_bit - 1)) - (value & setbits(sign_bit - 1)) as i32) * -1 274 | } else { 275 | value as i32 276 | } 277 | } 278 | 279 | fn setbits(x: usize) -> u32 { 280 | u32::MAX >> (32 - x) 281 | } 282 | 283 | #[test] 284 | fn test_non_branching_uncompressed() { 285 | let pc = 0x42000070; 286 | let isn = [0x97, 0x11, 0xc8, 0xfd]; 287 | 288 | let res = estimate_next_inferable_pc(&isn, pc); 289 | assert_eq!(res.len(), 1); 290 | assert_eq!(res[0], 0x42000074); 291 | } 292 | 293 | #[test] 294 | fn test_non_branching_compressed() { 295 | let pc = 0x42000060; 296 | let isn = [0x01, 0x4c, 0xff, 0xff]; 297 | 298 | let res = estimate_next_inferable_pc(&isn, pc); 299 | assert_eq!(res.len(), 1); 300 | assert_eq!(res[0], 0x42000062); 301 | } 302 | 303 | #[test] 304 | fn test_branching_uncompressed_jal() { 305 | let pc = 0x42000308; 306 | let isn = [0xef, 0x00, 0xc0, 0x16]; 307 | 308 | let res = estimate_next_inferable_pc(&isn, pc); 309 | assert_eq!(res.len(), 1); 310 | assert_eq!(res[0], 0x42000474); 311 | } 312 | 313 | #[test] 314 | fn test_branching_uncompressed_jal2() { 315 | let pc = 0x40022ce2; 316 | let isn = [0xef, 0x60, 0x4f, 0xee]; 317 | 318 | let res = estimate_next_inferable_pc(&isn, pc); 319 | assert_eq!(res.len(), 1); 320 | assert_eq!(res[0], 0x400193c6); 321 | } 322 | 323 | #[test] 324 | fn test_branching_uncompressed_beq() { 325 | let pc = 0x42000b74; 326 | let isn = [0x63, 0x05, 0xb5, 0x00]; 327 | 328 | let res = estimate_next_inferable_pc(&isn, pc); 329 | assert_eq!(res.len(), 2); 330 | assert_eq!(res[0], 0x42000b78); 331 | assert_eq!(res[1], 0x42000b7e); 332 | } 333 | 334 | #[test] 335 | fn test_branching_uncompressed_bne() { 336 | let pc = 0x420000cc; 337 | let isn = [0x63, 0x18, 0xb5, 0x00]; 338 | 339 | let res = estimate_next_inferable_pc(&isn, pc); 340 | assert_eq!(res.len(), 2); 341 | assert_eq!(res[0], 0x420000d0); 342 | assert_eq!(res[1], 0x420000dc); 343 | } 344 | 345 | #[test] 346 | fn test_branching_uncompressed_blt() { 347 | let pc = 0x4200125e; 348 | let isn = [0x63, 0x44, 0xb5, 0x00]; 349 | 350 | let res = estimate_next_inferable_pc(&isn, pc); 351 | assert_eq!(res.len(), 2); 352 | assert_eq!(res[0], 0x42001262); 353 | assert_eq!(res[1], 0x42001266); 354 | } 355 | 356 | #[test] 357 | fn test_branching_compressed_j() { 358 | let pc = 0x42002322; 359 | let isn = [0x61, 0xbf, 0x00, 0x00]; 360 | 361 | let res = estimate_next_inferable_pc(&isn, pc); 362 | assert_eq!(res.len(), 1); 363 | assert_eq!(res[0], 0x420022ba); 364 | } 365 | 366 | #[test] 367 | fn test_branching_compressed_beqz() { 368 | let pc = 0x420003c4; 369 | let isn = [0x7d, 0xd9]; 370 | 371 | let res = estimate_next_inferable_pc(&isn, pc); 372 | assert_eq!(res.len(), 2); 373 | assert_eq!(res[0], 0x420003c6); 374 | assert_eq!(res[1], 0x420003ba); 375 | } 376 | 377 | #[test] 378 | fn test_branching_compressed_beqz2() { 379 | let pc = 0x420004f4; 380 | let isn = [0x11, 0xc9]; 381 | 382 | let res = estimate_next_inferable_pc(&isn, pc); 383 | assert_eq!(res.len(), 2); 384 | assert_eq!(res[0], 0x420004f6); 385 | assert_eq!(res[1], 0x42000508); 386 | } 387 | 388 | #[test] 389 | fn test_branching_compressed_beqz3() { 390 | let pc = 0x42002dda; 391 | let isn = [0xd5, 0xcc]; 392 | 393 | assert_eq!(true, is_inferable_branch(&isn)); 394 | assert_eq!(false, is_uninferable_branch(&isn)); 395 | 396 | let res = estimate_next_inferable_pc(&isn, pc); 397 | assert_eq!(res.len(), 2); 398 | assert_eq!(res[0], 0x42002ddc); 399 | assert_eq!(res[1], 0x42002e96); 400 | } 401 | 402 | #[test] 403 | fn test_uncompressed_j() { 404 | let pc = 0x40000058; 405 | let isn = [0x6f, 0x20, 0x32, 0x48]; 406 | 407 | assert_eq!(false, is_inferable_branch(&isn)); 408 | assert_eq!(false, is_uninferable_branch(&isn)); 409 | assert_eq!(true, is_inferable_jump(&isn)); 410 | 411 | let res = estimate_next_inferable_pc(&isn, pc); 412 | assert_eq!(res.len(), 1); 413 | assert_eq!(res[0], 0x40022cda); 414 | } 415 | -------------------------------------------------------------------------------- /example-esp32h2/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "basic-toml" 7 | version = "0.1.6" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "24c12265665aebaa236af9bbe266681bcc9c5666192119e3d8335cf083aca26f" 10 | dependencies = [ 11 | "serde", 12 | ] 13 | 14 | [[package]] 15 | name = "bit_field" 16 | version = "0.10.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" 19 | 20 | [[package]] 21 | name = "bitfield" 22 | version = "0.14.0" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" 25 | 26 | [[package]] 27 | name = "bitflags" 28 | version = "2.4.1" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 31 | 32 | [[package]] 33 | name = "cfg-if" 34 | version = "1.0.0" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 37 | 38 | [[package]] 39 | name = "critical-section" 40 | version = "1.1.2" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 43 | 44 | [[package]] 45 | name = "darling" 46 | version = "0.20.3" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" 49 | dependencies = [ 50 | "darling_core", 51 | "darling_macro", 52 | ] 53 | 54 | [[package]] 55 | name = "darling_core" 56 | version = "0.20.3" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" 59 | dependencies = [ 60 | "fnv", 61 | "ident_case", 62 | "proc-macro2", 63 | "quote", 64 | "strsim", 65 | "syn 2.0.38", 66 | ] 67 | 68 | [[package]] 69 | name = "darling_macro" 70 | version = "0.20.3" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" 73 | dependencies = [ 74 | "darling_core", 75 | "quote", 76 | "syn 2.0.38", 77 | ] 78 | 79 | [[package]] 80 | name = "embedded-dma" 81 | version = "0.2.0" 82 | source = "registry+https://github.com/rust-lang/crates.io-index" 83 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 84 | dependencies = [ 85 | "stable_deref_trait", 86 | ] 87 | 88 | [[package]] 89 | name = "embedded-hal" 90 | version = "0.2.7" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 93 | dependencies = [ 94 | "nb 0.1.3", 95 | "void", 96 | ] 97 | 98 | [[package]] 99 | name = "embedded-io" 100 | version = "0.5.0" 101 | source = "registry+https://github.com/rust-lang/crates.io-index" 102 | checksum = "658bbadc628dc286b9ae02f0cb0f5411c056eb7487b72f0083203f115de94060" 103 | 104 | [[package]] 105 | name = "equivalent" 106 | version = "1.0.1" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 109 | 110 | [[package]] 111 | name = "esp-backtrace" 112 | version = "0.9.0" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | checksum = "50f1f532fb2f820e2eeb7e5c7d479cdb8bdd939fe5d5a33c511e94371b0667ae" 115 | dependencies = [ 116 | "esp-println", 117 | ] 118 | 119 | [[package]] 120 | name = "esp-hal-common" 121 | version = "0.12.0" 122 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 123 | dependencies = [ 124 | "basic-toml", 125 | "bitfield", 126 | "bitflags", 127 | "cfg-if", 128 | "critical-section", 129 | "embedded-dma", 130 | "embedded-hal", 131 | "embedded-io", 132 | "esp-hal-procmacros", 133 | "esp-riscv-rt", 134 | "esp32h2", 135 | "fugit", 136 | "nb 1.1.0", 137 | "paste", 138 | "riscv-atomic-emulation-trap", 139 | "serde", 140 | "strum", 141 | "void", 142 | ] 143 | 144 | [[package]] 145 | name = "esp-hal-procmacros" 146 | version = "0.6.1" 147 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 148 | dependencies = [ 149 | "darling", 150 | "litrs", 151 | "proc-macro-crate", 152 | "proc-macro-error", 153 | "proc-macro2", 154 | "quote", 155 | "syn 2.0.38", 156 | ] 157 | 158 | [[package]] 159 | name = "esp-println" 160 | version = "0.7.0" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "b19cdfb99dbc557daae2052fc6b16a0ee441419f9f4b77b20131c9d62e236ba4" 163 | dependencies = [ 164 | "critical-section", 165 | ] 166 | 167 | [[package]] 168 | name = "esp-riscv-rt" 169 | version = "0.5.0" 170 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 171 | dependencies = [ 172 | "riscv", 173 | "riscv-rt-macros", 174 | ] 175 | 176 | [[package]] 177 | name = "esp32h2" 178 | version = "0.3.0" 179 | source = "git+https://github.com/esp-rs/esp-pacs?rev=1b1ce7b#1b1ce7ba631cb349a8255f5959e768d5c52fad40" 180 | dependencies = [ 181 | "critical-section", 182 | "vcell", 183 | ] 184 | 185 | [[package]] 186 | name = "esp32h2-hal" 187 | version = "0.3.0" 188 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 189 | dependencies = [ 190 | "esp-hal-common", 191 | ] 192 | 193 | [[package]] 194 | name = "example-esp32h2" 195 | version = "0.1.0" 196 | dependencies = [ 197 | "esp-backtrace", 198 | "esp-println", 199 | "esp32h2-hal", 200 | ] 201 | 202 | [[package]] 203 | name = "fnv" 204 | version = "1.0.7" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 207 | 208 | [[package]] 209 | name = "fugit" 210 | version = "0.3.7" 211 | source = "registry+https://github.com/rust-lang/crates.io-index" 212 | checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" 213 | dependencies = [ 214 | "gcd", 215 | ] 216 | 217 | [[package]] 218 | name = "gcd" 219 | version = "2.3.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" 222 | 223 | [[package]] 224 | name = "hashbrown" 225 | version = "0.14.2" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" 228 | 229 | [[package]] 230 | name = "heck" 231 | version = "0.4.1" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 234 | 235 | [[package]] 236 | name = "ident_case" 237 | version = "1.0.1" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 240 | 241 | [[package]] 242 | name = "indexmap" 243 | version = "2.0.2" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" 246 | dependencies = [ 247 | "equivalent", 248 | "hashbrown", 249 | ] 250 | 251 | [[package]] 252 | name = "litrs" 253 | version = "0.4.1" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" 256 | dependencies = [ 257 | "proc-macro2", 258 | ] 259 | 260 | [[package]] 261 | name = "memchr" 262 | version = "2.6.4" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 265 | 266 | [[package]] 267 | name = "nb" 268 | version = "0.1.3" 269 | source = "registry+https://github.com/rust-lang/crates.io-index" 270 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 271 | dependencies = [ 272 | "nb 1.1.0", 273 | ] 274 | 275 | [[package]] 276 | name = "nb" 277 | version = "1.1.0" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 280 | 281 | [[package]] 282 | name = "paste" 283 | version = "1.0.14" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 286 | 287 | [[package]] 288 | name = "proc-macro-crate" 289 | version = "2.0.0" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" 292 | dependencies = [ 293 | "toml_edit", 294 | ] 295 | 296 | [[package]] 297 | name = "proc-macro-error" 298 | version = "1.0.4" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 301 | dependencies = [ 302 | "proc-macro-error-attr", 303 | "proc-macro2", 304 | "quote", 305 | "syn 1.0.109", 306 | "version_check", 307 | ] 308 | 309 | [[package]] 310 | name = "proc-macro-error-attr" 311 | version = "1.0.4" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 314 | dependencies = [ 315 | "proc-macro2", 316 | "quote", 317 | "version_check", 318 | ] 319 | 320 | [[package]] 321 | name = "proc-macro2" 322 | version = "1.0.69" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 325 | dependencies = [ 326 | "unicode-ident", 327 | ] 328 | 329 | [[package]] 330 | name = "quote" 331 | version = "1.0.33" 332 | source = "registry+https://github.com/rust-lang/crates.io-index" 333 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 334 | dependencies = [ 335 | "proc-macro2", 336 | ] 337 | 338 | [[package]] 339 | name = "riscv" 340 | version = "0.10.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "aa3145d2fae3778b1e31ec2e827b228bdc6abd9b74bb5705ba46dcb82069bc4f" 343 | dependencies = [ 344 | "bit_field", 345 | "critical-section", 346 | "embedded-hal", 347 | ] 348 | 349 | [[package]] 350 | name = "riscv-atomic-emulation-trap" 351 | version = "0.4.1" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "7979127070e70f34c0ad6cc5a3a13f09af8dab1e9e154c396eb818f478504143" 354 | 355 | [[package]] 356 | name = "riscv-rt-macros" 357 | version = "0.2.0" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "f38509d7b17c2f604ceab3e5ff8ac97bb8cd2f544688c512be75c715edaf4daf" 360 | dependencies = [ 361 | "proc-macro2", 362 | "quote", 363 | "syn 1.0.109", 364 | ] 365 | 366 | [[package]] 367 | name = "rustversion" 368 | version = "1.0.14" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 371 | 372 | [[package]] 373 | name = "serde" 374 | version = "1.0.190" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" 377 | dependencies = [ 378 | "serde_derive", 379 | ] 380 | 381 | [[package]] 382 | name = "serde_derive" 383 | version = "1.0.190" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" 386 | dependencies = [ 387 | "proc-macro2", 388 | "quote", 389 | "syn 2.0.38", 390 | ] 391 | 392 | [[package]] 393 | name = "stable_deref_trait" 394 | version = "1.2.0" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 397 | 398 | [[package]] 399 | name = "strsim" 400 | version = "0.10.0" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 403 | 404 | [[package]] 405 | name = "strum" 406 | version = "0.25.0" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" 409 | dependencies = [ 410 | "strum_macros", 411 | ] 412 | 413 | [[package]] 414 | name = "strum_macros" 415 | version = "0.25.3" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" 418 | dependencies = [ 419 | "heck", 420 | "proc-macro2", 421 | "quote", 422 | "rustversion", 423 | "syn 2.0.38", 424 | ] 425 | 426 | [[package]] 427 | name = "syn" 428 | version = "1.0.109" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 431 | dependencies = [ 432 | "proc-macro2", 433 | "quote", 434 | "unicode-ident", 435 | ] 436 | 437 | [[package]] 438 | name = "syn" 439 | version = "2.0.38" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 442 | dependencies = [ 443 | "proc-macro2", 444 | "quote", 445 | "unicode-ident", 446 | ] 447 | 448 | [[package]] 449 | name = "toml_datetime" 450 | version = "0.6.5" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" 453 | 454 | [[package]] 455 | name = "toml_edit" 456 | version = "0.20.5" 457 | source = "registry+https://github.com/rust-lang/crates.io-index" 458 | checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" 459 | dependencies = [ 460 | "indexmap", 461 | "toml_datetime", 462 | "winnow", 463 | ] 464 | 465 | [[package]] 466 | name = "unicode-ident" 467 | version = "1.0.12" 468 | source = "registry+https://github.com/rust-lang/crates.io-index" 469 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 470 | 471 | [[package]] 472 | name = "vcell" 473 | version = "0.1.3" 474 | source = "registry+https://github.com/rust-lang/crates.io-index" 475 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 476 | 477 | [[package]] 478 | name = "version_check" 479 | version = "0.9.4" 480 | source = "registry+https://github.com/rust-lang/crates.io-index" 481 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 482 | 483 | [[package]] 484 | name = "void" 485 | version = "1.0.2" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 488 | 489 | [[package]] 490 | name = "winnow" 491 | version = "0.5.17" 492 | source = "registry+https://github.com/rust-lang/crates.io-index" 493 | checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" 494 | dependencies = [ 495 | "memchr", 496 | ] 497 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aho-corasick" 13 | version = "1.1.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 16 | dependencies = [ 17 | "memchr", 18 | ] 19 | 20 | [[package]] 21 | name = "anstream" 22 | version = "0.6.4" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" 25 | dependencies = [ 26 | "anstyle", 27 | "anstyle-parse", 28 | "anstyle-query", 29 | "anstyle-wincon", 30 | "colorchoice", 31 | "utf8parse", 32 | ] 33 | 34 | [[package]] 35 | name = "anstyle" 36 | version = "1.0.4" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" 39 | 40 | [[package]] 41 | name = "anstyle-parse" 42 | version = "0.2.2" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" 45 | dependencies = [ 46 | "utf8parse", 47 | ] 48 | 49 | [[package]] 50 | name = "anstyle-query" 51 | version = "1.0.0" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" 54 | dependencies = [ 55 | "windows-sys", 56 | ] 57 | 58 | [[package]] 59 | name = "anstyle-wincon" 60 | version = "3.0.1" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" 63 | dependencies = [ 64 | "anstyle", 65 | "windows-sys", 66 | ] 67 | 68 | [[package]] 69 | name = "bitflags" 70 | version = "2.4.1" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 73 | 74 | [[package]] 75 | name = "byteorder" 76 | version = "1.5.0" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 79 | 80 | [[package]] 81 | name = "cfg-if" 82 | version = "1.0.0" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 85 | 86 | [[package]] 87 | name = "clap" 88 | version = "4.4.6" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" 91 | dependencies = [ 92 | "clap_builder", 93 | "clap_derive", 94 | ] 95 | 96 | [[package]] 97 | name = "clap_builder" 98 | version = "4.4.6" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" 101 | dependencies = [ 102 | "anstream", 103 | "anstyle", 104 | "clap_lex", 105 | "strsim", 106 | ] 107 | 108 | [[package]] 109 | name = "clap_derive" 110 | version = "4.4.2" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" 113 | dependencies = [ 114 | "heck", 115 | "proc-macro2", 116 | "quote", 117 | "syn 2.0.38", 118 | ] 119 | 120 | [[package]] 121 | name = "clap_lex" 122 | version = "0.5.1" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" 125 | 126 | [[package]] 127 | name = "colorchoice" 128 | version = "1.0.0" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 131 | 132 | [[package]] 133 | name = "crc32fast" 134 | version = "1.3.2" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 137 | dependencies = [ 138 | "cfg-if", 139 | ] 140 | 141 | [[package]] 142 | name = "env_logger" 143 | version = "0.10.0" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" 146 | dependencies = [ 147 | "humantime", 148 | "is-terminal", 149 | "log", 150 | "regex", 151 | "termcolor", 152 | ] 153 | 154 | [[package]] 155 | name = "errno" 156 | version = "0.3.5" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" 159 | dependencies = [ 160 | "libc", 161 | "windows-sys", 162 | ] 163 | 164 | [[package]] 165 | name = "esp-trace-decoder" 166 | version = "0.1.0" 167 | dependencies = [ 168 | "clap", 169 | "log", 170 | "object", 171 | "pretty_env_logger", 172 | ] 173 | 174 | [[package]] 175 | name = "flate2" 176 | version = "1.0.28" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 179 | dependencies = [ 180 | "crc32fast", 181 | "miniz_oxide", 182 | ] 183 | 184 | [[package]] 185 | name = "heck" 186 | version = "0.4.1" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 189 | 190 | [[package]] 191 | name = "hermit-abi" 192 | version = "0.3.3" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" 195 | 196 | [[package]] 197 | name = "humantime" 198 | version = "2.1.0" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 201 | 202 | [[package]] 203 | name = "is-terminal" 204 | version = "0.4.9" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" 207 | dependencies = [ 208 | "hermit-abi", 209 | "rustix", 210 | "windows-sys", 211 | ] 212 | 213 | [[package]] 214 | name = "libc" 215 | version = "0.2.149" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" 218 | 219 | [[package]] 220 | name = "linux-raw-sys" 221 | version = "0.4.10" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" 224 | 225 | [[package]] 226 | name = "log" 227 | version = "0.4.20" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 230 | 231 | [[package]] 232 | name = "memchr" 233 | version = "2.6.4" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 236 | 237 | [[package]] 238 | name = "miniz_oxide" 239 | version = "0.7.1" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 242 | dependencies = [ 243 | "adler", 244 | ] 245 | 246 | [[package]] 247 | name = "object" 248 | version = "0.32.1" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" 251 | dependencies = [ 252 | "flate2", 253 | "memchr", 254 | "ruzstd", 255 | ] 256 | 257 | [[package]] 258 | name = "pretty_env_logger" 259 | version = "0.5.0" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" 262 | dependencies = [ 263 | "env_logger", 264 | "log", 265 | ] 266 | 267 | [[package]] 268 | name = "proc-macro2" 269 | version = "1.0.69" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 272 | dependencies = [ 273 | "unicode-ident", 274 | ] 275 | 276 | [[package]] 277 | name = "quote" 278 | version = "1.0.33" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 281 | dependencies = [ 282 | "proc-macro2", 283 | ] 284 | 285 | [[package]] 286 | name = "regex" 287 | version = "1.10.2" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 290 | dependencies = [ 291 | "aho-corasick", 292 | "memchr", 293 | "regex-automata", 294 | "regex-syntax", 295 | ] 296 | 297 | [[package]] 298 | name = "regex-automata" 299 | version = "0.4.3" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 302 | dependencies = [ 303 | "aho-corasick", 304 | "memchr", 305 | "regex-syntax", 306 | ] 307 | 308 | [[package]] 309 | name = "regex-syntax" 310 | version = "0.8.2" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 313 | 314 | [[package]] 315 | name = "rustix" 316 | version = "0.38.19" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" 319 | dependencies = [ 320 | "bitflags", 321 | "errno", 322 | "libc", 323 | "linux-raw-sys", 324 | "windows-sys", 325 | ] 326 | 327 | [[package]] 328 | name = "ruzstd" 329 | version = "0.4.0" 330 | source = "registry+https://github.com/rust-lang/crates.io-index" 331 | checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" 332 | dependencies = [ 333 | "byteorder", 334 | "thiserror-core", 335 | "twox-hash", 336 | ] 337 | 338 | [[package]] 339 | name = "static_assertions" 340 | version = "1.1.0" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 343 | 344 | [[package]] 345 | name = "strsim" 346 | version = "0.10.0" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 349 | 350 | [[package]] 351 | name = "syn" 352 | version = "1.0.109" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 355 | dependencies = [ 356 | "proc-macro2", 357 | "quote", 358 | "unicode-ident", 359 | ] 360 | 361 | [[package]] 362 | name = "syn" 363 | version = "2.0.38" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 366 | dependencies = [ 367 | "proc-macro2", 368 | "quote", 369 | "unicode-ident", 370 | ] 371 | 372 | [[package]] 373 | name = "termcolor" 374 | version = "1.3.0" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" 377 | dependencies = [ 378 | "winapi-util", 379 | ] 380 | 381 | [[package]] 382 | name = "thiserror-core" 383 | version = "1.0.38" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" 386 | dependencies = [ 387 | "thiserror-core-impl", 388 | ] 389 | 390 | [[package]] 391 | name = "thiserror-core-impl" 392 | version = "1.0.38" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" 395 | dependencies = [ 396 | "proc-macro2", 397 | "quote", 398 | "syn 1.0.109", 399 | ] 400 | 401 | [[package]] 402 | name = "twox-hash" 403 | version = "1.6.3" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" 406 | dependencies = [ 407 | "cfg-if", 408 | "static_assertions", 409 | ] 410 | 411 | [[package]] 412 | name = "unicode-ident" 413 | version = "1.0.12" 414 | source = "registry+https://github.com/rust-lang/crates.io-index" 415 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 416 | 417 | [[package]] 418 | name = "utf8parse" 419 | version = "0.2.1" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 422 | 423 | [[package]] 424 | name = "winapi" 425 | version = "0.3.9" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 428 | dependencies = [ 429 | "winapi-i686-pc-windows-gnu", 430 | "winapi-x86_64-pc-windows-gnu", 431 | ] 432 | 433 | [[package]] 434 | name = "winapi-i686-pc-windows-gnu" 435 | version = "0.4.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 438 | 439 | [[package]] 440 | name = "winapi-util" 441 | version = "0.1.6" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 444 | dependencies = [ 445 | "winapi", 446 | ] 447 | 448 | [[package]] 449 | name = "winapi-x86_64-pc-windows-gnu" 450 | version = "0.4.0" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 453 | 454 | [[package]] 455 | name = "windows-sys" 456 | version = "0.48.0" 457 | source = "registry+https://github.com/rust-lang/crates.io-index" 458 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 459 | dependencies = [ 460 | "windows-targets", 461 | ] 462 | 463 | [[package]] 464 | name = "windows-targets" 465 | version = "0.48.5" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 468 | dependencies = [ 469 | "windows_aarch64_gnullvm", 470 | "windows_aarch64_msvc", 471 | "windows_i686_gnu", 472 | "windows_i686_msvc", 473 | "windows_x86_64_gnu", 474 | "windows_x86_64_gnullvm", 475 | "windows_x86_64_msvc", 476 | ] 477 | 478 | [[package]] 479 | name = "windows_aarch64_gnullvm" 480 | version = "0.48.5" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 483 | 484 | [[package]] 485 | name = "windows_aarch64_msvc" 486 | version = "0.48.5" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 489 | 490 | [[package]] 491 | name = "windows_i686_gnu" 492 | version = "0.48.5" 493 | source = "registry+https://github.com/rust-lang/crates.io-index" 494 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 495 | 496 | [[package]] 497 | name = "windows_i686_msvc" 498 | version = "0.48.5" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 501 | 502 | [[package]] 503 | name = "windows_x86_64_gnu" 504 | version = "0.48.5" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 507 | 508 | [[package]] 509 | name = "windows_x86_64_gnullvm" 510 | version = "0.48.5" 511 | source = "registry+https://github.com/rust-lang/crates.io-index" 512 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 513 | 514 | [[package]] 515 | name = "windows_x86_64_msvc" 516 | version = "0.48.5" 517 | source = "registry+https://github.com/rust-lang/crates.io-index" 518 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 519 | -------------------------------------------------------------------------------- /example-esp32c6/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "basic-toml" 13 | version = "0.1.6" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "24c12265665aebaa236af9bbe266681bcc9c5666192119e3d8335cf083aca26f" 16 | dependencies = [ 17 | "serde", 18 | ] 19 | 20 | [[package]] 21 | name = "bit_field" 22 | version = "0.10.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" 25 | 26 | [[package]] 27 | name = "bitfield" 28 | version = "0.14.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "2d7e60934ceec538daadb9d8432424ed043a904d8e0243f3c6446bce549a46ac" 31 | 32 | [[package]] 33 | name = "bitflags" 34 | version = "2.4.1" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 37 | 38 | [[package]] 39 | name = "byteorder" 40 | version = "1.5.0" 41 | source = "registry+https://github.com/rust-lang/crates.io-index" 42 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 43 | 44 | [[package]] 45 | name = "cfg-if" 46 | version = "1.0.0" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 49 | 50 | [[package]] 51 | name = "crc32fast" 52 | version = "1.3.2" 53 | source = "registry+https://github.com/rust-lang/crates.io-index" 54 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 55 | dependencies = [ 56 | "cfg-if", 57 | ] 58 | 59 | [[package]] 60 | name = "critical-section" 61 | version = "1.1.2" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" 64 | 65 | [[package]] 66 | name = "darling" 67 | version = "0.20.3" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" 70 | dependencies = [ 71 | "darling_core", 72 | "darling_macro", 73 | ] 74 | 75 | [[package]] 76 | name = "darling_core" 77 | version = "0.20.3" 78 | source = "registry+https://github.com/rust-lang/crates.io-index" 79 | checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" 80 | dependencies = [ 81 | "fnv", 82 | "ident_case", 83 | "proc-macro2", 84 | "quote", 85 | "strsim", 86 | "syn 2.0.38", 87 | ] 88 | 89 | [[package]] 90 | name = "darling_macro" 91 | version = "0.20.3" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" 94 | dependencies = [ 95 | "darling_core", 96 | "quote", 97 | "syn 2.0.38", 98 | ] 99 | 100 | [[package]] 101 | name = "embedded-dma" 102 | version = "0.2.0" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" 105 | dependencies = [ 106 | "stable_deref_trait", 107 | ] 108 | 109 | [[package]] 110 | name = "embedded-hal" 111 | version = "0.2.7" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" 114 | dependencies = [ 115 | "nb 0.1.3", 116 | "void", 117 | ] 118 | 119 | [[package]] 120 | name = "embedded-io" 121 | version = "0.5.0" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "658bbadc628dc286b9ae02f0cb0f5411c056eb7487b72f0083203f115de94060" 124 | 125 | [[package]] 126 | name = "equivalent" 127 | version = "1.0.1" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 130 | 131 | [[package]] 132 | name = "esp-backtrace" 133 | version = "0.9.0" 134 | source = "registry+https://github.com/rust-lang/crates.io-index" 135 | checksum = "50f1f532fb2f820e2eeb7e5c7d479cdb8bdd939fe5d5a33c511e94371b0667ae" 136 | dependencies = [ 137 | "esp-println", 138 | ] 139 | 140 | [[package]] 141 | name = "esp-hal-common" 142 | version = "0.12.0" 143 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 144 | dependencies = [ 145 | "basic-toml", 146 | "bitfield", 147 | "bitflags", 148 | "cfg-if", 149 | "critical-section", 150 | "embedded-dma", 151 | "embedded-hal", 152 | "embedded-io", 153 | "esp-hal-procmacros", 154 | "esp-riscv-rt", 155 | "esp32c6", 156 | "fugit", 157 | "nb 1.1.0", 158 | "paste", 159 | "riscv-atomic-emulation-trap", 160 | "serde", 161 | "strum", 162 | "void", 163 | ] 164 | 165 | [[package]] 166 | name = "esp-hal-procmacros" 167 | version = "0.6.1" 168 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 169 | dependencies = [ 170 | "darling", 171 | "litrs", 172 | "object", 173 | "proc-macro-crate", 174 | "proc-macro-error", 175 | "proc-macro2", 176 | "quote", 177 | "syn 2.0.38", 178 | ] 179 | 180 | [[package]] 181 | name = "esp-println" 182 | version = "0.7.0" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "b19cdfb99dbc557daae2052fc6b16a0ee441419f9f4b77b20131c9d62e236ba4" 185 | dependencies = [ 186 | "critical-section", 187 | ] 188 | 189 | [[package]] 190 | name = "esp-riscv-rt" 191 | version = "0.5.0" 192 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 193 | dependencies = [ 194 | "riscv", 195 | "riscv-rt-macros", 196 | ] 197 | 198 | [[package]] 199 | name = "esp32c6" 200 | version = "0.7.0" 201 | source = "git+https://github.com/esp-rs/esp-pacs?rev=1b1ce7b#1b1ce7ba631cb349a8255f5959e768d5c52fad40" 202 | dependencies = [ 203 | "critical-section", 204 | "vcell", 205 | ] 206 | 207 | [[package]] 208 | name = "esp32c6-hal" 209 | version = "0.5.0" 210 | source = "git+https://github.com/esp-rs/esp-hal/?rev=663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6#663cbd9ce08c2cf03662f3ed294a7a4b9e7ae5d6" 211 | dependencies = [ 212 | "esp-hal-common", 213 | ] 214 | 215 | [[package]] 216 | name = "example-esp32c6" 217 | version = "0.1.0" 218 | dependencies = [ 219 | "esp-backtrace", 220 | "esp-println", 221 | "esp32c6-hal", 222 | ] 223 | 224 | [[package]] 225 | name = "flate2" 226 | version = "1.0.28" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 229 | dependencies = [ 230 | "crc32fast", 231 | "miniz_oxide", 232 | ] 233 | 234 | [[package]] 235 | name = "fnv" 236 | version = "1.0.7" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 239 | 240 | [[package]] 241 | name = "fugit" 242 | version = "0.3.7" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | checksum = "17186ad64927d5ac8f02c1e77ccefa08ccd9eaa314d5a4772278aa204a22f7e7" 245 | dependencies = [ 246 | "gcd", 247 | ] 248 | 249 | [[package]] 250 | name = "gcd" 251 | version = "2.3.0" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" 254 | 255 | [[package]] 256 | name = "hashbrown" 257 | version = "0.14.2" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" 260 | 261 | [[package]] 262 | name = "heck" 263 | version = "0.4.1" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 266 | 267 | [[package]] 268 | name = "ident_case" 269 | version = "1.0.1" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 272 | 273 | [[package]] 274 | name = "indexmap" 275 | version = "2.0.2" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" 278 | dependencies = [ 279 | "equivalent", 280 | "hashbrown", 281 | ] 282 | 283 | [[package]] 284 | name = "litrs" 285 | version = "0.4.1" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" 288 | dependencies = [ 289 | "proc-macro2", 290 | ] 291 | 292 | [[package]] 293 | name = "memchr" 294 | version = "2.6.4" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 297 | 298 | [[package]] 299 | name = "miniz_oxide" 300 | version = "0.7.1" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 303 | dependencies = [ 304 | "adler", 305 | ] 306 | 307 | [[package]] 308 | name = "nb" 309 | version = "0.1.3" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" 312 | dependencies = [ 313 | "nb 1.1.0", 314 | ] 315 | 316 | [[package]] 317 | name = "nb" 318 | version = "1.1.0" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" 321 | 322 | [[package]] 323 | name = "object" 324 | version = "0.32.1" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" 327 | dependencies = [ 328 | "flate2", 329 | "memchr", 330 | "ruzstd", 331 | ] 332 | 333 | [[package]] 334 | name = "paste" 335 | version = "1.0.14" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 338 | 339 | [[package]] 340 | name = "proc-macro-crate" 341 | version = "2.0.0" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" 344 | dependencies = [ 345 | "toml_edit", 346 | ] 347 | 348 | [[package]] 349 | name = "proc-macro-error" 350 | version = "1.0.4" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" 353 | dependencies = [ 354 | "proc-macro-error-attr", 355 | "proc-macro2", 356 | "quote", 357 | "syn 1.0.109", 358 | "version_check", 359 | ] 360 | 361 | [[package]] 362 | name = "proc-macro-error-attr" 363 | version = "1.0.4" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" 366 | dependencies = [ 367 | "proc-macro2", 368 | "quote", 369 | "version_check", 370 | ] 371 | 372 | [[package]] 373 | name = "proc-macro2" 374 | version = "1.0.69" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 377 | dependencies = [ 378 | "unicode-ident", 379 | ] 380 | 381 | [[package]] 382 | name = "quote" 383 | version = "1.0.33" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 386 | dependencies = [ 387 | "proc-macro2", 388 | ] 389 | 390 | [[package]] 391 | name = "riscv" 392 | version = "0.10.1" 393 | source = "registry+https://github.com/rust-lang/crates.io-index" 394 | checksum = "aa3145d2fae3778b1e31ec2e827b228bdc6abd9b74bb5705ba46dcb82069bc4f" 395 | dependencies = [ 396 | "bit_field", 397 | "critical-section", 398 | "embedded-hal", 399 | ] 400 | 401 | [[package]] 402 | name = "riscv-atomic-emulation-trap" 403 | version = "0.4.1" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "7979127070e70f34c0ad6cc5a3a13f09af8dab1e9e154c396eb818f478504143" 406 | 407 | [[package]] 408 | name = "riscv-rt-macros" 409 | version = "0.2.0" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "f38509d7b17c2f604ceab3e5ff8ac97bb8cd2f544688c512be75c715edaf4daf" 412 | dependencies = [ 413 | "proc-macro2", 414 | "quote", 415 | "syn 1.0.109", 416 | ] 417 | 418 | [[package]] 419 | name = "rustversion" 420 | version = "1.0.14" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 423 | 424 | [[package]] 425 | name = "ruzstd" 426 | version = "0.4.0" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" 429 | dependencies = [ 430 | "byteorder", 431 | "thiserror-core", 432 | "twox-hash", 433 | ] 434 | 435 | [[package]] 436 | name = "serde" 437 | version = "1.0.190" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" 440 | dependencies = [ 441 | "serde_derive", 442 | ] 443 | 444 | [[package]] 445 | name = "serde_derive" 446 | version = "1.0.190" 447 | source = "registry+https://github.com/rust-lang/crates.io-index" 448 | checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" 449 | dependencies = [ 450 | "proc-macro2", 451 | "quote", 452 | "syn 2.0.38", 453 | ] 454 | 455 | [[package]] 456 | name = "stable_deref_trait" 457 | version = "1.2.0" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 460 | 461 | [[package]] 462 | name = "static_assertions" 463 | version = "1.1.0" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 466 | 467 | [[package]] 468 | name = "strsim" 469 | version = "0.10.0" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 472 | 473 | [[package]] 474 | name = "strum" 475 | version = "0.25.0" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" 478 | dependencies = [ 479 | "strum_macros", 480 | ] 481 | 482 | [[package]] 483 | name = "strum_macros" 484 | version = "0.25.3" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" 487 | dependencies = [ 488 | "heck", 489 | "proc-macro2", 490 | "quote", 491 | "rustversion", 492 | "syn 2.0.38", 493 | ] 494 | 495 | [[package]] 496 | name = "syn" 497 | version = "1.0.109" 498 | source = "registry+https://github.com/rust-lang/crates.io-index" 499 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 500 | dependencies = [ 501 | "proc-macro2", 502 | "quote", 503 | "unicode-ident", 504 | ] 505 | 506 | [[package]] 507 | name = "syn" 508 | version = "2.0.38" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 511 | dependencies = [ 512 | "proc-macro2", 513 | "quote", 514 | "unicode-ident", 515 | ] 516 | 517 | [[package]] 518 | name = "thiserror-core" 519 | version = "1.0.38" 520 | source = "registry+https://github.com/rust-lang/crates.io-index" 521 | checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" 522 | dependencies = [ 523 | "thiserror-core-impl", 524 | ] 525 | 526 | [[package]] 527 | name = "thiserror-core-impl" 528 | version = "1.0.38" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" 531 | dependencies = [ 532 | "proc-macro2", 533 | "quote", 534 | "syn 1.0.109", 535 | ] 536 | 537 | [[package]] 538 | name = "toml_datetime" 539 | version = "0.6.5" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" 542 | 543 | [[package]] 544 | name = "toml_edit" 545 | version = "0.20.5" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" 548 | dependencies = [ 549 | "indexmap", 550 | "toml_datetime", 551 | "winnow", 552 | ] 553 | 554 | [[package]] 555 | name = "twox-hash" 556 | version = "1.6.3" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" 559 | dependencies = [ 560 | "cfg-if", 561 | "static_assertions", 562 | ] 563 | 564 | [[package]] 565 | name = "unicode-ident" 566 | version = "1.0.12" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 569 | 570 | [[package]] 571 | name = "vcell" 572 | version = "0.1.3" 573 | source = "registry+https://github.com/rust-lang/crates.io-index" 574 | checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" 575 | 576 | [[package]] 577 | name = "version_check" 578 | version = "0.9.4" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 581 | 582 | [[package]] 583 | name = "void" 584 | version = "1.0.2" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 587 | 588 | [[package]] 589 | name = "winnow" 590 | version = "0.5.17" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" 593 | dependencies = [ 594 | "memchr", 595 | ] 596 | --------------------------------------------------------------------------------