Root/xbboot/target-echokernel/Makefile

Source at commit a1c4ecab6bc814e37376d771b363aa4b109a9c57 created 14 years 7 months ago.
By Wolfgang Spraul, Created xbboot.
1#
2# Authors: Wolfgang Spraul <wolfgang@qi-hardware.com>
3#
4# This program is free software; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version
7# 3 of the License, or (at your option) any later version.
8#
9
10ifeq ($(CROSS_COMPILE),)
11$(error CROSS_COMPILE variable not set, should point to .../mipsel-openwrt-linux-)
12endif
13
14CC = $(CROSS_COMPILE)gcc
15AR = $(CROSS_COMPILE)ar rcsv
16LD = $(CROSS_COMPILE)ld
17OBJCOPY = $(CROSS_COMPILE)objcopy
18NM = $(CROSS_COMPILE)nm
19OBJDUMP = $(CROSS_COMPILE)objdump
20
21DEBUG_CFLAGS = -g -Wa,-a=$(basename $@).lst
22# Wolfgang saw data corruptions in stage2 when dealing with ECC data on random writes
23# to NAND. Disabling the unit-at-a-time optimization reproducibly fixed the bug.
24# The compiler may be optimizing in a way that conflicts with how the hardware ECC
25# registers work. Since other register accesses might be affected too it seems the best
26# is to disable this optimization right now.
27CFLAGS = -mips32 -O2 -fno-exceptions -fno-unit-at-a-time -fno-zero-initialized-in-bss \
28    -ffunction-sections -fomit-frame-pointer -msoft-float -G 0 $(DEBUG_CFLAGS)
29LDFLAGS = -nostdlib -T target.ld $(CFLAGS)
30LIBS = -lstdc++ -lc -lm -lgcc
31VPATH = ../target-common
32
33OBJS = echo-kernel.o serial.o
34
35all: echo-kernel.elf
36    $(OBJCOPY) -O binary echo-kernel.elf echo-kernel.bin
37    $(OBJDUMP) -D echo-kernel.elf > echo-kernel.dump
38    $(NM) echo-kernel.elf | sort > echo-kernel.sym
39    $(OBJDUMP) -h echo-kernel.elf > echo-kernel.map
40
41echo-kernel.elf: head.o $(OBJS)
42    $(CC) $(LDFLAGS) $^ -o $@
43
44.c.o:
45    $(CC) $(CFLAGS) -o $@ -c $<
46.cpp.o:
47    $(CC) $(CFLAGS) -fno-rtti -fvtable-gc -o $@ -c $<
48.S.o:
49    $(CC) $(CFLAGS) -o $@ -c $<
50
51clean:
52    rm -f $(addprefix echo-kernel., bin dump elf map sym)
53    rm -f head.o head.lst $(OBJS) $(OBJS:.o=.lst)
54

Archive Download this file



interactive