This is an automated email from Gerrit. "Sergi Granell Escalfet <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9603
-- gerrit commit cf5d6435fdfeb71dfb54bcf47b14913b549a7ac5 Author: Sergi Granell Escalfet <[email protected]> Date: Tue Apr 28 12:04:16 2026 +0900 tcl/target/xilinx_zynqmp: fix ELF loading in boot_apu and boot_pmu boot_apu and boot_pmu passed $addr as a relocation offset to load_image. For raw binaries this correctly places the image at $addr, but for address-aware formats (ELF, IHEX, S19) it shifts every segment by $addr on top of the addresses already embedded in the image. Use load_image_info to detect the image type and only pass the address offset for binary images. For address-aware formats call load_image without an offset so segments land at their correct addresses. For boot_apu, use the entry address from image metadata when available (ELF e_entry, IHEX record type 05) and fall back to $addr otherwise. For boot_pmu, emit a warning if the image carries an entry address outside PMU RAM [PMU_RAM_BASE, PMU_RAM_BASE + PMU_RAM_SIZE), since the PMU ROM always jumps to PMU_RAM_BASE regardless. Change-Id: I5177dc59322549eafe03a78a984390300fbab0db Signed-off-by: Sergi Granell Escalfet <[email protected]> diff --git a/tcl/target/xilinx_zynqmp.cfg b/tcl/target/xilinx_zynqmp.cfg index e8224be043..26749b6305 100644 --- a/tcl/target/xilinx_zynqmp.cfg +++ b/tcl/target/xilinx_zynqmp.cfg @@ -130,6 +130,7 @@ set PMU_GLOBAL_FW_IS_PRESENT [BIT 4] set PMU_GLOBAL_DONT_SLEEP [BIT 0] set PMU_RAM_BASE 0xffdc0000 +set PMU_RAM_SIZE 0x20000 set OCM_RAM_BASE 0xfffc0000 @@ -220,8 +221,22 @@ add_help_text boot_pmu "Boot the PMU with a given firmware image, loading it\ after we resume it." proc boot_pmu {image} { halt_pmu - echo "Info : Loading PMU firmware $image to $::PMU_RAM_BASE" - load_image $image $::PMU_RAM_BASE + set info [load_image_info $image] + if {[dict get $info type] eq "binary"} { + echo "Info : Loading PMU firmware $image to $::PMU_RAM_BASE" + load_image $image $::PMU_RAM_BASE bin + } else { + if {[dict exists $info entry_address]} { + set entry [dict get $info entry_address] + if {$entry < $::PMU_RAM_BASE || $entry >= $::PMU_RAM_BASE + $::PMU_RAM_SIZE} { + echo "Warn : PMU firmware entry point ($entry) is outside PMU RAM\ + ($::PMU_RAM_BASE + $::PMU_RAM_SIZE); PMU ROM will execute\ + from $::PMU_RAM_BASE regardless" + } + } + echo "Info : Loading PMU firmware $image" + load_image $image + } resume_pmu } @@ -234,7 +249,20 @@ proc boot_apu [list image {apu 0} [list addr $OCM_RAM_BASE]] { targets $::_TARGETNAME.$apu halt - echo "Info : Loading APU$apu firmware $image to $addr" - load_image $image $addr - resume $addr + set info [load_image_info $image] + if {[dict get $info type] eq "binary"} { + echo "Info : Loading APU$apu firmware $image to $addr, resuming at $addr" + load_image $image $addr bin + resume $addr + } else { + if {[dict exists $info entry_address]} { + set entry [dict get $info entry_address] + echo "Info : Loading APU$apu firmware $image, resuming at image entry point $entry" + } else { + set entry $addr + echo "Info : Loading APU$apu firmware $image, resuming at $addr (no entry point in image)" + } + load_image $image + resume $entry + } } --
