1 |
584 |
jeremybenn |
#
|
2 |
|
|
# FreeRTOS 4.1.0 - MCF5235 Coldfire Port
|
3 |
|
|
#
|
4 |
|
|
# Copyright (c) 2006 Christian Walter, Vienna 2006.
|
5 |
|
|
#
|
6 |
|
|
# $Id: Makefile 2 2011-07-17 20:13:17Z filepang@gmail.com $
|
7 |
|
|
#
|
8 |
|
|
# ---------------------------------------------------------------------------
|
9 |
|
|
BASE = /opt/gcc-m68k/bin
|
10 |
|
|
CC = $(BASE)/m68k-elf-gcc
|
11 |
|
|
CXX = $(BASE)/m68k-elf-g++
|
12 |
|
|
OBJCOPY = $(BASE)/m68k-elf-objcopy
|
13 |
|
|
SIZE = $(BASE)/m68k-elf-size
|
14 |
|
|
INSIGHT = $(BASE)/m68k-bdm-elf-insight
|
15 |
|
|
BDMFLASH = $(BASE)/bdmflash
|
16 |
|
|
|
17 |
|
|
#CFLAGS = -MD -O2 -m528x -Wall
|
18 |
|
|
CFLAGS = -MD -gdwarf-2 -g3 -m528x -Wall \
|
19 |
|
|
-D'GCC_MCF5235=1' -D'_GCC_USES_FP=1' \
|
20 |
|
|
-D'__IPSBAR=((vuint8 *) 0x40000000)' -D'FSYS_2=25000000UL' \
|
21 |
|
|
-I. -Iinclude -Iinclude/arch -Ifec \
|
22 |
|
|
-I../../Source/include -I../Common/include
|
23 |
|
|
|
24 |
|
|
ASFLAGS = -MD -gdwarf-2 -g3 -m528x -Wa,--register-prefix-optional \
|
25 |
|
|
-Wa,--bitwise-or -Wa,--defsym,IPSBAR=0x40000000
|
26 |
|
|
LDSCRIPT = m5235-ram.ld
|
27 |
|
|
LDFLAGS = -nostartfiles -m528x -Wl,--script=$(LDSCRIPT)
|
28 |
|
|
|
29 |
|
|
TGT = demo
|
30 |
|
|
OTHER_CSRC =
|
31 |
|
|
OTHER_ASRC = $(addprefix system/, crt0.S vector.S)
|
32 |
|
|
CSRC = demo.c \
|
33 |
|
|
$(addprefix system/, init.c newlib.c serial.c) \
|
34 |
|
|
$(addprefix ../Common/Minimal/, PollQ.c integer.c flop.c BlockQ.c semtest.c dynamic.c ) \
|
35 |
|
|
$(addprefix ../../Source/, tasks.c queue.c list.c) \
|
36 |
|
|
$(addprefix ../../Source/portable/MemMang/, heap_3.c) \
|
37 |
|
|
$(addprefix ../../Source/portable/GCC/MCF5235/, port.c)
|
38 |
|
|
|
39 |
|
|
ASRC = $(addprefix system/, mcf5xxx.S )
|
40 |
|
|
OBJS = $(CSRC:.c=.o) $(ASRC:.S=.o)
|
41 |
|
|
NOLINK_OBJS = $(OTHER_CSRC:.c=.o) $(OTHER_ASRC:.S=.o)
|
42 |
|
|
DEPS = $(OBJS:.o=.d) $(NOLINK_OBJS:.o=.d)
|
43 |
|
|
BIN = $(TGT).elf
|
44 |
|
|
|
45 |
|
|
.PHONY: clean all
|
46 |
|
|
|
47 |
|
|
all: $(BIN)
|
48 |
|
|
|
49 |
|
|
flash-programm: $(TGT).elf
|
50 |
|
|
$(OBJCOPY) -O binary $(TGT).elf $(TGT).bin
|
51 |
|
|
@BIN_SIZE=`du -b $(TGT).bin | awk '//{ print $$1; }'`; \
|
52 |
|
|
echo "programming $(TGT).bin with size $$BIN_SIZE to flash..."; \
|
53 |
|
|
$(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 write $(TGT).bin 0
|
54 |
|
|
|
55 |
|
|
flash-verify:
|
56 |
|
|
@BIN_SIZE=`du -b $(TGT).bin | awk '//{ print $$1; }'`; \
|
57 |
|
|
echo "loading $$BIN_SIZE bytes from target into $(TGT).vrf..."; \
|
58 |
|
|
$(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 read $(TGT).vrf 0 $$BIN_SIZE
|
59 |
|
|
|
60 |
|
|
flash-erase:
|
61 |
|
|
$(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 erase
|
62 |
|
|
|
63 |
|
|
debug:
|
64 |
|
|
$(INSIGHT) --command=m5235.gdb --se=$(TGT).elf
|
65 |
|
|
|
66 |
|
|
$(BIN): $(OBJS) $(NOLINK_OBJS)
|
67 |
|
|
$(CC) $(LDFLAGS) -Wl,-Map=$(TGT).map $(OBJS) $(LDLIBS) -o $@
|
68 |
|
|
|
69 |
|
|
clean:
|
70 |
|
|
rm -f $(DEPS)
|
71 |
|
|
rm -f $(OBJS) $(NOLINK_OBJS)
|
72 |
|
|
rm -f $(BIN) $(TGT).map
|
73 |
|
|
|
74 |
|
|
# ---------------------------------------------------------------------------
|
75 |
|
|
# rules for code generation
|
76 |
|
|
# ---------------------------------------------------------------------------
|
77 |
|
|
%.o: %.c
|
78 |
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
79 |
|
|
|
80 |
|
|
%.o: %.S
|
81 |
|
|
$(CC) $(ASFLAGS) -o $@ -c $<
|
82 |
|
|
|
83 |
|
|
# ---------------------------------------------------------------------------
|
84 |
|
|
# # compiler generated dependencies
|
85 |
|
|
# ---------------------------------------------------------------------------
|
86 |
|
|
-include $(DEPS)
|
87 |
|
|
|