Files
Gabriele GristinaandClaude Opus 5.5 c73cc293ad recovery: pad the AT91 bootrom to 0x102000 again
caa76f57b ("Fix pm5 recovery image") also moved the AT91 pad from
0x00102000 to 0x00104000, but the AT91 boot area is 8 KB and the OS
image starts at 0x102000. recovery.bin had every fullimage section
0x2000 too high and 0xFF at the OS entry, so a JTAG recovery would
leave the bootrom in flash mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:10:29 +01:00

68 lines
2.3 KiB
Makefile

# This Makefile might have been called directly, not via the root Makefile, so:
ifeq ($(PLTNAME),)
PLATFORM_FILE ?= ../Makefile.platform
-include $(PLATFORM_FILE)
-include ../.Makefile.options.cache
include ../common_arm/Makefile.hal
ifeq ($(PLATFORM_CHANGED), true)
$(error platform definitions have been changed, please "make clean" at the root of the project)
endif
endif
include ../common_arm/Makefile.common
INSTALLFW = recovery.bin
ifneq (,$(FWTAG))
INSTALLFWTAG = $(notdir $(INSTALLFW:%.bin=%-$(FWTAG).bin))
else
INSTALLFWTAG = $(notdir $(INSTALLFW))
endif
FWMAXSIZE = $(shell echo $$(($(PLATFORM_SIZE)*1024)))
BINS = bootrom.bin fullimage.bin $(INSTALLFW)
all: $(BINS)
@FWSIZE=$$(wc -c < $(INSTALLFW));\
if [ $$FWSIZE -gt $(FWMAXSIZE) ]; then \
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
echo "ERROR: Firmware image too large for your platform! $$FWSIZE > $(FWMAXSIZE)"; \
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
exit 1; \
fi; \
echo "==================================================================="; \
echo "Firmware size: $$FWSIZE bytes ($$((FWSIZE/1024))kb) = $$((FWSIZE*100/$(FWMAXSIZE)))% of $$(($(FWMAXSIZE)/1024))kb"; \
echo "==================================================================="
bootrom.bin: ../bootrom/obj/bootrom.elf
$(info [=] GEN $@)
ifeq ($(PLATFORM),PM5)
$(info [=] GENA $@)
$(Q)$(CROSS_OBJCOPY) --gap-fill=0xff --pad-to 0x08004000 -O binary $^ $@
else
$(info [=] GENB $@)
$(Q)$(CROSS_OBJCOPY) --gap-fill=0xff --pad-to 0x00102000 -O binary $^ $@
endif
fullimage.bin: ../armsrc/obj/fullimage.elf
$(info [=] GEN $@)
$(Q)$(CROSS_OBJCOPY) --gap-fill=0xff -O binary $^ $@
recovery.bin: bootrom.bin fullimage.bin
$(info [=] GEN $@)
$(Q)cat bootrom.bin fullimage.bin > $@
clean:
$(Q)$(RM) $(BINS)
install: all
$(info [@] Installing recovery to $(DESTDIR)$(PREFIX)...)
$(Q)$(INSTALLSUDO) $(MKDIR) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)
$(Q)$(INSTALLSUDO) $(CP) $(INSTALLFW) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
uninstall:
$(info [@] Uninstalling recovery from $(DESTDIR)$(PREFIX)...)
$(Q)$(INSTALLSUDO) $(RM) $(DESTDIR)$(PREFIX)$(PATHSEP)$(INSTALLFWRELPATH)$(PATHSEP)$(INSTALLFWTAG)
.PHONY: all clean install uninstall