diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..7199123f4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,46 @@ +# Copyright (c) 2020 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) + +set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "") +set(MBED_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.mbedbuild CACHE INTERNAL "") +set(APP_TARGET mbed-os-example-lorawan) + +include(${MBED_PATH}/tools/cmake/app.cmake) + +add_subdirectory(${MBED_PATH}) + +add_executable(${APP_TARGET}) + +mbed_configure_app_target(${APP_TARGET}) + +mbed_set_mbed_target_linker_script(${APP_TARGET}) + +project(${APP_TARGET}) + +# Provide Mbed OS with the header file it needs to configure Mbed TLS for LoRa +target_include_directories(${APP_TARGET} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_sources(${APP_TARGET} + PRIVATE + main.cpp + trace_helper.cpp +) + +target_link_libraries(${APP_TARGET} + PRIVATE + mbed-os + mbed-lorawan + mbed-mbedtls +) + +mbed_set_post_build(${APP_TARGET}) + +option(VERBOSE_BUILD "Have a verbose build process") +if(VERBOSE_BUILD) + set(CMAKE_VERBOSE_MAKEFILE ON) +endif() diff --git a/config/SX126X_example_config.json b/config/SX126X_example_config.json index ac51b4f63..9f2c5ac65 100644 --- a/config/SX126X_example_config.json +++ b/config/SX126X_example_config.json @@ -30,7 +30,8 @@ "lora.phy": "EU868", "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", - "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }" + "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", + "target.components_add": ["SX126X"] }, "NUCLEO_L073RZ": { diff --git a/config/SX127X_example_config.json b/config/SX127X_example_config.json index 17f363995..8613c32d4 100644 --- a/config/SX127X_example_config.json +++ b/config/SX127X_example_config.json @@ -36,7 +36,8 @@ "lora.phy": "EU868", "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", - "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }" + "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", + "target.components_add": ["SX1276"] }, "K64F": { @@ -80,7 +81,8 @@ "lora-rxctl": "PA_1", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "PC_1", - "lora-tcxo": "PA_12" + "lora-tcxo": "PA_12", + "target.components_add": ["SX1276"] }, "MTB_MURATA_ABZ": { @@ -103,7 +105,8 @@ "lora-rxctl": "PA_1", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "PC_1", - "lora-tcxo": "PA_12" + "lora-tcxo": "PA_12", + "target.components_add": ["SX1276"] }, "XDOT_L151CC": { @@ -125,7 +128,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTB_MTS_XDOT": { @@ -147,7 +151,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "FF1705_L151CC": { @@ -169,7 +174,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTS_MDOT_F411RE": { @@ -191,7 +197,8 @@ "lora-rxctl": "LORA_RXCTL", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTB_ADV_WISE_1510": { @@ -213,7 +220,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "ANT_SWITCH", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1276"] }, "MTB_RAK811": { @@ -235,7 +243,8 @@ "lora-rxctl": "ANT_CRX_RX", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "RF_TCXO_EN" + "lora-tcxo": "RF_TCXO_EN", + "target.components_add": ["SX1276"] }, "IM880B": { @@ -258,7 +267,8 @@ "lora-rxctl": "ANT_CRX_RX", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] } }, "macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_lora_config.h\""] diff --git a/mbed_app.json b/mbed_app.json index 252a04250..1ecf6b401 100644 --- a/mbed_app.json +++ b/mbed_app.json @@ -36,7 +36,8 @@ "lora.phy": "EU868", "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", - "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }" + "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", + "target.components_add": ["SX1276"] }, "K64F": { @@ -80,7 +81,8 @@ "lora-rxctl": "PA_1", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "PC_1", - "lora-tcxo": "PA_12" + "lora-tcxo": "PA_12", + "target.components_add": ["SX1276"] }, "MTB_MURATA_ABZ": { @@ -103,7 +105,8 @@ "lora-rxctl": "PA_1", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "PC_1", - "lora-tcxo": "PA_12" + "lora-tcxo": "PA_12", + "target.components_add": ["SX1276"] }, "XDOT_L151CC": { @@ -125,7 +128,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTB_MTS_XDOT": { @@ -147,7 +151,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "FF1705_L151CC": { @@ -169,7 +174,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTS_MDOT_F411RE": { @@ -191,7 +197,8 @@ "lora-rxctl": "LORA_RXCTL", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "MTB_ADV_WISE_1510": { @@ -213,7 +220,8 @@ "lora-rxctl": "NC", "lora-ant-switch": "ANT_SWITCH", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1276"] }, "MTB_RAK811": { @@ -235,7 +243,8 @@ "lora-rxctl": "ANT_CRX_RX", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "RF_TCXO_EN" + "lora-tcxo": "RF_TCXO_EN", + "target.components_add": ["SX1276"] }, "IM880B": { @@ -258,7 +267,8 @@ "lora-rxctl": "ANT_CRX_RX", "lora-ant-switch": "NC", "lora-pwr-amp-ctl": "NC", - "lora-tcxo": "NC" + "lora-tcxo": "NC", + "target.components_add": ["SX1272"] }, "EP_AGORA": {