From 41835a7c3397cfdc3e3124061568828254bf2643 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Wed, 9 Dec 2020 17:13:08 +0100 Subject: [PATCH] dongle-flash: use program header physical address in ELF -> .hex conversion `offset` returns the offset of the section *in the ELF file* `physical_address` returns the (load) address of the section on the device these are not necessarily the same (but usually are) this part of dongle-flash is not used by the workshop participants as they'll use dongle-flash with .hex files (produced by the well-tested `objcopy` tool) --- tools/dongle-flash/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dongle-flash/src/main.rs b/tools/dongle-flash/src/main.rs index 829594b..bee2a78 100644 --- a/tools/dongle-flash/src/main.rs +++ b/tools/dongle-flash/src/main.rs @@ -56,7 +56,7 @@ if the red LED was blinking and you got this message then the device wasn't corr let mut records = vec![]; for ph in elf_file.program_iter() { if ph.get_type() == Ok(Type::Load) { - let start = ph.offset(); + let start = ph.physical_addr(); match ph.get_data(&elf_file).map_err(anyhow::Error::msg)? { SegmentData::Undefined(bytes) => {