summaryrefslogtreecommitdiff
path: root/firmware
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
parent3c17f28eca86ff3ee9e7cef6c4d5198c27b7c03c (diff)
downloadrockbox-8e8e978de6b6283b66a6829fa8c5e3b94674ce7d.tar.gz
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')
-rw-r--r--firmware/asm/SOURCES1
-rw-r--r--firmware/asm/asm.make27
-rw-r--r--firmware/firmware.make2
3 files changed, 30 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 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10# Collect dummy C files in firmware/asm
11ASM_DUMMY_SRC := $(notdir $(call preprocess, $(FIRMDIR)/asm/SOURCES))
12
13# Get the corresponding real source files under firmware/asm/$ARCH (C or ASM)
14ASM_C_SRC := $(addprefix $(FIRMDIR)/asm/$(ARCH)/,$(ASM_DUMMY_SRC))
15ASM_S_SRC := $(ASM_C_SRC:.c=.S)
16
17# ASM_SRC now contains only files that exist under $ARCH
18ASM_SRC := $(wildcard $(ASM_C_SRC))
19ASM_SRC += $(wildcard $(ASM_S_SRC))
20
21# GEN_SRC now contains a .c for each file in ASM_DUMMY_SRC that's not in ASM_SRC
22# I.e. fallback to a generic C source if no correspinding file in $ARCH is found
23GEN_SRC := $(filter-out $(notdir $(ASM_SRC:.S=.c)),$(ASM_DUMMY_SRC))
24GEN_SRC := $(addprefix $(FIRMDIR)/asm/,$(GEN_SRC))
25
26FIRMLIB_SRC += $(ASM_SRC)
27FIRMLIB_SRC += $(GEN_SRC)
diff --git a/firmware/firmware.make b/firmware/firmware.make
index aab735aa91..94747613ba 100644
--- a/firmware/firmware.make
+++ b/firmware/firmware.make
@@ -12,6 +12,8 @@ ifndef APP_TYPE
12INCLUDES += -I$(FIRMDIR)/libc/include 12INCLUDES += -I$(FIRMDIR)/libc/include
13endif 13endif
14 14
15include $(FIRMDIR)/asm/asm.make
16
15FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES) 17FIRMLIB_SRC += $(call preprocess, $(FIRMDIR)/SOURCES)
16FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC)) 18FIRMLIB_OBJ := $(call c2obj, $(FIRMLIB_SRC))
17ifeq (,$(findstring -DARCHOS_PLAYER,$(TARGET))) 19ifeq (,$(findstring -DARCHOS_PLAYER,$(TARGET)))