Skip to content

Commit

Permalink
test-lorawan initial commit based on https://github.com/ARMmbed/mbed-…
Browse files Browse the repository at this point in the history
  • Loading branch information
rudcode committed Jan 3, 2024
1 parent 7b7ae5e commit 8c0a937
Show file tree
Hide file tree
Showing 23 changed files with 6,485 additions and 0 deletions.
46 changes: 46 additions & 0 deletions src/mbedos/test-lorawan/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.a

# Executables
*.exe
*.out
*.app

# clion
.idea/
cmake-build-*/

# exporters
GettingStarted.html

# mbed build system
mbed_settings.py
mbed_config.h
*.pyc
BUILD/
cmake_build/

BUILD
.mbed
mbed-os/
stm32customtargets/
141 changes: 141 additions & 0 deletions src/mbedos/test-lorawan/custom_targets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"BLUEPILL_F103C8": {
"inherits": [
"MCU_STM32F103x8"
],
"overrides": {
"clock_source": "USE_PLL_HSE_XTAL"
},
"device_has_add": [
"USBDEVICE"
],
"device_name": "STM32F103C8"
},
"MTB_MURATA_ABZ": {
"inherits": [
"MCU_STM32L082xZ"
],
"detect_code": ["0456"],
"device_name": "STM32L082CZYx"
},
"GRASSHOPPER": {
"inherits": [
"MTB_MURATA_ABZ"
]
},
"GNAT": {
"inherits": [
"MTB_MURATA_ABZ"
]
},
"STWIN": {
"inherits": [
"MCU_STM32L4R9xI"
],
"device_name": "STM32L4R9ZITx",
"supported_form_factors": [
"STMOD"
],
"components_add": [
"BlueNRG_MS"
],
"extra_labels_add": [
"CORDIO"
],
"features": [
"BLE"
]
},
"LORA_E5": {
"inherits": [
"MCU_STM32WLE5xC"
],
"device_name": "STM32WLE5JCIx"
},
"LORA_E5_BREAKOUT": {
"inherits": [
"LORA_E5"
],
"macros_add": [
"LED1=PB_5",
"LED2=PB_10",
"BUTTON1=PB_13"
]
},
"LORA_E5_MINI": {
"inherits": [
"LORA_E5"
],
"macros_add": [
"LED1=PB_5",
"BUTTON1=PB_13"
]
},
"LORA_E5_DEV_BOARD": {
"inherits": [
"LORA_E5"
],
"macros_add": [
"LED1=PB_5",
"EN_3V3=PA_9",
"EN_5V=PB_10",
"BUTTON1=PB_13",
"BUTTON2=PA_0",
"RS485_REDE=PB_4"
]
},
"LORA_E5_TINY": {
"inherits": [
"LORA_E5"
],
"macros_add": [
"LED1=PA_9",
"LED2=PB_13",
"BUTTON1=PB_4"
]
},
"RAK3172": {
"inherits": [
"MCU_STM32WLE5xC"
],
"device_name": "STM32WLE5CCUx"
},
"RAK3172_BREAKOUT": {
"inherits": [
"RAK3172"
],
"macros_add": [
"LED1=PA_9",
"LED2=PA_10"
]
},
"RAK3172SIP": {
"inherits": [
"MCU_STM32WLE5xC"
],
"device_name": "STM32WLE5CCUx"
},
"RAK3272_BREAKOUT": {
"inherits": [
"RAK3172SIP"
]
},
"CORE2":
{
"inherits": ["MCU_STM32F4"],
"extra_labels_add": ["STM32F407xG"],
"macros_add": [
"STM32F407xx",
"UPPER_RESISTOR=5.6e4",
"LOWER_RESISTOR=1.0e4",
"VIN_MEAS_CORRECTION=0.986"
],
"overrides": {
"lse_available": 0,
"clock_source": "USE_PLL_HSE_XTAL"
},
"device_has_add": ["TRNG", "CAN"],
"device_has_remove": ["LPTICKER"],
"device_name": "STM32F407ZG"
}
}
86 changes: 86 additions & 0 deletions src/mbedos/test-lorawan/lora_radio_helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef APP_LORA_RADIO_HELPER_H_
#define APP_LORA_RADIO_HELPER_H_

