summaryrefslogtreecommitdiff
path: root/Demo/ColdFire_MCF52233_Eclipse/RTOSDemo/Makefile
blob: be22eaf284c0f2a8e1b5e3841995e7006a7b3ed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
RM := rm -rf

# Set the optimisation level - this should be set to 0, 1, 2, 3 or s (s for size).
OPTIM=0

###############################################################################
# List the directories that contain files to be built.
###############################################################################

# These two directories contain the FreeRTOS.org kernel source files.
FREERTOS_SOURCE_DIR=./../../../Source
PORT_SOURCE_DIR=./../../../Source/portable/GCC/ColdFire_V2

# This directory contains the standard demo files that get included in every
# FreeRTOS.org demo.  They define tasks that demonstrate the API usage and 
# test the FreeRTOS.org port.
COMMON_DEMO_SOURCE_DIR=./../../Common/Minimal

# This directory contains the modified uIP code
FREERTOS_uIP_DIR=./../../Common/ethernet/FreeRTOS-uIP

VPATH=		$(FREERTOS_SOURCE_DIR) : \
			$(PORT_SOURCE_DIR) : \
			$(COMMON_DEMO_SOURCE_DIR) : \
			$(FREERTOS_SOURCE_DIR)/portable/MemMang : \
			$(FREERTOS_uIP_DIR) : \
			. : \
			./webserver : \
			./ParTest : \
			./serial


###############################################################################
# Define a few constants to be used during the build.
###############################################################################

OUTPUT_DIR=./bin
CPU=52235
LINKER_SCRIPT=m52235evb-rom-hosted.ld
SREC_FILENAME=RTOSDemo.s19
ELF_FILENAME=RTOSDemo.elf
CC=m68k-elf-gcc
AS=m68k-elf-as
OBJCOPY=m68k-elf-objcopy


###############################################################################
# List the files to include in the build.  These files will be located from the
# VPATH defined above.
###############################################################################

# The FreeRTOS.org source files.
FreeRTOS_OBJS=			$(OUTPUT_DIR)/portasm.o \
						$(OUTPUT_DIR)/port.o \
						$(OUTPUT_DIR)/list.o \
						$(OUTPUT_DIR)/tasks.o \
						$(OUTPUT_DIR)/queue.o \
						$(OUTPUT_DIR)/heap_1.o

# The demo app source files, including the basic WEB server.
Demo_OBJS=				$(OUTPUT_DIR)/main.o \
						$(OUTPUT_DIR)/ParTest.o \
						$(OUTPUT_DIR)/flash.o \
						$(OUTPUT_DIR)/FreeRTOS_Tick_Setup.o \
						$(OUTPUT_DIR)/BlockQ.o \
						$(OUTPUT_DIR)/PollQ.o \
						$(OUTPUT_DIR)/semtest.o \
						$(OUTPUT_DIR)/GenQTest.o \
						$(OUTPUT_DIR)/QPeek.o \
						$(OUTPUT_DIR)/FEC.o \
						$(OUTPUT_DIR)/blocktim.o \
						$(OUTPUT_DIR)/recmutex.o \
						$(OUTPUT_DIR)/printf-stdarg.o

HTTP_OBJS=				$(OUTPUT_DIR)/uIP_Task.o \
						$(OUTPUT_DIR)/httpd.o \
						$(OUTPUT_DIR)/httpd-cgi.o \
						$(OUTPUT_DIR)/httpd-fs.o \
						$(OUTPUT_DIR)/http-strings.o

# uIP source files
uIP_OBJS=				$(OUTPUT_DIR)/timer.o \
						$(OUTPUT_DIR)/uip.o \
						$(OUTPUT_DIR)/uip_arp.o \
						$(OUTPUT_DIR)/uiplib.o \
						$(OUTPUT_DIR)/uip-split.o \
						$(OUTPUT_DIR)/psock.o

OBJS = $(Demo_OBJS) $(FreeRTOS_OBJS) $(uIP_OBJS) $(HTTP_OBJS)
			
C_DEPS = $(OBJS:.o=.d)

INCLUDE_PATHS=	-I./webserver \
				-I"$(FREERTOS_uIP_DIR)" \
				-I"$(FREERTOS_SOURCE_DIR)/include" \
				-I"include" \
				-I"$(COMMON_DEMO_SOURCE_DIR)/../include" \
				-I"$(PORT_SOURCE_DIR)" \
				-I./MCF5223x \
				-I.

CFLAGS=		$(INCLUDE_PATHS) \
			-D COLDFIRE_V2_GCC \
			-D PACK_STRUCT_END=__attribute\(\(packed\)\) \
			-D ALIGN_STRUCT_END=__attribute\(\(aligned\(4\)\)\) \
			-O$(OPTIM) \
			-D bktPRIMARY_PRIORITY=4 \
			-D bktSECONDARY_PRIORITY=3 \
			-fno-strict-aliasing \
			-g3 \
			-gdwarf-2 \
			-Wall \
			-Wextra \
			-c \
			-ffunction-sections \
			-fdata-sections \
			-fmessage-length=0 \
			-funsigned-char \
			-Wextra \
			-mcpu=$(CPU) \
			-MMD \
			-MP \
			-MF"$(@:%.o=%.d)" \
			-MT"$(@:%.o=%.d)"

ASFLAGS= 	-m52235 \
			-g3 \
			--register-prefix-optional \
            --bitwise-or

LIBS=

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: $(OUTPUT_DIR)/$(SREC_FILENAME)

# Tool invocations 
$(OUTPUT_DIR)/$(SREC_FILENAME): $(OUTPUT_DIR)/$(ELF_FILENAME)
	$(OBJCOPY) $(OUTPUT_DIR)/$(ELF_FILENAME) -O srec $(OUTPUT_DIR)/$(SREC_FILENAME)

$(OUTPUT_DIR)/$(ELF_FILENAME): $(OBJS)
	$(CC) -nostartfiles --gc-sections -Xlinker -Map=$(OUTPUT_DIR)/output.map -mcpu=$(CPU) -T $(LINKER_SCRIPT) -o"$(OUTPUT_DIR)/$(ELF_FILENAME)"  $(OBJS) $(USER_OBJS) $(LIBS)

$(OUTPUT_DIR)/%.o: %.c Makefile
	$(CC) $(CFLAGS)	-o"$@" "$<"

$(OUTPUT_DIR)/%.o: %.S
	$(AS) $(ASFLAGS) -o"$@" "$<"

# Other Targets
clean:
	-$(RM) $(OBJS) $(C_DEPS) $(EXECUTABLES) $(OUTPUT_DIR)/$(ELF_FILENAME) $(OUTPUT_DIR)/$(SREC_FILENAME)
	-@echo ' '

#
# The rule to create the target directory
#
$(OUTPUT_DIR):
	@mkdir $(OUTPUT_DIR)


.PHONY: all clean dependents
.SECONDARY: post-build

-include $(wildcard $(OUTPUT_DIR)/*.d) __dummy__