1LOCAL_DIR := $(GET_LOCAL_DIR) 2 3MODULE := $(LOCAL_DIR) 4 5MODULE_SRCS += \ 6 $(LOCAL_DIR)/arch.c \ 7 $(LOCAL_DIR)/asm.S \ 8 $(LOCAL_DIR)/exceptions.c \ 9 $(LOCAL_DIR)/start.S \ 10 $(LOCAL_DIR)/thread.c \ 11 $(LOCAL_DIR)/timer.c \ 12 $(LOCAL_DIR)/vectors.S \ 13 14# $(LOCAL_DIR)/cache.c \ 15 $(LOCAL_DIR)/cache-ops.S \ 16 $(LOCAL_DIR)/ops.S \ 17 $(LOCAL_DIR)/mmu.c \ 18 $(LOCAL_DIR)/faults.c \ 19 $(LOCAL_DIR)/descriptor.c 20 21GLOBAL_DEFINES += \ 22 SMP_MAX_CPUS=1 23 24# set the default toolchain to microblaze elf and set a #define 25ifndef TOOLCHAIN_PREFIX 26TOOLCHAIN_PREFIX := mips-elf- 27endif 28 29WITH_LINKER_GC ?= 0 30LITTLE_ENDIAN ?= 0 31 32ifneq ($(LITTLE_ENDIAN),0) 33ARCH_COMPILEFLAGS += -EL 34ARCH_ASFLAGS += -EL 35ARCH_LDFLAGS += -EL 36GLOBAL_MODULE_LDFLAGS += -EL 37endif 38 39ARCH_COMPILEFLAGS += -mno-gpopt 40ARCH_OPTFLAGS := -O2 41 42ifeq ($(MIPS_CPU),m14k) 43ARCH_COMPILEFLAGS += -march=m14k 44endif 45ifeq ($(MIPS_CPU),microaptiv-uc) 46ARCH_COMPILEFLAGS += -march=m14k 47endif 48 49LIBGCC := $(shell $(TOOLCHAIN_PREFIX)gcc $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) -print-libgcc-file-name) 50$(info LIBGCC = $(LIBGCC)) 51 52cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`"; \ 53 then echo "$(2)"; else echo "$(3)"; fi ;) 54 55KERNEL_BASE ?= $(MEMBASE) 56KERNEL_LOAD_OFFSET ?= 0 57VECTOR_BASE_PHYS ?= 0 58 59GLOBAL_DEFINES += \ 60 MEMBASE=$(MEMBASE) \ 61 MEMSIZE=$(MEMSIZE) \ 62 KERNEL_BASE=$(KERNEL_BASE) \ 63 KERNEL_LOAD_OFFSET=$(KERNEL_LOAD_OFFSET) 64 65# potentially generated files that should be cleaned out with clean make rule 66GENERATED += \ 67 $(BUILDDIR)/linker.ld 68 69# rules for generating the linker 70$(BUILDDIR)/linker.ld: $(LOCAL_DIR)/linker.ld $(wildcard arch/*.ld) linkerscript.phony 71 @echo generating $@ 72 @$(MKDIR) 73 $(NOECHO)sed "s/%MEMBASE%/$(MEMBASE)/;s/%MEMSIZE%/$(MEMSIZE)/;s/%KERNEL_BASE%/$(KERNEL_BASE)/;s/%KERNEL_LOAD_OFFSET%/$(KERNEL_LOAD_OFFSET)/;s/%VECTOR_BASE_PHYS%/$(VECTOR_BASE_PHYS)/" < $< > $@.tmp 74 @$(call TESTANDREPLACEFILE,$@.tmp,$@) 75 76linkerscript.phony: 77.PHONY: linkerscript.phony 78 79LINKER_SCRIPT += $(BUILDDIR)/linker.ld 80 81include make/module.mk 82