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