From a81c2727070d51f4b312ac3be1d2cbaff439a6a0 Mon Sep 17 00:00:00 2001 From: Petteri Kangaslampi Date: Tue, 27 May 2025 20:20:34 +0000 Subject: [PATCH] Also consider RO data for start of flash Take read-only data segments into account when determining where flash contents start. This is specifically important if the Tock CRT0 header is in a separate data section before the start of `.text`. --- src/convert.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/convert.rs b/src/convert.rs index 80e8830..a48d9ff 100644 --- a/src/convert.rs +++ b/src/convert.rs @@ -351,9 +351,9 @@ pub fn elf_to_tbf( continue; } - // Flash segments have to be marked executable, and we only care about + // Flash segments have to be marked read-only, and we only care about // segments that actually contain data to be loaded into flash. - if (segment.p_flags & elf::abi::PF_X) > 0 + if (segment.p_flags & elf::abi::PF_W) == 0 && section_exists_in_segment(&elf_sections, segment) { // If this is standard Tock PIC, then this virtual address will be