-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathMakefile
227 lines (189 loc) · 10.6 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
##############################################################################
# Main makefile for basic_modem
##############################################################################
-include makefiles/printing.mk
-include makefiles/options.mk
#-----------------------------------------------------------------------------
# default action: print help
#-----------------------------------------------------------------------------
help:
$(call echo_help_b, "Available TARGETs: sx128x lr1110 lr1120 lr1121 sx1261 sx1262 sx1268 sx1272 sx1276")
$(call echo_help, "")
$(call echo_help_b, "-------------------------------- Clean -------------------------------------")
$(call echo_help, " * make clean_<TARGET> : clean basic_modem for a given target")
$(call echo_help, " * make clean_all : clean all")
$(call echo_help, "")
$(call echo_help_b, "----------------------------- Compilation ----------------------------------")
$(call echo_help, " * make basic_modem_<TARGET> MCU_FLAGS=xxx : build basic_modem on a given target with chosen mcu flags")
$(call echo_help, " * MCU_FLAGS are mandatory. Ex for stm32l4:")
$(call echo_help, " * MCU_FLAGS=\"-mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard\"")
$(call echo_help, "")
$(call echo_help_b, "---------------------- Optional build parameters ---------------------------")
$(call echo_help, " * REGION=xxx : choose which region should be compiled (default: ALL)")
$(call echo_help, " * Combinations also work (i.e. REGION=EU_868,US_915 )")
$(call echo_help, " * - AS_923")
$(call echo_help, " * - AU_915")
$(call echo_help, " * - CN_470")
$(call echo_help, " * - CN_470_RP_1_0")
$(call echo_help, " * - EU_868")
$(call echo_help, " * - IN_865")
$(call echo_help, " * - KR_920")
$(call echo_help, " * - RU_864")
$(call echo_help, " * - US_915")
$(call echo_help, " * - WW_2G4 (to be used only for lr1120 and sx128x targets)")
$(call echo_help, " * - ALL (to build all possible regions according to the radio target) ")
$(call echo_help, " * CRYPTO=xxx : choose which crypto should be compiled (default: SOFT)")
$(call echo_help, " * - SOFT")
$(call echo_help, " * - LR11XX (only for lr1110 and lr1120 targets)")
$(call echo_help, " * - LR11XX_WITH_CREDENTIALS (only for lr1110 and lr1120 targets)")
$(call echo_help, " * MODEM_TRACE=yes/no : choose to enable or disable modem trace print (default: yes)")
$(call echo_help, " * LBM_CLASS_B=yes/no : choose to build class B feature (default: no)")
$(call echo_help, " * LBM_CLASS_C=yes/no : choose to build class C feature (default: no)")
$(call echo_help, " * LBM_MULTICAST=yes/no : choose to build multicast stack feature (default: no)")
$(call echo_help, " * LBM_CSMA=yes/no : choose to build CSMA Feature (default: yes)")
$(call echo_help, " * USE_CSMA_BY_DEFAULT=yes/no : in case CSMA is built choose to enable CSMA Feature at start (default: no)")
$(call echo_help, " * LBM_ALC_SYNC=yes/no : choose to build ALCSync service (default: no)")
$(call echo_help, " * LBM_ALC_SYNC_VERSION=x : choose which version of ALCSync package should be compiled (default: 1)")
$(call echo_help, " * LBM_FUOTA=yes/no : choose to build LoRaWAN Packages for FUOTA (default: no)")
$(call echo_help, " * LBM_FUOTA_VERSION=x : choose which version of FUOTA packageq should be compiled (default: 1)")
$(call echo_help, " * LBM_FUOTA_ENABLE_FMP=yes/no : in case FUOTA is enabled choose to build LoRaWAN Firmware Management Package (default: yes)")
$(call echo_help, " * LBM_FUOTA_ENABLE_MPA=yes/no : in case FUOTA is enabled choose to build LoRaWAN Multi-Package Access Package (default: no)")
$(call echo_help, " * LBM_ALMANAC=yes/no : choose to build Cloud Almanac Update service (default: no)")
$(call echo_help, " * LBM_STREAM=yes/no : choose to build Cloud Stream service (default: no)")
$(call echo_help, " * LBM_LFU=yes/no : choose to build Cloud Large File Upload service (default: no)")
$(call echo_help, " * LBM_DEVICE_MANAGEMENT=yes/no : choose to build Cloud Device Management service (default: no)")
$(call echo_help, " * LBM_GEOLOCATION=yes/no : choose to build Geolocation service (default: no)")
$(call echo_help, " * LBM_STORE_AND_FORWARD=yes/no : choose to build Store and Forward service (default: no)")
$(call echo_help, " * LBM_RELAY_TX_ENABLE=yes/no : choose to build Relay Tx service (default: no)")
$(call echo_help, " * LBM_RELAY_RX_ENABLE=yes/no : choose to build Relay Rx service (default: no)")
$(call echo_help, "")
$(call echo_help_b, "-------------------- Optional makefile parameters --------------------------")
$(call echo_help, " * EXTRAFLAGS=xxx : Add specific compilation flag for LBM lib build")
$(call echo_help, " * DEBUG=yes/no : -g options for debugging (default: no)")
$(call echo_help, " * OPT=xxx : Choose compilation optimization (default: -Os)")
$(call echo_help, " * MULTITHREAD=yes/no : Multithreaded build (default: yes)")
$(call echo_help, " * VERBOSE=yes/no : Increase build verbosity (default: no)")
$(call echo_help, " * SIZE=yes/no : Display size for all objects (default: no)")
$(call echo_help, "")
$(call echo_help_b, "---------------------------------------------------------------------------")
$(call echo_help_b, "All options can also be directly updated in makefiles/options.mk file")
#-----------------------------------------------------------------------------
# Makefile include selection
#-----------------------------------------------------------------------------
ifeq ($(RADIO),lr1110)
-include makefiles/lr11xx.mk
endif
ifeq ($(RADIO),lr1120)
-include makefiles/lr11xx.mk
endif
ifeq ($(RADIO),lr1121)
-include makefiles/lr11xx.mk
endif
ifeq ($(RADIO),sx1261)
-include makefiles/sx126x.mk
endif
ifeq ($(RADIO),sx1262)
-include makefiles/sx126x.mk
endif
ifeq ($(RADIO),sx1268)
-include makefiles/sx126x.mk
endif
ifeq ($(RADIO),sx128x)
-include makefiles/sx128x.mk
endif
ifeq ($(RADIO),sx1272)
-include makefiles/sx127x.mk
endif
ifeq ($(RADIO),sx1276)
-include makefiles/sx127x.mk
endif
#-----------------------------------------------------------------------------
-include makefiles/common.mk
.PHONY: clean_all all help
all: basic_modem_sx128x basic_modem_lr1110 basic_modem_lr1120 basic_modem_lr1121 basic_modem_sx1261 basic_modem_sx1262 basic_modem_sx1272 basic_modem_sx1276
#-----------------------------------------------------------------------------
# Clean
#-----------------------------------------------------------------------------
clean_all:
-rm -rf $(BUILD_ROOT)
clean_sx128x:
$(MAKE) clean_target RADIO=sx128x
clean_lr1110:
$(MAKE) clean_target RADIO=lr1110
clean_lr1120:
$(MAKE) clean_target RADIO=lr1120
clean_lr1121:
$(MAKE) clean_target RADIO=lr1121
clean_sx1261:
$(MAKE) clean_target RADIO=sx1261
clean_sx1262:
$(MAKE) clean_target RADIO=sx1262
clean_sx1268:
$(MAKE) clean_target RADIO=sx1268
clean_sx1272:
$(MAKE) clean_target RADIO=sx1272
clean_sx1276:
$(MAKE) clean_target RADIO=sx1276
clean:
$(MAKE) clean_target
#-----------------------------------------------------------------------------
# Compilation
#-----------------------------------------------------------------------------
basic_modem:
ifeq ($(RADIO),nc)
$(call echo_error,"No radio selected! Please specified the target radio using RADIO=radio_name option")
else
ifneq ($(CRYPTO),SOFT)
ifeq ($(LBM_RELAY_TX_ENABLE),yes)
$(call echo_error, "------------------------------------------------------------")
$(call echo_error, "When Relay Tx feature is enable: only soft crypto can be used")
$(call echo_error, "Please use CRYPTO=SOFT option")
$(call echo_error, "------------------------------------------------------------")
exit 1
endif
ifeq ($(LBM_RELAY_RX_ENABLE),yes)
$(call echo_error, "------------------------------------------------------------")
$(call echo_error, "When Relay Rx feature is enable: only soft crypto can be used")
$(call echo_error, "Please use CRYPTO=SOFT option")
$(call echo_error, "------------------------------------------------------------")
exit 1
endif
ifneq ($(NB_OF_STACK),1)
$(call echo_error, "----------------------------------------------------------")
$(call echo_error, "More than one stack compiled: only soft crypto can be used")
$(call echo_error, "Please use CRYPTO=SOFT option")
$(call echo_error, "----------------------------------------------------------")
exit 1
endif
ifneq ($(RADIO),lr1110)
ifneq ($(RADIO),lr1120)
ifneq ($(RADIO),lr1121)
$(call echo_error, "------------------------------------------------------------")
$(call echo_error, "sx126x sx127x and sx128x radio tagets: only soft crypto can be used")
$(call echo_error, "Please use CRYPTO=SOFT option")
$(call echo_error, "------------------------------------------------------------")
exit 1
endif
endif
endif
endif
$(MAKE) basic_modem_build
endif
basic_modem_sx128x:
$(MAKE) basic_modem RADIO=sx128x $(MTHREAD_FLAG)
basic_modem_lr1110:
$(MAKE) basic_modem RADIO=lr1110 $(MTHREAD_FLAG)
basic_modem_lr1120:
$(MAKE) basic_modem RADIO=lr1120 $(MTHREAD_FLAG)
basic_modem_lr1121:
$(MAKE) basic_modem RADIO=lr1121 $(MTHREAD_FLAG)
basic_modem_sx1261:
$(MAKE) basic_modem RADIO=sx1261 $(MTHREAD_FLAG)
basic_modem_sx1262:
$(MAKE) basic_modem RADIO=sx1262 $(MTHREAD_FLAG)
basic_modem_sx1268:
$(MAKE) basic_modem RADIO=sx1268 $(MTHREAD_FLAG)
basic_modem_sx1272:
$(MAKE) basic_modem RADIO=sx1272 $(MTHREAD_FLAG)
basic_modem_sx1276:
$(MAKE) basic_modem RADIO=sx1276 $(MTHREAD_FLAG)