From b4f05cfdf39b97ed7137676c11d3f99a59823ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Wed, 23 Jan 2013 14:56:25 +0000 Subject: [PATCH] modified to use a library instead of individual objects - can be reused for basflash.{elf|srec} --- .cproject | 16 ++++++++++------ Makefile | 17 ++++++++++++----- basflash.lk.in | 9 +-------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.cproject b/.cproject index 8f54c38..43198e5 100644 --- a/.cproject +++ b/.cproject @@ -1,7 +1,5 @@ - - - + @@ -168,7 +166,6 @@ make - all true true @@ -176,6 +173,7 @@ make + -j clean true true @@ -183,7 +181,6 @@ make - ram true true @@ -191,12 +188,19 @@ make - bfl true true true + + make + -j + lib + true + true + true + diff --git a/Makefile b/Makefile index 1e6f9a1..6bf824d 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,8 @@ CC=$(TCPREFIX)gcc LD=$(TCPREFIX)ld CPP=$(TCPREFIX)cpp OBJCOPY=$(TCPREFIX)objcopy +AR=$(TCPREFIX)ar +RANLIB=$(TCPREFIX)ranlib INCLUDE=-Iinclude CFLAGS=-mcpu=5474\ @@ -70,8 +72,7 @@ CSRCS= \ $(SRCDIR)/wait.c \ $(SRCDIR)/s19reader.c \ $(SRCDIR)/flash.c \ - $(SRCDIR)/basflash.c \ - $(SRCDIR)/flash.c + $(SRCDIR)/basflash.c ASRCS= \ $(SRCDIR)/startcf.S \ @@ -85,10 +86,12 @@ COBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.c,%.o,$(CSRCS))) AOBJS=$(patsubst $(SRCDIR)/%.o,$(OBJDIR)/%.o,$(patsubst %.S,%.o,$(ASRCS))) OBJS=$(COBJS) $(AOBJS) - +LIBBAS=libbas.a + all: $(FLASH_EXEC) ram: $(RAM_EXEC) bfl: $(BASFLASH_EXEC) +lib: $(LIBBAS) .PHONY clean: @ rm -f $(FLASH_EXEC) $(FLASH_EXEC).elf $(FLASH_EXEC).s19 \ @@ -110,15 +113,19 @@ endif $(BASFLASH_EXEC): $(OBJS) $(LDCBFL) $(CPP) -P -DTARGET_ADDRESS=$(BF_TARGET_ADDRESS) -DFORMAT=$(FORMAT) $(LDCBSRC) -o $(LDCBFS) - $(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCBFS) -o $@ + $(LD) --oformat $(FORMAT) -Map $(MAPFILE) --cref -T $(LDCBFS) -L. -lbas -o $@ ifeq ($(COMPILE_ELF),Y) $(OBJCOPY) -O srec $@ $@.s19 else objcopy -I srec -O elf32-big --alt-machine-code 4 $@ $@.elf endif +$(LIBBAS): $(OBJS) + $(AR) rv $@ $(OBJS) + $(RANLIB) $@ + # compile init_fpga with -mbitfield for testing purposes -$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield +#$(OBJDIR)/init_fpga.o: CFLAGS += -mbitfield # compile printf pc-relative so it can be used as well before and after copy of BaS $(OBJDIR)/bas_printf.o: CFLAGS += -mpcrel diff --git a/basflash.lk.in b/basflash.lk.in index 3b1dbf3..4a83339 100644 --- a/basflash.lk.in +++ b/basflash.lk.in @@ -8,14 +8,7 @@ SECTIONS .text : { objs/basflash.o(.text) - objs/unicode.o(.text) - objs/mmc.o(.text) - objs/ff.o(.text) - objs/sd_card.o(.text) - objs/s19reader.o(.text) - objs/bas_printf.o(.text) - objs/printf_helper.o(.text) - objs/cache.o(.text) + *(.data) *(.bss) *(.rodata)