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
11INFLASH_SRC_PATH = ../src
12XBURST_INCLUDE_PATH = ../xburst_include
13
14ifeq ($(CROSS_COMPILE),)
15$(error CROSS_COMPILE variable not set, should point to .../mipsel-openwrt-linux-)
16endif
17
18CC = $(CROSS_COMPILE)gcc
19AR = $(CROSS_COMPILE)ar rcsv
20LD = $(CROSS_COMPILE)ld
21OBJCOPY = $(CROSS_COMPILE)objcopy
22NM = $(CROSS_COMPILE)nm
23OBJDUMP = $(CROSS_COMPILE)objdump
24
25DEVICE ?=NANONOTE
26DEBUG_CFLAGS = -g -Wa,-a=$(basename $@).lst
27# Wolfgang saw data corruptions in stage2 when dealing with ECC data on random writes
28# to NAND. Disabling the unit-at-a-time optimization reproducibly fixed the bug.
29# The compiler may be optimizing in a way that conflicts with how the hardware ECC
30# registers work. Since other register accesses might be affected too it seems the best
31# is to disable this optimization right now.
32CFLAGS = -mips32 -O2 -fno-exceptions -fno-zero-initialized-in-bss \
33    -ffunction-sections -fomit-frame-pointer -msoft-float -G 0 -fpie \
34    -I$(XBURST_INCLUDE_PATH) -I$(INFLASH_SRC_PATH) -D$(DEVICE)
35LDFLAGS = -nostdlib -T target.ld $(CFLAGS)
36
37OBJS = main.o udc.o cache.o serial.o boothandler.o nandflash_4740.o nandflash_4760.o
38
39all: xburst_stage2.elf
40    $(OBJCOPY) -O binary xburst_stage2.elf xburst_stage2.bin
41    chmod -x xburst_stage2.bin
42    $(OBJDUMP) -D xburst_stage2.elf > xburst_stage2.dump
43    $(NM) xburst_stage2.elf | sort > xburst_stage2.sym
44    $(OBJDUMP) -h xburst_stage2.elf > xburst_stage2.map
45
46xburst_stage2.elf: head.o $(OBJS)
47    $(CC) $(LDFLAGS) $^ -o $@
48
49.c.o:
50    $(CC) $(CFLAGS) -o $@ -c $<
51.S.o:
52    $(CC) $(CFLAGS) -o $@ -c $<
53
54clean:
55    rm -f $(addprefix xburst_stage2., bin dump elf map sym)
56    rm -f head.o $(OBJS) $(OBJS:.o=.lst)
57

Archive Download this file



interactive