-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile~
124 lines (103 loc) · 3.67 KB
/
Makefile~
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
# uCtrl
# This file was based on makefile generated by mbed for generating export to gcc-arm-mbed
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
SYS_OBJECTS =
INCLUDE_PATHS =
LIBRARY_PATHS =
LIBRARIES =
LINKER_SCRIPT =
OBJECTS =
include ./config.mk
TARGET ?= FRDM-KL25Z
MBED_RTOS_PATH ?= ../mbed/libraries/rtos/
MBED_PATH ?= ../mbed/libraries/mbed/
#to be usedf by targets
ARM_TOOLCHAIN = TOOLCHAIN_GCC_ARM
TOOLCHAIN = TOOLCHAIN_GCC
CPU =
###############################################################################
#Build type
###############################################################################
#default release
CC_OPTIMISATION = -Os
PROJECT = uCtrl_Firmware_Release
CC_SYMBOLS =
ifeq ($(UCTRL_BUILD_TYPE), Debug)
CC_OPTIMISATION += -g3
PROJECT = uCtrl_Firmware_Debug
endif
ifeq ($(UCTRL_BUILD_TYPE), DebugPrint)
CC_OPTIMISATION += -g3
PROJECT = uCtrl_Firmware_Debug_Print
CC_SYMBOLS += -DDEBUG_PRINT
endif
###############################################################################
#TARGET_INCLUDE
###############################################################################
include ./Targets/Target.mk
###############################################################################
#uCtrl sources
###############################################################################
INCLUDE_PATHS += -I./Src
INCLUDE_PATHS += -I./Src/Conditions
INCLUDE_PATHS += -I./Src/Controller
INCLUDE_PATHS += -I./Src/Communication
INCLUDE_PATHS += -I./Src/Communication/frozen
INCLUDE_PATHS += -I./Src/TaskHandler
INCLUDE_PATHS += -I./Src/Devices
INCLUDE_PATHS += -I./Src/Devices/Actuators
INCLUDE_PATHS += -I./Src/Devices/Sensors
INCLUDE_PATHS += -I./Src/Events
INCLUDE_PATHS += -I./Src/Tasks
INCLUDE_PATHS += -I./Src/Utils
OBJECTS += ./Src/main.o
OBJECTS += ./Src/Conditions/UCondition.o
OBJECTS += ./Src/Controller/UController.o
OBJECTS += ./Src/Communication/FakeMessageHandler.o
OBJECTS += ./Src/Communication/UComDriverIn.o
OBJECTS += ./Src/Communication/UComDriverOut.o
OBJECTS += ./Src/Communication/UMsgHandler.o
OBJECTS += ./Src/Communication/frozen/frozen.o
OBJECTS += ./Src/Devices/UDevice.o
OBJECTS += ./Src/Devices/Actuators/FakeActuator.o
OBJECTS += ./Src/Devices/Actuators/UActuatorHandler.o
OBJECTS += ./Src/Devices/Sensors/USensor.o
OBJECTS += ./Src/Devices/Sensors/USensorLight.o
OBJECTS += ./Src/Devices/Sensors/USensorTemperature.o
OBJECTS += ./Src/Devices/Sensors/USensorHandler.o
OBJECTS += ./Src/Tasks/UScenery.o
OBJECTS += ./Src/Tasks/UTask.o
OBJECTS += ./Src/Tasks/UTaskHandler.o
OBJECTS += ./Src/Utils/UPinUtils.o
OBJECTS += ./Src/Utils/UMathUtils.o
#really hacky way to add object files (not functionnal)
#CPP_OBJECTS = "find ./Src -name *.cpp"
#OBJECTS += $(CPP_OBJECTS//.cpp/.o)
#test:
# echo $(OBJECTS)
###############################################################################
#Makefile target build
###############################################################################
AS = $(GCC_BIN)arm-none-eabi-as
CC = $(GCC_BIN)arm-none-eabi-gcc
CPP = $(GCC_BIN)arm-none-eabi-g++
LD = $(GCC_BIN)arm-none-eabi-gcc
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
.PHONY: clean configure
all: $(PROJECT).bin
cp $(PROJECT).bin /media/MBED;sync;
../enableSerialPort.sh;
clean:
rm -f $(PROJECT).bin $(PROJECT).elf $(OBJECTS)
configure:
./configure
.s.o:
$(AS) $(CPU) -o $@ $<
.c.o:
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99 $(INCLUDE_PATHS) -o $@ $<
.cpp.o:
$(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 $(INCLUDE_PATHS) -o $@ $<
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)
$(PROJECT).bin: $(PROJECT).elf
$(OBJCOPY) -O binary $< $@