From 4a77cb7d76f5682564b5cdda4ec81abf3b06251d Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 22 Feb 2010 12:19:39 -0500 Subject: [PATCH] this is working kind of correctly. need to clean it up, get the different boards going and add in the lib build. --- Makefile.include | 27 +++++++++++++++++++++------ config.mk | 12 +++--------- mc1322x.lds | 2 +- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Makefile.include b/Makefile.include index 6f90ce88a..aff77f4c1 100644 --- a/Makefile.include +++ b/Makefile.include @@ -7,18 +7,33 @@ include $(MC1322X)/board/Makefile.board include $(MC1322X)/libmc1322x/Makefile.lib +# default start and isr +ifndef START + START = $(MC1322X)/src/start.o +endif +ifndef ISR + ISR = $(MC1322X)/src/isr.o +endif + + ARCH = arm CPU = arm7tdmi-s export ARCH CPU VENDOR -$(OBJDIR)/isr.o: isr.c +%.s: %.S + $(CPP) $(AFLAGS) -o $@ $(CURDIR)/$< +%.o: %.S + $(CC) $(AFLAGS) -c -o $@ $(CURDIR)/$< +%.o: %.c + $(CC) $(CFLAGS) $(THUMB_FLAGS) -c -o $@ $< + +$(ISR): $(ISR:.o=.c) $(CC) $(CFLAGS) $(ARM_FLAGS) $< -c -o $@ -%.o: %.c - $(CC) $(CFLAGS) $(THUMB_FLAGS) $< -c - -$(OBJDIR)/%.o: %.c - $(CC) $(CFLAGS) $(THUMB_FLAGS) -c $< -o $@ +%.elf: $(START) $(ISR) %.o $(LINKERSCRIPT) + $(LD) $(LDFLAGS) $(AOBJS) \ + --start-group $(PLATFORM_LIBS) --end-group \ + $(filter %.o %.a,$+) -o $@ clean: find . -type f \ diff --git a/config.mk b/config.mk index a0a1533fa..9a6b78e7e 100644 --- a/config.mk +++ b/config.mk @@ -27,6 +27,8 @@ OBJCFLAGS += --gap-fill=0xff gccincdir := $(shell $(CC) -print-file-name=include) +PLATFORM_LIBS += --no-warn-mismatch -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc + CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE) \ -fno-builtin -ffreestanding -nostdinc -isystem \ @@ -37,7 +39,7 @@ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wcast-align -Wcast-align AFLAGS_DEBUG := -Wa,-gstabs AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS) -LDFLAGS += -T $(LINKERSCRIPT) -nostartfiles -static -Wl,-Map=$@-$(BOARD).map,-export-dynamic +LDFLAGS += -T $(LINKERSCRIPT) -nostartfiles -static #-Wl,-Map=$*-$(BOARD).map,-export-dynamic ######################################################################### @@ -46,11 +48,3 @@ export TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS ######################################################################### -%.s: %.S - $(CPP) $(AFLAGS) -o $@ $(CURDIR)/$< -%.o: %.S - $(CC) $(AFLAGS) -c -o $@ $(CURDIR)/$< -%.o: %.c - $(CC) $(CFLAGS) $(THUMB_FLAGS) -c -o $@ $< - -######################################################################### diff --git a/mc1322x.lds b/mc1322x.lds index 061604a23..045635419 100644 --- a/mc1322x.lds +++ b/mc1322x.lds @@ -19,7 +19,7 @@ HEAP_SIZE = 1024; PROVIDE (__executable_start = 0x00400000); . = 0x00400000; .text : { - *startup.o (.text) + *start.o (.text) *(.irq) *(.text .stub .text.* .gnu.linkonce.t.*) /* .gnu.warning sections are handled specially by elf32.em. */