Update the Makefile support for ARM

This commit is contained in:
dxl authored and Philippe Teuwen committed 2026-08-19 15:51:53 +02:00
1 parent 0191fb78ec
commit d286946d0f
6 files changed
+264 -26

No files matched your search

+42 -10
View File
@@ -17,13 +17,39 @@
# Makefile for bootrom, see ../common_arm/Makefile.common for common settings
#-----------------------------------------------------------------------------
# Proxmark5 requires armlib.
include ../armlib/Exports.mk
# HAL for platform
ifeq ($(PLATFORM),PM5)
SRC_SYS = sys_hw_at32.c
SRC_TICKS = ticks_hw_at32.c
SRC_GPIO = gpio_hw_at32.c
SRC_USB_CDC = usb_cdc_at32.c
SRC_FLASH_CODE = flash_code_hw_at32.c
SRC_FLASH_DATA = flashmem_hw_at32.c
SRC_STARTUP = flash-reset-at32.s ram-reset-at32.s
LD_SCRIPT = ldscript-flash-at32
APP_CFLAGS += -mcpu=cortex-m4 -DPM5
CROSS_LDFLAGS += -mcpu=cortex-m4
ARMLIB_OBJ = $(OBJDIR)/$(ARMLIB_EXPORT_LIBNAME)
LIBS += $(ARMLIB_OBJ)
else
SRC_SYS = sys_hw_at91.c
SRC_TICKS = ticks_hw_at91.c
SRC_GPIO = gpio_hw_at91.c
SRC_USB_CDC = usb_cdc_at91.c
SRC_FLASH_CODE = flash_code_hw_at91.c
SRC_FLASH_DATA = flashmem_hw_at91.c
SRC_STARTUP = flash-reset-at91.s ram-reset-at91.s
LD_SCRIPT = ldscript-flash-at91
endif
# DO NOT use thumb mode in the phase 1 bootloader since that generates a section with glue code
ARMSRC =
THUMBSRC = usb_cdc.c \
clocks.c \
bootrom.c
THUMBSRC = bootrom.c $(SRC_SYS) $(SRC_TICKS) $(SRC_GPIO) $(SRC_USB_CDC) $(SRC_FLASH_CODE) usb_cdc_desc.c
ASMSRC = ram-reset.s flash-reset.s
ASMSRC = $(SRC_STARTUP)
VERSIONSRC = version_pm3.c
## There is a strange bug with the linker: Sometimes it will not emit the glue to call
@@ -34,18 +60,18 @@ VERSIONSRC = version_pm3.c
# THUMBSRC :=
# stdint.h provided locally until GCC 4.5 becomes C99 compliant
APP_CFLAGS = -I. -DAS_BOOTROM
APP_CFLAGS += -I. -DAS_BOOTROM
# no-common makes sure uninitialized vars don't end up in COMMON area
APP_CFLAGS += -fno-common
# For PM5, armlib is required
APP_CFLAGS += $(ARMLIB_EXPORT_CFLAGS)
ifneq (,$(findstring WITH_FLASH,$(PLATFORM_DEFS)))
APP_CFLAGS += -DWITH_FLASH
APP_CFLAGS += -I../common_arm
THUMBSRC += flashmem.c ticks.c
THUMBSRC += ticks_core.c flashmem_core.c $(SRC_FLASH_DATA)
endif
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}SRC
include ../common_arm/Makefile.common
@@ -67,10 +93,16 @@ tarbin: $(OBJS)
$(info [=] GEN $@)
$(Q)$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(OBJS:%=bootrom/%) $(OBJS:%.s19=bootrom/%.elf)
$(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ)
ifeq ($(PLATFORM),PM5)
$(ARMLIB_OBJ):
$(info [=] MAKE $(notdir $@))
@$(MAKE) --no-print-directory -f ../armlib/Makefile
endif
$(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ) $(ARMLIB_OBJ)
$(info [=] LD $@)
# Using -T instead of -Wl,-T is needed to prevent the linker from using the default ldscript when using picolibc instead of newlib
$(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -T ldscript-flash -Wl,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
$(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -T $(LD_SCRIPT) -Wl,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
clean:
$(Q)$(RM) $(OBJDIR)$(PATHSEP)*.o