summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-06-03 17:08:20 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-06-03 17:08:20 +1000
commiteef619c3896af87edd776f174bcd704aa7a1d262 (patch)
tree754cb757a42cd3fa2e5596592f90db3879656be1 /Makefile
parent3d530160957d3818a4160e433afbbf47e3893a12 (diff)
downloadcf-fsi-eef619c3896af87edd776f174bcd704aa7a1d262.tar.gz
cf-fsi-eef619c3896af87edd776f174bcd704aa7a1d262.zip
Changes to be able to build multiple firmwares
Change to use the C preprocessor (use the ARM one for that) for asm files so we can force-include a per-machine GPIO definition file and use some preprocessor macros to define the cache registers. This allows us to deal with the cases where the clock and data use a different cache vs. the same cache. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 36 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index a75f0a1..fc462b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,27 +1,53 @@
+# Main debug switch
+DEBUG ?= 0
+
+# ARM compiler for userspace test code
+CROSS_COMPILE ?= arm-linux-
+CC = $(CROSS_COMPILE)gcc
+CFLAGS = -Wall -Os
+
+# M68K toolchain for CF firmware
M68KCROSS ?= /opt/cross/binutils-coldfire/bin/m68k-unknown-elf-
M68KAS=$(M68KCROSS)as
M68KLD=$(M68KCROSS)ld
M68KOC=$(M68KCROSS)objcopy
-CC = $(CROSS_COMPILE)gcc
-CFLAGS = -Wall -Os
+ifeq ($(DEBUG),1)
+M68KCPPFLAGS = -DENABLE_TRACE
+endif
+M68KAFLAGS = -march=isac
+M68KLDFLAGS = -Ttext 0
+
+# FW code files
+TARGET_DEFS = $(wildcard cf-code/*.h)
+TARGETS_s = $(patsubst %.h,%.s,$(TARGET_DEFS))
+TARGETS_o = $(patsubst %.h,%.o,$(TARGET_DEFS))
+TARGETS_elf = $(patsubst %.elf,%.o,$(TARGET_DEFS))
+TARGETS_bin = $(patsubst %.bin,%.o,$(TARGET_DEFS))
-all: cf-fsi-test
+all: $(TARGETS_bin) cf-fsi-test
-cf-code.o : cf-code.s
- $(M68KAS) -march=isac $^ -o $@
+cf-code/%.s : cf-code/%.h cf-code/cf-fsi-fw.S
+ $(CC) -E $(M68KCPPFLAGS) -include $^ -o $@
-cf-code.elf : cf-code.o
- $(M68KLD) -Ttext 0 $^ -o $@
+cf-code/%.o : cf-code/%.s
+ $(M68KAS) $(M68KAFLAGS) -march=isac $^ -o $@
-cf-code.bin : cf-code.elf
+cf-code/%.elf : cf-code/%.o
+ $(M68KLD) $(M68KLDFLAGS) $^ -o $@
+
+cf-code/%.bin : cf-code/%.elf
$(M68KOC) -O binary $^ $@
-cf-wrapper.o : cf-wrapper.S cf-code.bin
+cf-wrapper.o : cf-wrapper.S cf-code/cf-fsi-romulus.bin
$(CC) $(CFLAGS) -c cf-wrapper.S -o $@
cf-fsi-test : cf-fsi-test.o cf-wrapper.o
$(CC) $(CFLAGS) $^ -o $@
+# Keep the ELF for debugging
+.PRECIOUS : cf-code/%.elf
+
clean:
- rm -rf cf-fsi-test *.o *.elf *.bin
+ rm -rf cf-fsi-test *.o
+ rm -rf cf-code/*.elf cf-code/*.bin cf-code/*.s cf-code/*.o
OpenPOWER on IntegriCloud