From 6f4b6a80789d8ced49ead1b3882520440d8c35b5 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 8 Jan 2026 14:40:03 +0000 Subject: [PATCH] make: remove asm.make and use asm/SOURCES directly asm.make replaces source files listed in asm/SOURCES with a corresponding .c or .S file under firmware/asm/${ARCH}. This makes it difficult to handle differences within one architecture, eg. different instruction sets or versions of the architecture. Get rid of asm.make, and instead use the preprocessor to select the architecture-specific sources directly from asm/SOURCES. This is slightly more verbose but is more flexible. Change-Id: Id2a484794d5d951b7ba7b54a552de6960414fa45 --- firmware/asm/SOURCES | 36 +++++++++++++++++++++++++++++++++++- firmware/asm/asm.make | 29 ----------------------------- firmware/firmware.make | 2 +- 3 files changed, 36 insertions(+), 31 deletions(-) delete mode 100644 firmware/asm/asm.make diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES index ebeaf49193..5aa9b1c0f7 100644 --- a/firmware/asm/SOURCES +++ b/firmware/asm/SOURCES @@ -1,11 +1,41 @@ +#if defined(CPU_ARM) +arm/ffs.S +arm/memset16.S +#elif defined(CPU_MIPS) +mips/ffs.S +memset16.c +#elif defined(CPU_COLDFIRE) +m68k/ffs.S +m68k/memset16.S +#else ffs.c memset16.c +#endif + #if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(HAVE_ROCKBOX_C_LIBRARY) +#if defined(CPU_ARM) +arm/memcpy.S +arm/memmove.S +arm/memset.S +strlen.c +#elif defined(CPU_MIPS) +mips/memcpy.S +memmove.c +mips/memset.S +strlen.c +#elif defined(CPU_COLDFIRE) +m68k/memcpy.S +m68k/memmove.S +m68k/memset.S +m68k/strlen.S +#else memcpy.c +mempcpy.c memmove.c memset.c strlen.c #endif +#endif #if defined(WIN32) || defined(APPLICATION) mempcpy.c @@ -21,6 +51,10 @@ mempcpy.c #if LCD_DEPTH >= 24 lcd-as-memframe-24bit.c #else +#if defined(CPU_ARM) +arm/lcd-as-memframe.S +#else lcd-as-memframe.c -#endif +#endif /* CPU_ARM */ +#endif /* LCD_DEPTH */ #endif diff --git a/firmware/asm/asm.make b/firmware/asm/asm.make deleted file mode 100644 index 9cd134ec54..0000000000 --- a/firmware/asm/asm.make +++ /dev/null @@ -1,29 +0,0 @@ -# __________ __ ___. -# Open \______ \ ____ ____ | | _\_ |__ _______ ___ -# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -# \/ \/ \/ \/ \/ -# $Id$ -# - -# Collect dummy C files in firmware/asm -ASM_DUMMY_SRC := $(notdir $(call preprocess, $(FIRMDIR)/asm/SOURCES)) - -# Get the corresponding real source files under firmware/asm/$ARCH (C or ASM) -# strip arch_ prefix from $(ARCH) -ASM_ARCH := $(subst arch_,,$(ARCH)) -ASM_C_SRC := $(addprefix $(FIRMDIR)/asm/$(ASM_ARCH)/,$(ASM_DUMMY_SRC)) -ASM_S_SRC := $(ASM_C_SRC:.c=.S) - -# ASM_SRC now contains only files that exist under $ARCH -ASM_SRC := $(wildcard $(ASM_C_SRC)) -ASM_SRC += $(wildcard $(ASM_S_SRC)) - -# GEN_SRC now contains a .c for each file in ASM_DUMMY_SRC that's not in ASM_SRC -# I.e. fallback to a generic C source if no corresponding file in $ARCH is found -GEN_SRC := $(filter-out $(notdir $(ASM_SRC:.S=.c)),$(ASM_DUMMY_SRC)) -GEN_SRC := $(addprefix $(FIRMDIR)/asm/,$(GEN_SRC)) - -FIRMLIB_SRC += $(ASM_SRC) -FIRMLIB_SRC += $(GEN_SRC) diff --git a/firmware/firmware.make b/firmware/firmware.make index 98c2c3bb27..5215d7226a 100644 --- a/firmware/firmware.make +++ b/firmware/firmware.make @@ -13,11 +13,11 @@ ifndef APP_TYPE INCLUDES += -I$(FIRMDIR)/libc/include endif -include $(FIRMDIR)/asm/asm.make ifneq ($(filter reggen,$(TOOLSET)),) include $(FIRMDIR)/reggen/reggen.make endif +FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/asm/SOURCES) FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) FIRMLIB_OBJ += $(BUILDDIR)/sysfont.o