| Crates.io | srec-rs |
| lib.rs | srec-rs |
| version | 0.1.4 |
| created_at | 2025-04-28 06:15:39.837072+00 |
| updated_at | 2025-06-16 04:42:49.468945+00 |
| description | srec crate in Rust |
| homepage | |
| repository | https://github.com/TuEmb/srec-rs.git |
| max_upload_size | |
| id | 1651870 |
| size | 358,859 |
A Rust library for parsing Motorola S-Record (SREC) files and extracting memory layout and data regions.
Add to your Cargo.toml:
[dependencies]
srec-rs = { path = "." }
use std::fs::File;
use srec_rs::SRecord;
fn main() {
let file = File::open("test_data/test.srec").expect("Failed to open file");
let srec = SRecord::<0x8000>::from_srec(file);
// Print header if present
if let Some(header) = srec.get_header() {
println!("Header: {}", header);
}
// Print memory layout
for (addr, size) in srec.get_data_memory_layout() {
println!("Region: {:?}, size: {:#X}", addr, size);
}
// Access raw data
let data = srec.get_data();
println!("Total data length: {}", srec.get_data_length());
}
To run tests and see debug output:
cargo test -- --nocapture
This project is licensed under the MIT License. See LICENSE-MIT for details.
Author: TuEmb
Year: 2025