Root/usbboot/xburst_stage2/Makefile

1#
2# Authors: Lucifer at Ingenic Semiconductor Inc.
3# Xiangfu Liu <xiangfu@sharism.cc>
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
11XBURST_INCLUDE_PATH = -I../xburst_include -I../src
12
13ifeq ($(CROSS_COMPILE),)
14$(warning CROSS_COMPILE variable not set, should point to .../mipsel-openwrt-linux-)
15endif
16
17CC = $(CROSS_COMPILE)gcc
18AR = $(CROSS_COMPILE)ar rcsv
19LD = $(CROSS_COMPILE)ld
20OBJCOPY = $(CROSS_COMPILE)objcopy
21NM = $(CROSS_COMPILE)nm
22OBJDUMP = $(CROSS_COMPILE)objdump
23
24DEVICE ?=NANONOTE
25DEBUG_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.
31CFLAGS = -mips32 -O2 -fno-exceptions -fno-zero-initialized-in-bss \
32    -ffunction-sections -fomit-frame-pointer -msoft-float -G 0 -fpie \
33    $(XBURST_INCLUDE_PATH) -D$(DEVICE)
34LDFLAGS = -nostdlib -T target.ld $(CFLAGS)
35
36OBJS = main.o udc.o cache.o serial.o boothandler.o nandflash_4740.o nandflash_4760.o
37
38all: xburst_stage2.elf
39    $(OBJCOPY) -O binary xburst_stage2.elf xburst_stage2.bin
40    chmod -x 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
45xburst_stage2.elf: head.o $(OBJS)
46    $(CC) $(LDFLAGS) $^ -o $@
47
48.c.o:
49    $(CC) $(CFLAGS) -o $@ -c $<
50.S.o:
51    $(CC) $(CFLAGS) -o $@ -c $<
52
53clean:
54    rm -f $(addprefix xburst_stage2., bin dump elf map sym)
55    rm -f head.o $(OBJS) $(OBJS:.o=.lst)
56

Archive Download this file



interactive