#include "lorawan/LoRaRadio.h"

#if COMPONENT_SX1272
#include "SX1272_LoRaRadio.h"
SX1272_LoRaRadio radio(MBED_CONF_SX1272_LORA_DRIVER_SPI_MOSI,
MBED_CONF_SX1272_LORA_DRIVER_SPI_MISO,
MBED_CONF_SX1272_LORA_DRIVER_SPI_SCLK,
MBED_CONF_SX1272_LORA_DRIVER_SPI_CS,
MBED_CONF_SX1272_LORA_DRIVER_RESET,
MBED_CONF_SX1272_LORA_DRIVER_DIO0,
MBED_CONF_SX1272_LORA_DRIVER_DIO1,
MBED_CONF_SX1272_LORA_DRIVER_DIO2,
MBED_CONF_SX1272_LORA_DRIVER_DIO3,
MBED_CONF_SX1272_LORA_DRIVER_DIO4,
MBED_CONF_SX1272_LORA_DRIVER_DIO5,
MBED_CONF_SX1272_LORA_DRIVER_RF_SWITCH_CTL1,
MBED_CONF_SX1272_LORA_DRIVER_RF_SWITCH_CTL2,
MBED_CONF_SX1272_LORA_DRIVER_TXCTL,
MBED_CONF_SX1272_LORA_DRIVER_RXCTL,
MBED_CONF_SX1272_LORA_DRIVER_ANT_SWITCH,
MBED_CONF_SX1272_LORA_DRIVER_PWR_AMP_CTL,
MBED_CONF_SX1272_LORA_DRIVER_TCXO);

#elif COMPONENT_SX1276
#include "SX1276_LoRaRadio.h"
SX1276_LoRaRadio radio(MBED_CONF_SX1276_LORA_DRIVER_SPI_MOSI,
MBED_CONF_SX1276_LORA_DRIVER_SPI_MISO,
MBED_CONF_SX1276_LORA_DRIVER_SPI_SCLK,
MBED_CONF_SX1276_LORA_DRIVER_SPI_CS,
MBED_CONF_SX1276_LORA_DRIVER_RESET,
MBED_CONF_SX1276_LORA_DRIVER_DIO0,
MBED_CONF_SX1276_LORA_DRIVER_DIO1,
MBED_CONF_SX1276_LORA_DRIVER_DIO2,
MBED_CONF_SX1276_LORA_DRIVER_DIO3,
MBED_CONF_SX1276_LORA_DRIVER_DIO4,
MBED_CONF_SX1276_LORA_DRIVER_DIO5,
MBED_CONF_SX1276_LORA_DRIVER_RF_SWITCH_CTL1,
MBED_CONF_SX1276_LORA_DRIVER_RF_SWITCH_CTL2,
MBED_CONF_SX1276_LORA_DRIVER_TXCTL,
MBED_CONF_SX1276_LORA_DRIVER_RXCTL,
MBED_CONF_SX1276_LORA_DRIVER_ANT_SWITCH,
MBED_CONF_SX1276_LORA_DRIVER_PWR_AMP_CTL,
MBED_CONF_SX1276_LORA_DRIVER_TCXO);

