summaryrefslogtreecommitdiffstats
path: root/firmware/asm
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2012-01-07 19:49:02 +0100
committerThomas Martitz <kugel@rockbox.org>2012-01-22 18:46:45 +0100
commit8e8e978de6b6283b66a6829fa8c5e3b94674ce7d (patch)
treea9b9e3dfe05653f44fdf9e51c214428371d52a31 /firmware/asm
parent3c17f28eca86ff3ee9e7cef6c4d5198c27b7c03c (diff)
downloadrockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.tar.gz
rockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.tar.bz2
rockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.zip
Add framework to let make automatically pick optimized asm implementations over generic C ones to firmware.
Example: for a file asm/foo.c, make will look for asm/arm/foo.[cS] and compile it if found. If not found it'll fall back to asm/foo.c. Also introduce new ARCH make variable. This is automatically detected by configure. It is distinct from CPU since CPU defines the dir used for the target tree (i.e. firmware/target/X, so it can be "hosted"). ARCH really has the target isa and can be x86 for sims/raaa too. Change-Id: I18e5d2b7b7bbc2ad2be551a74a0fcae5ffbcbf8b
Diffstat (limited to 'firmware/asm')
-rw-r--r--firmware/asm/SOURCES1
-rw-r--r--firmware/asm/asm.make27
2 files changed, 28 insertions, 0 deletions
diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/firmware/asm/SOURCES
@@ -0,0 +1 @@
+
diff --git a/firmware/asm/asm.make b/firmware/asm/asm.make
new file mode 100644
index 0000000000..410cb6ca11
--- /dev/null
+++ b/firmware/asm/asm.make
@@ -0,0 +1,27 @@
+# __________ __ ___.
+# 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)
+ASM_C_SRC := $(addprefix $(FIRMDIR)/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 correspinding 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)