forked from Lora-net/LoRaMac-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
210 lines (158 loc) · 8.5 KB
/
CMakeLists.txt
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
##
## ______ _
## / _____) _ | |
## ( (____ _____ ____ _| |_ _____ ____| |__
## \____ \| ___ | (_ _) ___ |/ ___) _ \
## _____) ) ____| | | || |_| ____( (___| | | |
## (______/|_____)_|_|_| \__)_____)\____)_| |_|
## (C)2013-2017 Semtech
## ___ _____ _ ___ _ _____ ___ ___ ___ ___
## / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
## \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
## embedded.connectivity.solutions.==============
##
## License: Revised BSD License, see LICENSE.TXT file included in the project
## Authors: Johannes Bruder (STACKFORCE), Miguel Luis (Semtech)
##
project(lora-mac)
cmake_minimum_required(VERSION 3.6)
#---------------------------------------------------------------------------------------
# Options
#---------------------------------------------------------------------------------------
# Allow switching of target platform
set(BOARD_LIST LoRaMote MoteII NAMote72 SensorNode SK-iM880A NucleoL073 NucleoL152 SAML21)
set(BOARD LoRaMote CACHE STRING "Default target platform is LoRaMote")
set_property(CACHE BOARD PROPERTY STRINGS ${BOARD_LIST})
# Allow switching of MBED shields
set(MBED_RADIO_SHIELD_LIST SX1272MB2DAS SX1276MB1LAS SX1276MB1MAS SX1261DVK1BAS SX1262DVK1CAS SX1262DVK1DAS )
set(MBED_RADIO_SHIELD SX1261DVK1BAS CACHE STRING "Default MBED radio shield is SX1261DVK1BAS")
set_property(CACHE MBED_RADIO_SHIELD PROPERTY STRINGS ${MBED_RADIO_SHIELD_LIST})
# Allow switching of Applications
set(APPLICATION_LIST LoRaMac ping-pong rx-sensi tx-cw BootLoader)
set(APPLICATION LoRaMac CACHE STRING "Default Application is LoRaMac")
set_property(CACHE APPLICATION PROPERTY STRINGS ${APPLICATION_LIST})
# Switch for USB-Uart support, enable it for some Applications who needs it.
option(USE_USB_CDC "Use USB-Uart" OFF)
# Switch for bootloader support.
option(USE_BOOTLOADER "Use Bootloader" OFF)
# Switch for debugger support.
option(USE_DEBUGGER "Use Debugger" ON)
#---------------------------------------------------------------------------------------
# Target Boards
#---------------------------------------------------------------------------------------
if(BOARD STREQUAL LoRaMote)
# Configure toolchain for LoRaMote
if(APPLICATION STREQUAL BootLoader)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/LoRaMote/cmsis/arm-gcc/stm32l151xb_flash_bootloader.ld)
elseif(USE_BOOTLOADER)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SensorNode/cmsis/arm-gcc/stm32l151xb_flash_offset.ld)
else()
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/LoRaMote/cmsis/arm-gcc/stm32l151xb_flash.ld)
endif()
include(stm32l1)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/LoRaMote)
# Configure radio
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(BOARD STREQUAL MoteII)
# Configure toolchain for MoteII
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/MoteII/cmsis/arm-gcc/stm32l051xx_flash.ld)
include(stm32l0)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/MoteII)
# Configure radio
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(BOARD STREQUAL SensorNode)
# Configure toolchain for SensorNode
if(APPLICATION STREQUAL BootLoader)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SensorNode/cmsis/arm-gcc/stm32l151xb_flash_bootloader.ld)
elseif(USE_BOOTLOADER)
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SensorNode/cmsis/arm-gcc/stm32l151xb_flash_offset.ld)
else()
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SensorNode/cmsis/arm-gcc/stm32l151xb_flash.ld)
endif()
include(stm32l1)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SensorNode)
# Configure radio
set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
elseif(BOARD STREQUAL SK-iM880A)
# Configure toolchain for LoRaMote
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SK-iM880A/cmsis/arm-gcc/stm32l151xb_flash.ld)
include(stm32l1)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SK-iM880A)
# Configure radio
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(BOARD STREQUAL NAMote72)
# Configure toolchain for LoRaMote
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72/cmsis/arm-gcc/stm32l152xc_flash.ld)
include(stm32l1)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72)
# Configure radio
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(BOARD STREQUAL NucleoL073)
# Configure toolchain for NucleoL073
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073/cmsis/arm-gcc/stm32l073xx_flash.ld)
include(stm32l0)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073)
# Configure radio
if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS)
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS)
set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
elseif(MBED_RADIO_SHIELD STREQUAL SX1261DVK1BAS OR MBED_RADIO_SHIELD STREQUAL SX1262DVK1CAS OR MBED_RADIO_SHIELD STREQUAL SX1262DVK1DAS)
set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected")
else()
message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261DVK1BAS, SX1262DVK1CAS and SX1262DVK1DAS.")
endif()
elseif(BOARD STREQUAL NucleoL152)
# Configure toolchain for NucleoL152
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152/cmsis/arm-gcc/stm32l152xe_flash.ld)
include(stm32l1)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152)
# Configure radio
if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS)
set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS)
set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
elseif(MBED_RADIO_SHIELD STREQUAL SX1261DVK1BAS OR MBED_RADIO_SHIELD STREQUAL SX1262DVK1CAS OR MBED_RADIO_SHIELD STREQUAL SX1262DVK1DAS)
set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected")
else()
message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261DVK1BAS, SX1262DVK1CAS and SX1262DVK1DAS.")
endif()
elseif(BOARD STREQUAL SAML21)
# Configure toolchain for SAML21
set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/mcu/saml21/saml21b/gcc/gcc/saml21j18b_flash.ld)
include(saml21)
# Build platform specific board implementation
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SAML21)
# Configure radio
set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
endif()
#---------------------------------------------------------------------------------------
# General Components
#---------------------------------------------------------------------------------------
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/radio)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/system)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mac)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/peripherals)
#---------------------------------------------------------------------------------------
# Applications
#---------------------------------------------------------------------------------------
if(APPLICATION STREQUAL LoRaMac)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/LoRaMac)
elseif(APPLICATION STREQUAL ping-pong)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/ping-pong)
elseif(APPLICATION STREQUAL rx-sensi)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/rx-sensi)
elseif(APPLICATION STREQUAL tx-cw)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/tx-cw)
elseif(APPLICATION STREQUAL BootLoader)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/BootLoader)
endif()