2 # FreeRTOS 4.1.0 - MCF5235 Coldfire Port
4 # Copyright (c) 2006 Christian Walter, Vienna 2006.
6 # $Id: Makefile,v 1.4 2006/09/06 19:55:07 wolti Exp $
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
17 #CFLAGS = -MD -gdwarf-2 -g3 -m528x -Wall
18 CFLAGS = -MD -O2 -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 -Ilwip/src/include -Ilwip/src/include/ipv4 \
24 -Ilwip/contrib/port/FreeRTOS/MCF5235 \
25 -Ilwip/contrib/port/FreeRTOS/MCF5235/netif
27 ASFLAGS = -MD -gdwarf-2 -g3 -m528x -Wa,--register-prefix-optional \
28 -Wa,--bitwise-or -Wa,--defsym,IPSBAR=0x40000000
29 LDSCRIPT = m5235-ram.ld
30 LDFLAGS = -nostartfiles -m528x -Wl,--script=$(LDSCRIPT)
34 OTHER_ASRC = $(addprefix system/, crt0.S vector.S)
36 $(addprefix system/, init.c newlib.c serial.c) \
37 $(addprefix ../Common/Minimal/, PollQ.c integer.c flop.c BlockQ.c semtest.c dynamic.c ) \
38 $(addprefix ../../Source/, tasks.c queue.c list.c) \
39 $(addprefix ../../Source/portable/MemMang/, heap_3.c) \
40 $(addprefix ../../Source/portable/GCC/MCF5235/, port.c) \
41 $(addprefix lwip/src/core/, tcp_out.c inet.c mem.c memp.c netif.c pbuf.c raw.c stats.c sys.c tcp.c tcp_in.c udp.c ipv4/ip.c ipv4/ip_addr.c ipv4/icmp.c ipv4/ip_frag.c) \
42 $(addprefix lwip/src/api/, tcpip.c api_msg.c err.c api_lib.c ) \
43 $(addprefix lwip/src/netif/, etharp.c ) \
44 $(addprefix lwip/contrib/port/FreeRTOS/MCF5235/, sys_arch.c netif/fec.c netif/nbuf.c)
46 ASRC = $(addprefix system/, mcf5xxx.S )
47 OBJS = $(CSRC:.c=.o) $(ASRC:.S=.o)
48 NOLINK_OBJS = $(OTHER_CSRC:.c=.o) $(OTHER_ASRC:.S=.o)
49 DEPS = $(OBJS:.o=.d) $(NOLINK_OBJS:.o=.d)
56 flash-programm: $(TGT).elf
57 $(OBJCOPY) -O binary $(TGT).elf $(TGT).bin
58 @BIN_SIZE=`du -b $(TGT).bin | awk '//{ print $$1; }'`; \
59 echo "programming $(TGT).bin with size $$BIN_SIZE to flash..."; \
60 $(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 write $(TGT).bin 0
63 @BIN_SIZE=`du -b $(TGT).bin | awk '//{ print $$1; }'`; \
64 echo "loading $$BIN_SIZE bytes from target into $(TGT).vrf..."; \
65 $(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 read $(TGT).vrf 0 $$BIN_SIZE
68 $(BDMFLASH) /dev/bdmcf20 0x00000000 1 2 erase
71 $(INSIGHT) --command=m5235.gdb --se=$(TGT).elf
73 $(BIN): $(OBJS) $(NOLINK_OBJS)
74 $(CC) $(LDFLAGS) -Wl,-Map=$(TGT).map $(OBJS) $(LDLIBS) -o $@
78 rm -f $(OBJS) $(NOLINK_OBJS)
79 rm -f $(BIN) $(TGT).map
81 # ---------------------------------------------------------------------------
82 # rules for code generation
83 # ---------------------------------------------------------------------------
85 $(CC) $(CFLAGS) -o $@ -c $<
88 $(CC) $(ASFLAGS) -o $@ -c $<
90 # ---------------------------------------------------------------------------
91 # # compiler generated dependencies
92 # ---------------------------------------------------------------------------