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.
 
 
 
 
 
 

102 lines
4.8 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. ## Collection of functions to generate different GDB debugging configurations
  19. ##
  20. # Get the path of this module
  21. set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})
  22. #---------------------------------------------------------------------------------------
  23. # Set tools
  24. #---------------------------------------------------------------------------------------
  25. set(GDB_BIN ${TOOLCHAIN_BIN_DIR}/${TOOLCHAIN}-gdb${TOOLCHAIN_EXT})
  26. if(NOT OPENOCD_BIN)
  27. if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
  28. set(OPENOCD_BIN "/usr/bin/openocd" CACHE STRING "OpenOCD executable")
  29. elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
  30. set(OPENOCD_BIN "/usr/local/bin/openocd" CACHE STRING "OpenOCD executable")
  31. elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
  32. set(OPENOCD_BIN "C:/openocd/bin/openocd.exe" CACHE STRING "OpenOCD executable")
  33. endif()
  34. endif()
  35. #---------------------------------------------------------------------------------------
  36. # Generates a GDB run script for debugging with STLINKv1/v2/v2-1 programmer and texane stlink tool.
  37. # More infos check: https://github.com/texane/stlink
  38. #---------------------------------------------------------------------------------------
  39. function(generate_run_gdb_stlink TARGET)
  40. get_target_property( TARGET_NAME ${TARGET} NAME )
  41. configure_file(${CURRENT_MODULE_DIR}/stlink-run.gdb.in ${PROJECT_BINARY_DIR}/stlink-run.gdb @ONLY)
  42. endfunction()
  43. #---------------------------------------------------------------------------------------
  44. # Generates a GDB run script for debugging with any supported programmer and openOCD.
  45. #---------------------------------------------------------------------------------------
  46. function(generate_run_gdb_openocd TARGET)
  47. get_target_property( TARGET_NAME ${TARGET} NAME )
  48. configure_file(${CURRENT_MODULE_DIR}/openocd-run.gdb.in ${PROJECT_BINARY_DIR}/openocd-run.gdb @ONLY)
  49. endfunction()
  50. #---------------------------------------------------------------------------------------
  51. # Generates a Visual Studio Code launch configuration for debugging with openOCD.
  52. #---------------------------------------------------------------------------------------
  53. function(generate_vscode_launch_openocd TARGET)
  54. get_target_property( TARGET_NAME ${TARGET} NAME )
  55. # Available OpenOCD interfaces
  56. # Use stlink-v2-1.cfg when stlink interface is built in. Otherwise use stlink-v2.cfg
  57. set(OPENOCD_INTERFACE_LIST stlink-v2-1.cfg stlink-v2.cfg)
  58. set(OPENOCD_INTERFACE stlink-v2.cfg CACHE STRING "Default OPENOCD Interface is stlink-v2.cfg")
  59. set_property(CACHE OPENOCD_INTERFACE PROPERTY STRINGS ${OPENOCD_INTERFACE_LIST})
  60. # Available OpenOCD targets
  61. set(OPENOCD_TARGET_LIST stm32l0.cfg stm32l1.cfg)
  62. set(OPENOCD_TARGET stm32l1.cfg CACHE STRING "Default OPENOCD Target is stm32l1.cfg")
  63. set_property(CACHE OPENOCD_TARGET PROPERTY STRINGS ${OPENOCD_TARGET_LIST})
  64. # Available OpenOCD targets
  65. set(OPENOCD_BOARD_LIST atmel_saml21_xplained_pro.cfg )
  66. set(OPENOCD_BOARD atmel_saml21_xplained_pro.cfg CACHE STRING "Default OPENOCD board is atmel_saml21_xplained_pro.cfg")
  67. set_property(CACHE OPENOCD_BOARD PROPERTY STRINGS ${OPENOCD_BOARD_LIST})
  68. # Set the OPENOCD_TARGET and OPENOCD_INTERFACE variables according to BOARD
  69. if(BOARD STREQUAL NAMote72 OR BOARD STREQUAL NucleoL152)
  70. set(OPENOCD_INTERFACE stlink-v2-1.cfg)
  71. set(OPENOCD_TARGET stm32l1.cfg)
  72. elseif(BOARD STREQUAL NucleoL073 OR BOARD STREQUAL B-L072Z-LRWAN1)
  73. set(OPENOCD_INTERFACE stlink-v2-1.cfg)
  74. set(OPENOCD_TARGET stm32l0.cfg)
  75. elseif(BOARD STREQUAL NucleoL476)
  76. set(OPENOCD_INTERFACE stlink-v2-1.cfg)
  77. set(OPENOCD_TARGET stm32l4x.cfg)
  78. elseif(BOARD STREQUAL SKiM880B OR BOARD STREQUAL SKiM980A)
  79. set(OPENOCD_INTERFACE stlink-v2.cfg)
  80. set(OPENOCD_TARGET stm32l1.cfg)
  81. elseif(BOARD STREQUAL SKiM881AXL)
  82. set(OPENOCD_INTERFACE stlink-v2.cfg)
  83. set(OPENOCD_TARGET stm32l0.cfg)
  84. elseif(BOARD STREQUAL SAMR34)
  85. set(OPENOCD_INTERFACE cmsis-dap.cfg)
  86. set(OPENOCD_TARGET at91samdXX.cfg)
  87. endif()
  88. configure_file(${CURRENT_MODULE_DIR}/launch.json.in ${CMAKE_SOURCE_DIR}/.vscode/launch.json @ONLY)
  89. endfunction()