Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

223 lines
9.2 KiB

  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. ##
  18. project(lora-mac)
  19. cmake_minimum_required(VERSION 3.6)
  20. #---------------------------------------------------------------------------------------
  21. # Options
  22. #---------------------------------------------------------------------------------------
  23. # Allow switching of target platform
  24. set(BOARD_LIST NAMote72 NucleoL073 NucleoL152 NucleoL476 SAMR34 SKiM880B SKiM980A SKiM881AXL B-L072Z-LRWAN1)
  25. set(BOARD NucleoL073 CACHE STRING "Default target platform is NucleoL073")
  26. set_property(CACHE BOARD PROPERTY STRINGS ${BOARD_LIST})
  27. # Allow switching of MBED shields
  28. set(MBED_RADIO_SHIELD_LIST SX1272MB2DAS SX1276MB1LAS SX1276MB1MAS SX1261MBXBAS SX1262MBXCAS SX1262MBXDAS )
  29. set(MBED_RADIO_SHIELD SX1261MBXBAS CACHE STRING "Default MBED radio shield is SX1261MBXBAS")
  30. set_property(CACHE MBED_RADIO_SHIELD PROPERTY STRINGS ${MBED_RADIO_SHIELD_LIST})
  31. # Allow switching of secure-elements
  32. set(SECURE_ELEMENT_LIST SOFT_SE LR1110_SE)
  33. set(SECURE_ELEMENT SOFT_SE CACHE STRING "Default secure element is SOFT_SE")
  34. set_property(CACHE SECURE_ELEMENT PROPERTY STRINGS ${SECURE_ELEMENT_LIST})
  35. # Allow switching of Applications
  36. set(APPLICATION_LIST LoRaMac ping-pong rx-sensi tx-cw )
  37. set(APPLICATION LoRaMac CACHE STRING "Default Application is LoRaMac")
  38. set_property(CACHE APPLICATION PROPERTY STRINGS ${APPLICATION_LIST})
  39. # Switch for USB-Uart support, enable it for some Applications who needs it.
  40. option(USE_USB_CDC "Use USB-Uart" OFF)
  41. # Switch for debugger support.
  42. option(USE_DEBUGGER "Use Debugger" ON)
  43. # Switch for Class B support of LoRaMac.
  44. option(CLASSB_ENABLED "Class B support of LoRaMac" OFF)
  45. #---------------------------------------------------------------------------------------
  46. # Target Boards
  47. #---------------------------------------------------------------------------------------
  48. if(BOARD STREQUAL NAMote72)
  49. # Configure toolchain for NAMote72
  50. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72/cmsis/arm-gcc/stm32l152xc_flash.ld)
  51. include(stm32l1)
  52. # Build platform specific board implementation
  53. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NAMote72)
  54. # Configure radio
  55. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  56. elseif(BOARD STREQUAL NucleoL073)
  57. # Configure toolchain for NucleoL073
  58. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073/cmsis/arm-gcc/stm32l073xx_flash.ld)
  59. include(stm32l0)
  60. # Build platform specific board implementation
  61. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL073)
  62. # Configure radio
  63. if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS)
  64. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  65. elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS)
  66. set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
  67. elseif(MBED_RADIO_SHIELD STREQUAL SX1261MBXBAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXCAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXDAS)
  68. set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected")
  69. elseif(MBED_RADIO_SHIELD STREQUAL LR1110MB1XXS)
  70. set(RADIO lr1110 CACHE INTERNAL "Radio lr1110 selected")
  71. else()
  72. message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261MBXBAS, SX1262MBXCAS, SX1262MBXDAS and LR1110MB1XXS.")
  73. endif()
  74. elseif(BOARD STREQUAL NucleoL152)
  75. # Configure toolchain for NucleoL152
  76. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152/cmsis/arm-gcc/stm32l152xe_flash.ld)
  77. include(stm32l1)
  78. # Build platform specific board implementation
  79. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL152)
  80. # Configure radio
  81. if(MBED_RADIO_SHIELD STREQUAL SX1272MB2DAS)
  82. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  83. elseif(MBED_RADIO_SHIELD STREQUAL SX1276MB1LAS OR MBED_RADIO_SHIELD STREQUAL SX1276MB1MAS)
  84. set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
  85. elseif(MBED_RADIO_SHIELD STREQUAL SX1261MBXBAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXCAS OR MBED_RADIO_SHIELD STREQUAL SX1262MBXDAS)
  86. set(RADIO sx126x CACHE INTERNAL "Radio sx126x selected")
  87. elseif(MBED_RADIO_SHIELD STREQUAL LR1110MB1XXS)
  88. set(RADIO lr1110 CACHE INTERNAL "Radio lr1110 selected")
  89. else()
  90. message(STATUS "Please specify the MBED_RADIO_SHIELD!\nPossible values are: SX1272MB2DAS, SX1276MB1LAS, SX1276MB1MAS, SX1261MBXBAS, SX1262MBXCAS, SX1262MBXDAS and LR1110MB1XXS.")
  91. endif()
  92. elseif(BOARD STREQUAL NucleoL476)
  93. # Configure toolchain for NucleoL476
  94. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL476/cmsis/arm-gcc/stm32l476rgtx_flash.ld)
  95. include(stm32l4)
  96. # Build platform specific board implementation
  97. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/NucleoL476)
  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. elseif(BOARD STREQUAL SAMR34)
  111. # Configure toolchain for SAMR34
  112. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/mcu/saml21/saml21b/gcc/gcc/saml21j18b_flash.ld)
  113. include(samr34)
  114. # Build platform specific board implementation
  115. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SAMR34)
  116. # Configure radio
  117. set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
  118. elseif(BOARD STREQUAL SKiM880B)
  119. # Configure toolchain for SKiM881AXL
  120. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM880B/cmsis/arm-gcc/stm32l151xba_flash.ld)
  121. include(stm32l1)
  122. # Build platform specific board implementation
  123. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM880B)
  124. # Configure radio
  125. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  126. elseif(BOARD STREQUAL SKiM980A)
  127. # Configure toolchain for SKiM881AXL
  128. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM980A/cmsis/arm-gcc/stm32l151xba_flash.ld)
  129. include(stm32l1)
  130. # Build platform specific board implementation
  131. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM980A)
  132. # Configure radio
  133. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  134. elseif(BOARD STREQUAL SKiM881AXL)
  135. # Configure toolchain for SKiM881AXL
  136. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM881AXL/cmsis/arm-gcc/stm32l081xx_flash.ld)
  137. include(stm32l0)
  138. # Build platform specific board implementation
  139. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/SKiM881AXL)
  140. # Configure radio
  141. set(RADIO sx1272 CACHE INTERNAL "Radio sx1272 selected")
  142. elseif(BOARD STREQUAL B-L072Z-LRWAN1)
  143. # Configure toolchain for B-L072Z-LRWAN1
  144. set(LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/boards/B-L072Z-LRWAN1/cmsis/arm-gcc/stm32l072xx_flash.ld)
  145. include(stm32l0)
  146. # Build platform specific board implementation
  147. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards/B-L072Z-LRWAN1)
  148. # Configure radio
  149. set(RADIO sx1276 CACHE INTERNAL "Radio sx1276 selected")
  150. endif()
  151. #---------------------------------------------------------------------------------------
  152. # General Components
  153. #---------------------------------------------------------------------------------------
  154. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/boards)
  155. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/radio)
  156. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/system)
  157. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/mac)
  158. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/peripherals)
  159. #---------------------------------------------------------------------------------------
  160. # Applications
  161. #---------------------------------------------------------------------------------------
  162. if(APPLICATION STREQUAL LoRaMac)
  163. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/LoRaMac)
  164. elseif(APPLICATION STREQUAL ping-pong)
  165. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/ping-pong)
  166. elseif(APPLICATION STREQUAL rx-sensi)
  167. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/rx-sensi)
  168. elseif(APPLICATION STREQUAL tx-cw)
  169. add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/apps/tx-cw)
  170. endif()