1: #
2: # ----------------------------------------------------------------------
3: # T-Kernel 2.0 Software Package
4: #
5: # Copyright 2011 by Ken Sakamura.
6: # This software is distributed under the latest version of T-License 2.x.
7: # ----------------------------------------------------------------------
8: #
9: # Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
10: # Modified by T-Engine Forum at 2012/11/07.
11: # Modified by T-Engine Forum at 2013/02/20.
12: # Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
13: #
14: # ----------------------------------------------------------------------
15: #
16:
17: # T-Monitor : flash (em1d)
18:
19: MACHINE = em1d
20: TETYPE = tef
21:
22: SRC_SYSDEP = setup-em1d.c
23: SRC_WR_SYSDEP = reset-em1d.c cfi_16x1.c cfi.c
24:
25: # ----------------------------------------------------------------------------
26:
27: DEPS = Dependencies
28: DEPENDENCIES_OUTPUT := $(DEPS)
29:
30: include $(BD)/etc/makerules
31:
32: TMONITOR_INSTALLDIR = $(BD)/monitor/bin/$(TETYPE)_$(MACHINE)
33:
34: HEADER = $(BD)/include $(BD)/monitor/include
35:
36: # ----------------------------------------------------------------------------
37:
38: TARGET = flash
39:
40: S = ../../src
41:
42: VPATH = $(S)
43: HEADER += $(S)
44:
45: SRC = main.c
46: SRC += $(SRC_SYSDEP)
47: SRC_WR =
48: SRC_WR += $(SRC_WR_SYSDEP)
49:
50: OBJ = $(addsuffix .o, $(basename $(SRC)))
51: OBJ_WR = $(addsuffix .o, $(basename $(SRC_WR)))
52:
53: CFLAGS += $(CFLAGS_WARNING)
54:
55: # adjust for flashwr object
56: REN_SECTION = --rename-section .text=flashwr.text \
57: --rename-section .rodata=flashwr.rodata
58: KEEP_SYMBOL = --keep-global-symbol=flashwr \
59: --keep-global-symbol=FROM_SECSZ
60:
61: # ----------------------------------------------------------------------------
62:
63: .PHONY: all clean install
64:
65: ALL = $(TARGET).o
66:
67: all: $(ALL)
68:
69: $(TARGET).o: $(OBJ) flashwr.o
70: $(LINK_R.o) $^ $(OUTPUT_OPTION)
71:
72: flashwr.o: $(OBJ_WR)
73: $(LINK_R.o) $^ -lgcc $(OUTPUT_OPTION)
74: $(OBJCOPY) $(REN_SECTION) $(KEEP_SYMBOL) $@
75:
76: clean:
77: $(RM) $(OBJ) $(OBJ_WR) flashwr.o $(ALL) $(DEPS)
78:
79: install: $(addprefix $(TMONITOR_INSTALLDIR)/, $(ALL))
80:
81: $(TMONITOR_INSTALLDIR)/%: %
82: $(BD)/etc/backup_copy -t -d !OLD $< $(TMONITOR_INSTALLDIR)
83:
84: ifdef DEPENDENCIES_OUTPUT
85: $(DEPS): ; touch $(DEPS)
86: else
87: $(DEPS): $(SRC) ; $(MAKEDEPS) $@ $?
88: endif
89: -include $(DEPS)