From eef619c3896af87edd776f174bcd704aa7a1d262 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Sun, 3 Jun 2018 17:08:20 +1000 Subject: 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 --- Makefile | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.1