Subversion Repositories Projects

Rev

Rev 316 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 316 Rev 319
1
###########################################################################
1
###########################################################################
2
#
2
#
3
#	free-rtos.mk
3
#	free-rtos.mk
4
#
4
#
5
#	Contains definitions common to all Free-RTOS builds.
5
#	Contains definitions common to all Free-RTOS builds.
6
#
6
#
7
###########################################################################
7
###########################################################################
8
8
9
#--------------------------------------------------------------------------
9
#--------------------------------------------------------------------------
10
#
10
#
11
# 	Run make with v=1 or verbose=1 to get verbose output
11
# 	Run make with v=1 or verbose=1 to get verbose output
12
#
12
#
13
13
14
ifeq ($(v),)
14
ifeq ($(v),)
15
export verbose = 0
15
export verbose = 0
16
else
16
else
17
export verbose = 1
17
export verbose = 1
18
endif
18
endif
19
19
20
ifeq ($(verbose),)
20
ifeq ($(verbose),)
21
export verbose = 0
21
export verbose = 0
22
endif
22
endif
23
23
24
ifeq ($(verbose),0)
24
ifeq ($(verbose),0)
25
	Q = @
25
	Q = @
26
	MAKEFLAGS += -s
26
	MAKEFLAGS += -s
27
else
27
else
28
	Q =
28
	Q =
29
endif
29
endif
30
export Q
30
export Q
31
31
32
#--------------------------------------------------------------------------
32
#--------------------------------------------------------------------------
33
33
34
FREE_RTOS	= /home/dhylands/software/FreeRTOSV7.1.0
34
FREE_RTOS	= /home/dhylands/software/FreeRTOSV7.1.0
35
FREE_RTOS_SRC	= $(FREE_RTOS)/Source
35
FREE_RTOS_SRC	= $(FREE_RTOS)/Source
-
 
36
-
 
37
#
-
 
38
# Do some sanity checks on the FREE_RTOS directory structure
-
 
39
#
-
 
40
-
 
41
ifeq (,$(wildcard $(FREE_RTOS)))
-
 
42
$(error FREE_RTOS '$(FREE_RTOS)' doesn't exist)
-
 
43
endif
-
 
44
ifeq (,$(wildcard $(FREE_RTOS_SRC)))
-
 
45
$(error FREE_RTOS_SRC '$(FREE_RTOS_SRC)' doesn't exist)
-
 
46
endif
-
 
47
ifeq (,$(wildcard $(FREE_RTOS_SRC)/include/FreeRTOS.h))
-
 
48
$(error Unable to find '$(FREE_RTOS_SRC)/include/FreeRTOS.h')
-
 
49
endif
36
50
37
CC 	= $(CROSS_COMPILE)gcc
51
CC 	= $(CROSS_COMPILE)gcc
38
LD 	= $(CROSS_COMPILE)ld
52
LD 	= $(CROSS_COMPILE)ld
39
OBJCOPY	= $(CROSS_COMPILE)objcopy
53
OBJCOPY	= $(CROSS_COMPILE)objcopy
40
54
41
LIBGCC	= $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
55
LIBGCC	= $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
42
LIBC	= $(shell $(CC) $(CFLAGS) -print-file-name=libc.a)
56
LIBC	= $(shell $(CC) $(CFLAGS) -print-file-name=libc.a)
43
57
44
OBJS = $(addprefix obj/,$(SRCS:%.c=%.o))
58
OBJS = $(addprefix obj/,$(SRCS:%.c=%.o))
45
DEPS = $(addprefix obj/,$(SRCS:%.c=%.d))
59
DEPS = $(addprefix obj/,$(SRCS:%.c=%.d))
46
60
47
all : obj/$(TARGET).bin
61
all : obj/$(TARGET).bin
48
62
49
obj/%.o : %.c
63
obj/%.o : %.c
50
	echo "Compiling $< ..."
64
	echo "Compiling $< ..."
51
	$(Q)mkdir -p $(@D)
65
	$(Q)mkdir -p $(@D)
52
	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
66
	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
53
67
54
obj/$(TARGET).elf : $(OBJS)
68
obj/$(TARGET).elf : $(OBJS)
55
	echo "Linking $@ ..."
69
	echo "Linking $@ ..."
56
	$(Q)$(LD) -T $(LD_SCRIPT) -Map ${@:%.elf=%.map} -o $@ $^ $(LIBC) $(LIBGCC)
70
	$(Q)$(LD) -T $(LD_SCRIPT) -Map ${@:%.elf=%.map} -o $@ $^ $(LIBC) $(LIBGCC)
57
71
58
obj/%.bin : obj/%.elf
72
obj/%.bin : obj/%.elf
59
	echo "Creating $@ from $<"
73
	echo "Creating $@ from $<"
60
	$(Q)$(OBJCOPY) -O binary $< $@
74
	$(Q)$(OBJCOPY) -O binary $< $@
61
75
62
clean:
76
clean:
63
	echo "Removing obj directory ..."
77
	echo "Removing obj directory ..."
64
	$(Q)rm -rf obj
78
	$(Q)rm -rf obj
65
79
66
ifeq ($(strip $(filter clean% exec print-%, $(MAKECMDGOALS))),)
80
ifeq ($(strip $(filter clean% exec print-%, $(MAKECMDGOALS))),)
67
-include $(DEPS)
81
-include $(DEPS)
68
endif
82
endif
69
83