#elif COMPONENT_SX126X
#include "SX126X_LoRaRadio.h"
SX126X_LoRaRadio radio(MBED_CONF_SX126X_LORA_DRIVER_SPI_MOSI,
MBED_CONF_SX126X_LORA_DRIVER_SPI_MISO,
MBED_CONF_SX126X_LORA_DRIVER_SPI_SCLK,
MBED_CONF_SX126X_LORA_DRIVER_SPI_CS,
MBED_CONF_SX126X_LORA_DRIVER_RESET,
MBED_CONF_SX126X_LORA_DRIVER_DIO1,
MBED_CONF_SX126X_LORA_DRIVER_BUSY,
MBED_CONF_SX126X_LORA_DRIVER_FREQ_SELECT,
MBED_CONF_SX126X_LORA_DRIVER_DEVICE_SELECT,
MBED_CONF_SX126X_LORA_DRIVER_CRYSTAL_SELECT,
MBED_CONF_SX126X_LORA_DRIVER_ANT_SWITCH);

#elif (TARGET_STM32WL)
#include "STM32WL_LoRaRadio.h"
STM32WL_LoRaRadio radio;
#else
#error "Unknown LoRa radio specified (SX126X, SX1272, SX1276, STM32WL are valid)"
#endif

#endif /* APP_LORA_RADIO_HELPER_H_ */
1 change: 1 addition & 0 deletions src/mbedos/test-lorawan/mbed-os.lib
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/teapotlaboratories/mbed-os/#daf31245c4c87207bd3fd6a55302a7734305ca87
34 changes: 34 additions & 0 deletions src/mbedos/test-lorawan/mbed_app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"config": {
"main_stack_size": { "value": 4096 }
},
"target_overrides": {
"*": {
"platform.cpu-stats-enabled": 0,
"target.macros_add": ["MBED_TICKLESS", "MBED_SLEEP_TRACING_ENABLED", "DEVICE_I2C_FREE_DESTRUCTOR"],

"target.c_lib": "std",
"target.printf_lib": "std",
"platform.stdio-buffered-serial": 1,
"platform.stdio-convert-newlines": true,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200,

"mbed-trace.enable": false,
"mbed-trace.max-level": "TRACE_LEVEL_DEBUG",

"lora.over-the-air-activation": true,
"lora.duty-cycle-on": false,
"lora.phy": "US915",
"lora.device-eui": "{ 0xAC, 0x1F, 0x09, 0xFF, 0xFE, 0x0E, 0x39, 0xE8} ",
"lora.application-eui": "{ 0x0E, 0x0D, 0x0D, 0x01, 0x0E, 0x01, 0x02, 0x0E }",
"lora.application-key": "{ 0xb5, 0x12, 0xfb, 0x72, 0xfc, 0x87, 0x20, 0x2a, 0xb3, 0x90, 0xc1, 0xbe, 0x8e, 0x46, 0x99, 0xf6 }"
},
"RAK3172": {
"stm32wl-lora-driver.rf_switch_config": 2,
"stm32wl-lora-driver.crystal_select" : 0
}
},
"macros": ["MBEDTLS_USER_CONFIG_FILE=\"mbedtls_lora_config.h\""]
}

43 changes: 43 additions & 0 deletions src/mbedos/test-lorawan/mbedtls_lora_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MBEDTLS_LORA_CONFIG_H
#define MBEDTLS_LORA_CONFIG_H

/*
* Configure mbedtls for LoRa stack.
*
* These settings are just a customization of the main mbedtls config
* mbed-os/features/mbedtls/inc/mbedtls/config.h
*/

// Ensure LoRa required ciphers are enabled
#define MBEDTLS_CIPHER_C
#define MBEDTLS_AES_C
#define MBEDTLS_CMAC_C

// Reduce ROM usage by optimizing some mbedtls features.
// These are only reference configurations for this LoRa example application.
// Other LoRa applications might need different configurations.
#define MBEDTLS_AES_FEWER_TABLES

#undef MBEDTLS_GCM_C
#undef MBEDTLS_CHACHA20_C
#undef MBEDTLS_CHACHAPOLY_C
#undef MBEDTLS_POLY1305_C

#endif /* MBEDTLS_LORA_CONFIG_H */
Loading

0 comments on commit 8c0a937

Please sign in to comment.