1## 2## ______ _ 3## / _____) _ | | 4## ( (____ _____ ____ _| |_ _____ ____| |__ 5## \____ \| ___ | (_ _) ___ |/ ___) _ \ 6## _____) ) ____| | | || |_| ____( (___| | | | 7## (______/|_____)_|_|_| \__)_____)\____)_| |_| 8## (C)2013-2017 Semtech 9## ___ _____ _ ___ _ _____ ___ ___ ___ ___ 10## / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __| 11## \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _| 12## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___| 13## embedded.connectivity.solutions.============== 14## 15## License: Revised BSD License, see LICENSE.TXT file included in the project 16## Authors: Johannes Bruder (STACKFORCE), Miguel Luis (Semtech) 17## 18project(lora-mac) 19cmake_minimum_required(VERSION 3.6) 20 21#--------------------------------------------------------------------------------------- 22# Options 23#--------------------------------------------------------------------------------------- 24 25# Allow switching of target platform 26set(BOARD_LIST NAMote72 NucleoL073 NucleoL152 NucleoL476 SAMR34 SKiM880B SKiM980A SKiM881AXL B-L072Z-LRWAN1) 27set(BOARD NucleoL073 CACHE STRING "Default target platform is NucleoL073") 28set_property(CACHE BOARD PROPERTY STRINGS ${BOARD_LIST}) 29 30# Allow switching of MBED shields 31set(MBED_RADIO_SHIELD_LIST SX1272MB2DAS SX1276MB1LAS SX1276MB1MAS SX1261MBXBAS SX1262MBXCAS SX1262MBXDAS ) 32set(MBED_RADIO_SHIELD SX1261MBXBAS CACHE STRING "Default MBED radio shield is SX1261MBXBAS") 33set_property(CACHE MBED_RADIO_SHIELD PROPERTY STRINGS ${MBED_RADIO_SHIELD_LIST}) 34 35# Allow switching of secure-elements 36set(SECURE_ELEMENT_LIST SOFT_SE LR1110_SE) 37set(SECURE_ELEMENT SOFT_SE CACHE STRING "Default secure element is SOFT_SE") 38set_property(CACHE SECURE_ELEMENT PROPERTY STRINGS ${SECURE_ELEMENT_LIST}) 39 40# Allow switching of Applications 41set(APPLICATION_LIST LoRaMac ping-pong rx-sensi tx-cw ) 42set(APPLICATION LoRaMac CACHE STRING "Default Application is LoRaMac") 43set_property(CACHE APPLICATION PROPERTY STRINGS ${APPLICATION_LIST}) 44 45# Switch for USB-Uart support, enable it for some Applications who needs it. 46option(USE_USB_CDC "Use USB-Uart" OFF) 47 48# Switch for debugger support. 49option(USE_DEBUGGER "Use Debugger" ON) 50 51# Switch for Class B support of LoRaMac. 52option(CLASSB_ENABLED "Class B support of LoRaMac" OFF) 53 54#--------------------------------------------------------------------------------------- 55# Target Boards 56#--------------------------------------------------------------------------------------- 57 58if(BOARD STREQUAL NAMote72) 59 # Configure toolchain for NAMote72 60 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72/cmsis/arm-gcc/stm32l152xc_flash.ld) 61 include(stm32l1) 62 63 # Build platform specific board implementation 64 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72) 65 66 # Configure radio 67 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 68 69elseif(BOARD STREQUAL NucleoL073) 70 # Configure toolchain for NucleoL073 71 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073/cmsis/arm-gcc/stm32l073xx_flash.ld) 72 include(stm32l0) 73 74 # Build platform specific board implementation 75 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073) 76 77 # Configure radio 78 if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS) 79 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 80 elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS) 81 set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected") 82 elseif(MBED_RADIO_SHIELD STREQUAL SX1261MBXBAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXCAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXDAS) 83 set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected") 84 elseif(MBED_RADIO_SHIELD STREQUAL LR1110MB1XXS) 85 set(RADIO lr1110 CACHE INTERNAL "Radio lr1110 selected") 86 else() 87 message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261MBXBAS, SX1262MBXCAS, SX1262MBXDAS and LR1110MB1XXS.") 88 endif() 89 90elseif(BOARD STREQUAL NucleoL152) 91 # Configure toolchain for NucleoL152 92 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152/cmsis/arm-gcc/stm32l152xe_flash.ld) 93 include(stm32l1) 94 95 # Build platform specific board implementation 96 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152) 97 98 # Configure radio 99 if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS) 100 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 101 elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS) 102 set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected") 103 elseif(MBED_RADIO_SHIELD STREQUAL SX1261MBXBAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXCAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXDAS) 104 set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected") 105 elseif(MBED_RADIO_SHIELD STREQUAL LR1110MB1XXS) 106 set(RADIO lr1110 CACHE INTERNAL "Radio lr1110 selected") 107 else() 108 message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261MBXBAS, SX1262MBXCAS, SX1262MBXDAS and LR1110MB1XXS.") 109 endif() 110 111elseif(BOARD STREQUAL NucleoL476) 112 # Configure toolchain for NucleoL476 113 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL476/cmsis/arm-gcc/stm32l476rgtx_flash.ld) 114 include(stm32l4) 115 116 # Build platform specific board implementation 117 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL476) 118 119 # Configure radio 120 if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS) 121 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 122 elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS) 123 set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected") 124 elseif(MBED_RADIO_SHIELD STREQUAL SX1261MBXBAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXCAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXDAS) 125 set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected") 126 elseif(MBED_RADIO_SHIELD STREQUAL LR1110MB1XXS) 127 set(RADIO lr1110 CACHE INTERNAL "Radio lr1110 selected") 128 else() 129 message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261MBXBAS, SX1262MBXCAS, SX1262MBXDAS and LR1110MB1XXS.") 130 endif() 131 132elseif(BOARD STREQUAL SAMR34) 133 # Configure toolchain for SAMR34 134 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/mcu/saml21/saml21b/gcc/gcc/saml21j18b_flash.ld) 135 include(samr34) 136 137 # Build platform specific board implementation 138 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SAMR34) 139 140 # Configure radio 141 set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected") 142 143elseif(BOARD STREQUAL SKiM880B) 144 # Configure toolchain for SKiM881AXL 145 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM880B/cmsis/arm-gcc/stm32l151xba_flash.ld) 146 include(stm32l1) 147 148 # Build platform specific board implementation 149 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM880B) 150 151 # Configure radio 152 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 153 154elseif(BOARD STREQUAL SKiM980A) 155 # Configure toolchain for SKiM881AXL 156 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM980A/cmsis/arm-gcc/stm32l151xba_flash.ld) 157 include(stm32l1) 158 159 # Build platform specific board implementation 160 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM980A) 161 162 # Configure radio 163 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 164 165elseif(BOARD STREQUAL SKiM881AXL) 166 # Configure toolchain for SKiM881AXL 167 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM881AXL/cmsis/arm-gcc/stm32l081xx_flash.ld) 168 include(stm32l0) 169 170 # Build platform specific board implementation 171 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM881AXL) 172 173 # Configure radio 174 set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected") 175 176elseif(BOARD STREQUAL B-L072Z-LRWAN1) 177 # Configure toolchain for B-L072Z-LRWAN1 178 set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/B-L072Z-LRWAN1/cmsis/arm-gcc/stm32l072xx_flash.ld) 179 include(stm32l0) 180 181 # Build platform specific board implementation 182 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/B-L072Z-LRWAN1) 183 184 # Configure radio 185 set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected") 186endif() 187 188#--------------------------------------------------------------------------------------- 189# General Components 190#--------------------------------------------------------------------------------------- 191 192add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards) 193 194add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/radio) 195 196add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/system) 197 198add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mac) 199 200add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/peripherals) 201 202#--------------------------------------------------------------------------------------- 203# Applications 204#--------------------------------------------------------------------------------------- 205 206if(APPLICATION STREQUAL LoRaMac) 207 208 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/LoRaMac) 209 210elseif(APPLICATION STREQUAL ping-pong) 211 212 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/ping-pong) 213 214elseif(APPLICATION STREQUAL rx-sensi) 215 216 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/rx-sensi) 217 218elseif(APPLICATION STREQUAL tx-cw) 219 220 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/tx-cw) 221 222endif() 223