From 598dd943ccb88bc9632cb6556c30f1366b8e51fe Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Wed, 20 Nov 2024 15:12:00 +0000 Subject: [PATCH] Handle XIP_SRAM binaries with no vtor --- main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index a2e2056..2f975aa 100644 --- a/main.cpp +++ b/main.cpp @@ -4600,7 +4600,14 @@ void sign_guts_elf(elf_file* elf, private_t private_key, public_t public_key) { std::shared_ptr entry_point = new_block.get_item(); if (entry_point == nullptr) { std::shared_ptr vtor = new_block.get_item(); - uint32_t vtor_loc = elf->header().entry < SRAM_START ? 0x10000000 : 0x20000000; + uint32_t vtor_loc = 0x10000000; + if (elf->header().entry >= SRAM_START) { + vtor_loc = 0x20000000; + } else if (elf->header().entry >= XIP_SRAM_START_RP2350) { + vtor_loc = 0x13ffc000; + } else { + vtor_loc = 0x10000000; + } if (vtor != nullptr) { vtor_loc = vtor->addr; } else {