From 257a5e9867b9a8645437c6e7b8d414768e00eb0f Mon Sep 17 00:00:00 2001 From: supowang Date: Thu, 30 Jul 2020 16:08:08 +0800 Subject: [PATCH] add pm25 LoRaWAN project add pm25 LoRaWAN project --- board/RHF0M0E5_STM32WLE5xx/BSP/Inc/mcu_init.h | 2 - board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c | 4 +- .../BSP/Src/stm32wlxx_it.c | 13 - .../BSP/Src/stm32wlxx_it_lora.c | 255 +++ .../KEIL/hello_world/TencentOS_Tiny.uvoptx | 2 +- .../KEIL/hello_world/stm32wle5xx_flash.sct | 18 - .../KEIL/lorawan/App/Commissioning.h | 4 +- .../KEIL/lorawan/App/app_lorawan.c | 31 +- .../KEIL/lorawan/App/mcu_init.c | 120 ++ .../KEIL/lorawan/App/stm32wlxx_it.c | 247 +++ .../KEIL/lorawan/TencentOS_Tiny.uvoptx | 230 +-- .../KEIL/lorawan/TencentOS_Tiny.uvprojx | 59 +- .../KEIL/lorawan_pm25/App/Commissioning.h | 94 + .../KEIL/lorawan_pm25/App/app_conf.h | 109 ++ .../KEIL/lorawan_pm25/App/app_lorawan.c | 413 ++++ .../KEIL/lorawan_pm25/App/app_lorawan.h | 57 + .../KEIL/lorawan_pm25/App/app_system.c | 129 ++ .../KEIL/lorawan_pm25/App/app_system.h | 71 + .../KEIL/lorawan_pm25/App/lorawan_version.h | 52 + .../KEIL/lorawan_pm25/App/mcu_init.c | 120 ++ .../lorawan_pm25/App}/sensor_parser.c | 0 .../lorawan_pm25/App}/sensor_parser.h | 0 .../KEIL/lorawan_pm25/App/stm32wlxx_it.c | 255 +++ .../KEIL/lorawan_pm25/Target/lorawan_conf.h | 91 + .../KEIL/lorawan_pm25/Target/mw_log_conf.h | 73 + .../KEIL/lorawan_pm25/Target/radio_conf.h | 64 + .../KEIL/lorawan_pm25/Target/systime.h | 41 + .../KEIL/lorawan_pm25/Target/timer.h | 72 + .../KEIL/lorawan_pm25/Target/timer_wrapper.c | 18 + .../KEIL/lorawan_pm25/Target/utilities_conf.h | 118 ++ .../KEIL/lorawan_pm25/TencentOS_Tiny.uvoptx | 1673 +++++++++++++++++ .../KEIL/lorawan_pm25/TencentOS_Tiny.uvprojx | 1017 ++++++++++ .../KEIL/lorawan_pm25/startup_stm32wle5xx.s | 359 ++++ 33 files changed, 5575 insertions(+), 236 deletions(-) create mode 100644 board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it_lora.c delete mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/stm32wle5xx_flash.sct create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/mcu_init.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/stm32wlxx_it.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/Commissioning.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_conf.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/lorawan_version.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/mcu_init.c rename board/RHF0M0E5_STM32WLE5xx/{BSP/Hardware/PM25 => KEIL/lorawan_pm25/App}/sensor_parser.c (100%) rename board/RHF0M0E5_STM32WLE5xx/{BSP/Hardware/PM25 => KEIL/lorawan_pm25/App}/sensor_parser.h (100%) create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/stm32wlxx_it.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/lorawan_conf.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/mw_log_conf.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/radio_conf.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/systime.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer_wrapper.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/utilities_conf.h create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvoptx create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvprojx create mode 100644 board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/startup_stm32wle5xx.s diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/mcu_init.h b/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/mcu_init.h index 87e54a08..4c637cff 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/mcu_init.h +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/mcu_init.h @@ -9,8 +9,6 @@ #include "gpio.h" #include "tos_k.h" #include "stdio.h" -#include "app_system.h" -#include "app_lorawan.h" void board_init(void); void SystemClock_Config(void); diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c index 58cc0de9..e89c8cfe 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c @@ -29,9 +29,7 @@ void board_init(void) { HAL_Init(); SystemClock_Config(); - - SystemApp_Init(); - MX_LoRaWAN_Init(); + MX_USART1_UART_Init(); } /** diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c index 6d5001dd..35d32e65 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c @@ -25,7 +25,6 @@ #include "main.h" #include "stm32wlxx_it.h" #include "tos_k.h" -#include "sensor_parser.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ @@ -234,22 +233,10 @@ void USART2_IRQHandler(void) /* USER CODE END LPUART1_IRQn 1 */ } -void Radio_IRQHandler(void) -{ - HAL_SUBGHZ_IRQHandler(&hsubghz); -} - /* USER CODE BEGIN 1 */ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { - extern uint8_t msg; - if(huart ->Instance == USART2) - { - tos_shell_input_byte(msg); - HAL_UART_Receive_IT(&huart2, (uint8_t*)&msg, 1); - - } } /* USER CODE END 1 */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it_lora.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it_lora.c new file mode 100644 index 00000000..6d5001dd --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it_lora.c @@ -0,0 +1,255 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file Templates/Src/stm32wlxx_it.c + * @author MCD Application Team + * @brief Main Interrupt Service Routines. + * This file provides template for all exceptions handler and + * peripherals interrupt service routine. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "stm32wlxx_it.h" +#include "tos_k.h" +#include "sensor_parser.h" +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* External variables --------------------------------------------------------*/ +extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart2; +extern SUBGHZ_HandleTypeDef hsubghz; +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/******************************************************************************/ +/* Cortex Processor Interruption and Exception Handlers */ +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + + /* USER CODE END NonMaskableInt_IRQn 1 */ +} + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + /* USER CODE BEGIN HardFault_IRQn 0 */ + + /* USER CODE END HardFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_HardFault_IRQn 0 */ + /* USER CODE END W1_HardFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ + /* USER CODE END W1_MemoryManagement_IRQn 0 */ + } +} + +/** + * @brief This function handles Prefetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + /* USER CODE BEGIN BusFault_IRQn 0 */ + + /* USER CODE END BusFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_BusFault_IRQn 0 */ + /* USER CODE END W1_BusFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + /* USER CODE BEGIN UsageFault_IRQn 0 */ + + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ + /* USER CODE END W1_UsageFault_IRQn 0 */ + } +} + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + /* USER CODE BEGIN SVCall_IRQn 0 */ + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + /* USER CODE BEGIN DebugMonitor_IRQn 0 */ + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + +/** + * @brief This function handles Pendable request for system service. + */ +__weak void PendSV_Handler(void) +{ + /* USER CODE BEGIN PendSV_IRQn 0 */ + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ + + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + if (tos_knl_is_running()) + { + tos_knl_irq_enter(); + tos_tick_handler(); + tos_knl_irq_leave(); + } + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + +/******************************************************************************/ +/* STM32WLxx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32wlxx.s). */ +/******************************************************************************/ + +void USART1_IRQHandler(void) +{ + /* USER CODE BEGIN USART1_IRQn 0 */ + + /* USER CODE END USART1_IRQn 0 */ + HAL_UART_IRQHandler(&huart1); + /* USER CODE BEGIN USART2_IRQn 1 */ + + /* USER CODE END USART2_IRQn 1 */ +} + +void USART2_IRQHandler(void) +{ + /* USER CODE BEGIN LPUART1_IRQn 0 */ + + /* USER CODE END LPUART1_IRQn 0 */ + tos_knl_irq_enter(); + HAL_UART_IRQHandler(&huart2); + tos_knl_irq_leave(); + /* USER CODE BEGIN LPUART1_IRQn 1 */ + + /* USER CODE END LPUART1_IRQn 1 */ +} + +void Radio_IRQHandler(void) +{ + HAL_SUBGHZ_IRQHandler(&hsubghz); +} + +/* USER CODE BEGIN 1 */ +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) +{ + extern uint8_t msg; + + if(huart ->Instance == USART2) + { + tos_shell_input_byte(msg); + HAL_UART_Receive_IT(&huart2, (uint8_t*)&msg, 1); + + } +} +/* USER CODE END 1 */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/TencentOS_Tiny.uvoptx b/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/TencentOS_Tiny.uvoptx index 45635ea3..d32cc64b 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/TencentOS_Tiny.uvoptx +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/TencentOS_Tiny.uvoptx @@ -159,7 +159,7 @@ 0 122 0 -
134244104
+
134235804
0 0 0 diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/stm32wle5xx_flash.sct b/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/stm32wle5xx_flash.sct deleted file mode 100644 index e0cb2bf6..00000000 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/hello_world/stm32wle5xx_flash.sct +++ /dev/null @@ -1,18 +0,0 @@ -; ************************************************************* -; *** Scatter-Loading Description File generated by uVision *** -; ************************************************************* - -LR_IROM1 0x08000000 0x00020000 { ; load region size_region - ER_IROM1 0x08000000 0x00020000 { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - } - RW_IRAM1 0x20000000 0x00008000 { ; RW data - .ANY (+RW +ZI) - } - RW_IRAM2 0x20008000 0x00008000 { - .ANY (+RW +ZI) - } -} - diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h index 9d12d9bf..c758ee8c 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h @@ -81,8 +81,8 @@ extern "C" { #define STATIC_DEVICE_EUI 1 //if 0 , using a ramdom EUI #define IEEE_OUI 0x01, 0x01, 0x01 -#define LORAWAN_DEVICE_EUI { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf7} -#define LORAWAN_JOIN_EUI /*APP_EUI*/ { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf7} +#define LORAWAN_DEVICE_EUI { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf9} +#define LORAWAN_JOIN_EUI /*APP_EUI*/ { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf9} diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c index e62edc45..f47391e8 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c @@ -9,17 +9,13 @@ #include "lorawan_version.h" #include -#include "sensor_parser.h" #define APP_TX_DUTYCYCLE 30000 //ms #define LORAWAN_DOWNLINK_PORT 2 #define LORAWAN_UPLINK_PORT 10 -k_mail_q_t mail_q; -#define DATA_CNT 26 -uint8_t mail_buf[DATA_CNT]; - +#define DATA_CNT 3 typedef struct device_data_st { uint8_t data[DATA_CNT]; @@ -110,18 +106,11 @@ void MX_LoRaWAN_Init(void) printf("lorawan init ok.\r\n"); } -uint8_t pool[DATA_CNT]; -#define CMD_LEN_MAX 50 -char cmd_buf[CMD_LEN_MAX]; -dev_data_t dev_data; +dev_data_t dev_data = {28,78,20}; uint16_t report_period = 10; -void uart_output(const char *str) -{ - /* if using c lib printf through uart, a simpler one is: */ - printf(str); -} + void recv_callback(uint8_t *data, uint8_t len) { @@ -148,8 +137,6 @@ void application_entry(void *arg) int ret = 0; int send_failed_count = 0; - tos_mail_q_create(&mail_q, pool, DATA_CNT, sizeof(uint8_t)); - tos_shell_init(cmd_buf, sizeof(cmd_buf), uart_output); //create task to process loramac tos_sem_create_max(&lora_mac_process_sem, 0, 1); @@ -163,16 +150,12 @@ void application_entry(void *arg) 10); //report pm2.5 data - while (1) { - size_t mail_size; - - tos_mail_q_pend(&mail_q, &dev_data.data, &mail_size, TOS_TIME_FOREVER); - + while (1) { /*fill the data*/ + tos_task_delay(20000); i = 0; app_data.port = LORAWAN_UPLINK_PORT; - - for (i = 0; i < mail_size; i++) { + for (i = 0; i < DATA_CNT; i++) { app_data.buff[i] = dev_data.data[i]; printf("[%d] %x\n", i, dev_data.data[i]); } @@ -205,7 +188,7 @@ void application_entry(void *arg) send_failed_count = 0; } - tos_task_delay(10000); + } //Lora_start_send(); diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/mcu_init.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/mcu_init.c new file mode 100644 index 00000000..1468d0a1 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/mcu_init.c @@ -0,0 +1,120 @@ +#include "mcu_init.h" +#include "app_system.h" +#include "app_lorawan.h" + +int fputc(int ch, FILE *f) +{ + if (ch == '\n') { + HAL_UART_Transmit(&huart1, (void *)"\r", 1, 30000); + } + HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); + return ch; + +} + +int _write(int fd, char *ptr, int len) +{ + (void)HAL_UART_Transmit(&huart1, (uint8_t *)ptr, len, 0xFFFF); + return len; +} + +int fgetc(FILE *f) +{ + /* Place your implementation of fgetc here */ + /* e.g. readwrite a character to the USART2 and Loop until the end of transmission */ + uint8_t ch = 0; + HAL_UART_Receive(&huart1, &ch, 1,30000); + return ch; +} + +void board_init(void) +{ + HAL_Init(); + SystemClock_Config(); + SystemApp_Init(); + MX_LoRaWAN_Init(); +} + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + + /** Initializes the CPU, AHB and APB busses clocks + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.LSEState = RCC_LSE_OFF; + RCC_OscInitStruct.HSICalibrationValue = 70; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV2; + RCC_OscInitStruct.PLL.PLLN = 30; + RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV5; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV5; + RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV5; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + + /** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers + */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_HCLK3); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) + { + Error_Handler(); + } +} + + +/* USER CODE BEGIN 4 */ + +/* USER CODE END 4 */ + +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + while(1) + { + } + /* USER CODE END Error_Handler_Debug */ +} + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) +{ + /* USER CODE BEGIN 6 */ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* Infinite loop */ + while (1) + { + } + + /* USER CODE END 6 */ +} +#endif /* USE_FULL_ASSERT */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/stm32wlxx_it.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/stm32wlxx_it.c new file mode 100644 index 00000000..d1e8344f --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/stm32wlxx_it.c @@ -0,0 +1,247 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file Templates/Src/stm32wlxx_it.c + * @author MCD Application Team + * @brief Main Interrupt Service Routines. + * This file provides template for all exceptions handler and + * peripherals interrupt service routine. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "stm32wlxx_it.h" +#include "tos_k.h" +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* External variables --------------------------------------------------------*/ +extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart2; +extern SUBGHZ_HandleTypeDef hsubghz; +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/******************************************************************************/ +/* Cortex Processor Interruption and Exception Handlers */ +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + + /* USER CODE END NonMaskableInt_IRQn 1 */ +} + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + /* USER CODE BEGIN HardFault_IRQn 0 */ + + /* USER CODE END HardFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_HardFault_IRQn 0 */ + /* USER CODE END W1_HardFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ + /* USER CODE END W1_MemoryManagement_IRQn 0 */ + } +} + +/** + * @brief This function handles Prefetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + /* USER CODE BEGIN BusFault_IRQn 0 */ + + /* USER CODE END BusFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_BusFault_IRQn 0 */ + /* USER CODE END W1_BusFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + /* USER CODE BEGIN UsageFault_IRQn 0 */ + + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ + /* USER CODE END W1_UsageFault_IRQn 0 */ + } +} + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + /* USER CODE BEGIN SVCall_IRQn 0 */ + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + /* USER CODE BEGIN DebugMonitor_IRQn 0 */ + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + +/** + * @brief This function handles Pendable request for system service. + */ +__weak void PendSV_Handler(void) +{ + /* USER CODE BEGIN PendSV_IRQn 0 */ + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ + + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + if (tos_knl_is_running()) + { + tos_knl_irq_enter(); + tos_tick_handler(); + tos_knl_irq_leave(); + } + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + +/******************************************************************************/ +/* STM32WLxx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32wlxx.s). */ +/******************************************************************************/ + +void USART1_IRQHandler(void) +{ + /* USER CODE BEGIN USART1_IRQn 0 */ + + /* USER CODE END USART1_IRQn 0 */ + HAL_UART_IRQHandler(&huart1); + /* USER CODE BEGIN USART2_IRQn 1 */ + + /* USER CODE END USART2_IRQn 1 */ +} + +void USART2_IRQHandler(void) +{ + /* USER CODE BEGIN LPUART1_IRQn 0 */ + + /* USER CODE END LPUART1_IRQn 0 */ + tos_knl_irq_enter(); + HAL_UART_IRQHandler(&huart2); + tos_knl_irq_leave(); + /* USER CODE BEGIN LPUART1_IRQn 1 */ + + /* USER CODE END LPUART1_IRQn 1 */ +} + +void Radio_IRQHandler(void) +{ + HAL_SUBGHZ_IRQHandler(&hsubghz); +} + +/* USER CODE BEGIN 1 */ +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) +{ + +} +/* USER CODE END 1 */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx index 4333aae6..02ba7c01 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx @@ -331,18 +331,6 @@ 0 0 0 - ..\..\BSP\Src\mcu_init.c - mcu_init.c - 0 - 0 - - - 2 - 7 - 1 - 0 - 0 - 0 ..\..\BSP\Src\rtc.c rtc.c 0 @@ -350,7 +338,7 @@ 2 - 8 + 7 1 0 0 @@ -362,7 +350,7 @@ 2 - 9 + 8 1 0 0 @@ -374,7 +362,7 @@ 2 - 10 + 9 1 0 0 @@ -386,19 +374,7 @@ 2 - 11 - 1 - 0 - 0 - 0 - ..\..\BSP\Src\stm32wlxx_it.c - stm32wlxx_it.c - 0 - 0 - - - 2 - 12 + 10 1 0 0 @@ -410,7 +386,7 @@ 2 - 13 + 11 1 0 0 @@ -420,6 +396,30 @@ 0 0 + + 2 + 12 + 1 + 0 + 0 + 0 + .\App\mcu_init.c + mcu_init.c + 0 + 0 + + + 2 + 13 + 1 + 0 + 0 + 0 + .\App\stm32wlxx_it.c + stm32wlxx_it.c + 0 + 0 + @@ -1110,14 +1110,6 @@ - - examples - 1 - 0 - 0 - 0 - - TOS-CONFIG 0 @@ -1125,7 +1117,7 @@ 0 0 - 9 + 8 68 1 0 @@ -1137,7 +1129,7 @@ 0 - 9 + 8 69 5 0 @@ -1157,7 +1149,7 @@ 0 0 - 10 + 9 70 1 0 @@ -1169,7 +1161,7 @@ 0 - 10 + 9 71 1 0 @@ -1181,7 +1173,7 @@ 0 - 10 + 9 72 5 0 @@ -1193,7 +1185,7 @@ 0 - 10 + 9 73 5 0 @@ -1205,7 +1197,7 @@ 0 - 10 + 9 74 1 0 @@ -1218,26 +1210,6 @@ - - Hardware - 0 - 0 - 0 - 0 - - 11 - 75 - 1 - 0 - 0 - 0 - ..\..\BSP\Hardware\PM25\sensor_parser.c - sensor_parser.c - 0 - 0 - - - lorawan/pattern 0 @@ -1245,8 +1217,8 @@ 0 0 - 12 - 76 + 10 + 75 1 0 0 @@ -1257,8 +1229,8 @@ 0 - 12 - 77 + 10 + 76 1 0 0 @@ -1277,8 +1249,8 @@ 0 0 - 13 - 78 + 11 + 77 1 0 0 @@ -1289,8 +1261,8 @@ 0 - 13 - 79 + 11 + 78 1 0 0 @@ -1301,8 +1273,8 @@ 0 - 13 - 80 + 11 + 79 1 0 0 @@ -1313,8 +1285,8 @@ 0 - 13 - 81 + 11 + 80 1 0 0 @@ -1325,8 +1297,8 @@ 0 - 13 - 82 + 11 + 81 1 0 0 @@ -1337,8 +1309,8 @@ 0 - 13 - 83 + 11 + 82 1 0 0 @@ -1349,8 +1321,8 @@ 0 - 13 - 84 + 11 + 83 1 0 0 @@ -1361,8 +1333,8 @@ 0 - 13 - 85 + 11 + 84 1 0 0 @@ -1373,8 +1345,8 @@ 0 - 13 - 86 + 11 + 85 1 0 0 @@ -1385,8 +1357,8 @@ 0 - 13 - 87 + 11 + 86 1 0 0 @@ -1397,8 +1369,8 @@ 0 - 13 - 88 + 11 + 87 1 0 0 @@ -1412,13 +1384,13 @@ lorawan/region - 1 + 0 0 0 0 - 14 - 89 + 12 + 88 1 0 0 @@ -1429,8 +1401,8 @@ 0 - 14 - 90 + 12 + 89 1 0 0 @@ -1441,8 +1413,8 @@ 0 - 14 - 91 + 12 + 90 1 0 0 @@ -1453,8 +1425,8 @@ 0 - 14 - 92 + 12 + 91 1 0 0 @@ -1465,8 +1437,8 @@ 0 - 14 - 93 + 12 + 92 1 0 0 @@ -1477,8 +1449,8 @@ 0 - 14 - 94 + 12 + 93 1 0 0 @@ -1489,8 +1461,8 @@ 0 - 14 - 95 + 12 + 94 1 0 0 @@ -1501,8 +1473,8 @@ 0 - 14 - 96 + 12 + 95 1 0 0 @@ -1513,8 +1485,8 @@ 0 - 14 - 97 + 12 + 96 1 0 0 @@ -1525,8 +1497,8 @@ 0 - 14 - 98 + 12 + 97 1 0 0 @@ -1537,8 +1509,8 @@ 0 - 14 - 99 + 12 + 98 1 0 0 @@ -1549,8 +1521,8 @@ 0 - 14 - 100 + 12 + 99 1 0 0 @@ -1561,8 +1533,8 @@ 0 - 14 - 101 + 12 + 100 1 0 0 @@ -1581,8 +1553,8 @@ 0 0 - 15 - 102 + 13 + 101 1 0 0 @@ -1601,8 +1573,8 @@ 0 0 - 16 - 103 + 14 + 102 1 0 0 @@ -1613,8 +1585,8 @@ 0 - 16 - 104 + 14 + 103 1 0 0 @@ -1633,8 +1605,8 @@ 0 0 - 17 - 105 + 15 + 104 1 0 0 @@ -1645,8 +1617,8 @@ 0 - 17 - 106 + 15 + 105 1 0 0 @@ -1657,8 +1629,8 @@ 0 - 17 - 107 + 15 + 106 1 0 0 diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx index b51035fe..1dfb008f 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx @@ -10,14 +10,14 @@ TencentOS_Tiny 0x4 ARM-ADS - 6140000::V6.14::ARMCLANG + 6100001::V6.10.1::.\ARMCLANG 1 STM32WLE5JCIx STMicroelectronics - Keil.STM32WLxx_DFP.1.0.0 - http://www.keil.com/pack/ + Keil.STM32WLxx_DFP.1.0.2.OEM + http://www.keil.com/pack IRAM(0x20000000,0x10000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE @@ -185,7 +185,6 @@ 0 0 0 - 0 0 0 8 @@ -339,7 +338,7 @@ USE_HAL_DRIVER,STM32WLE5xx,CORE_CM4 - ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32WLxx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG;..\..\BSP\Middlewares\LoRaWAN\Conf;..\..\BSP\Middlewares\LoRaWAN\Crypto;..\..\BSP\Middlewares\LoRaWAN\Mac;..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic;..\..\BSP\Middlewares\LoRaWAN\Utilities;..\..\BSP\Middlewares\SubGHz_Phy;..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver;..\..\BSP\Inc;.\App;.\Target;..\..\BSP\Utilities\lpm\tiny_lpm;..\..\BSP\Utilities\misc;..\..\BSP\Hardware\PM25 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32WLxx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG;..\..\BSP\Middlewares\LoRaWAN\Conf;..\..\BSP\Middlewares\LoRaWAN\Crypto;..\..\BSP\Middlewares\LoRaWAN\Mac;..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic;..\..\BSP\Middlewares\LoRaWAN\Utilities;..\..\BSP\Middlewares\SubGHz_Phy;..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver;..\..\BSP\Inc;.\App;.\Target;..\..\BSP\Utilities\lpm\tiny_lpm;..\..\BSP\Utilities\misc @@ -352,7 +351,7 @@ 0 0 0 - 4 + 0 @@ -413,11 +412,6 @@ 1 ..\..\BSP\Src\gpio.c - - mcu_init.c - 1 - ..\..\BSP\Src\mcu_init.c - rtc.c 1 @@ -438,11 +432,6 @@ 1 ..\..\BSP\Src\stm32wlxx_hal_msp.c - - stm32wlxx_it.c - 1 - ..\..\BSP\Src\stm32wlxx_it.c - usart.c 1 @@ -453,6 +442,16 @@ 1 ..\..\BSP\Src\usart_if.c + + mcu_init.c + 1 + .\App\mcu_init.c + + + stm32wlxx_it.c + 1 + .\App\stm32wlxx_it.c + @@ -750,9 +749,6 @@ - - examples - TOS-CONFIG @@ -798,16 +794,6 @@ - - Hardware - - - sensor_parser.c - 1 - ..\..\BSP\Hardware\PM25\sensor_parser.c - - - lorawan/pattern @@ -1018,19 +1004,4 @@ - - - - <Project Info> - - - - - - 0 - 1 - - - - diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/Commissioning.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/Commissioning.h new file mode 100644 index 00000000..a54c8e30 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/Commissioning.h @@ -0,0 +1,94 @@ +/** + ********************************************************************************************************************************************************** + * @file commissioning.h + * @author MCD Application Team + * @brief End device commissioning parameters + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LORA_COMMISSIONING_H__ +#define __LORA_COMMISSIONING_H__ + +#ifdef __cplusplus +extern "C" { +#endif +/*! + ****************************************************************************** + ********************************** WARNING *********************************** + ****************************************************************************** + The crypto-element implementation supports both 1.0.x and 1.1.x LoRaWAN + versions of the specification. + Thus it has been decided to use the 1.1.x keys and EUI name definitions. + The below table shows the names equivalence between versions: + +-------------------+-------------------------+ + | 1.0.x | 1.1.x | + +===================+=========================+ + | LORAWAN_DEVICE_EUI| LORAWAN_DEVICE_EUI | + +-------------------+-------------------------+ + | LORAWAN_APP_EUI | LORAWAN_JOIN_EUI | + +-------------------+-------------------------+ + | N/A | LORAWAN_APP_KEY | + +-------------------+-------------------------+ + | LORAWAN_APP_KEY | LORAWAN_NWK_KEY | + +-------------------+-------------------------+ + | LORAWAN_NWK_S_KEY | LORAWAN_F_NWK_S_INT_KEY | + +-------------------+-------------------------+ + | LORAWAN_NWK_S_KEY | LORAWAN_S_NWK_S_INT_KEY | + +-------------------+-------------------------+ + | LORAWAN_NWK_S_KEY | LORAWAN_NWK_S_ENC_KEY | + +-------------------+-------------------------+ + | LORAWAN_APP_S_KEY | LORAWAN_APP_S_KEY | + +-------------------+-------------------------+ + ****************************************************************************** + ****************************************************************************** + ****************************************************************************** + */ +/*! + * Indicates if the end-device is to be connected to a private or public network + */ +#define LORAWAN_PUBLIC_NETWORK true + +/*root key*/ +#define LORAWAN_APP_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } + +/*for ABP================================================================================*/ +#define STATIC_DEVICE_ADDRESS 1 //if 0 , using a ramdom address + +#define LORAWAN_NETWORK_ID ( uint32_t )0 + +#define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x0100000a +#define LORAWAN_NWK_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } + + +/*for 1.1.x*/ +#define LORAWAN_F_NWK_S_INT_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_S_NWK_S_INT_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_NWK_S_ENC_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_APP_S_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } + +/*for OTAA================================================================================*/ +#define STATIC_DEVICE_EUI 1 //if 0 , using a ramdom EUI + +#define IEEE_OUI 0x01, 0x01, 0x01 +#define LORAWAN_DEVICE_EUI { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf8} +#define LORAWAN_JOIN_EUI /*APP_EUI*/ { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf8} + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __LORA_COMMISSIONING_H__ */ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_conf.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_conf.h new file mode 100644 index 00000000..73313c38 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_conf.h @@ -0,0 +1,109 @@ +/** + ****************************************************************************** + * @file app_conf.h + * @author MCD Application Team + * @brief applic configuration, e.g. : debug, trace, low power, sensors + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __APP_CONF_H__ +#define __APP_CONF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/****************************************************************************** + * lw APP configuration + ******************************************************************************/ + +/* lw application configuration (Mw is configured by lorawan_conf.h) */ +#define LORAWAN_DEFAULT_ACTIVE_REGION LORAMAC_REGION_CN470 + + + +/*enable Low power*/ +#define LOW_POWER_ENBLE 0 + +/* LPM_STOP_MODE_DISABLE = 0 : LowPowerMode enabled : MCU enters stop2 mode*/ +/* LPM_STOP_MODE_DISABLE = 1 : LowPowerMode disabled : MCU enters sleep mode only */ +#define LPM_STOP_MODE_DISABLE 0 + + +/****************************************************************************** + * classB configuration + ******************************************************************************/ +/*using class b must define LORAMAC_CLASSB_ENABLED and active ClassB*/ +/* Class B ------------------------------------*/ +//#define LORAMAC_CLASSB_ENABLED +#define LORAMAC_CLASSB_ACTIVE 0 /* 0 if not active, 1 if active */ + + +/****************************************************************************** + * DEBUGGING configuration + ******************************************************************************/ + +/* Enable trace logs. Note verbose level can be selected in app_system.h */ +#define APP_LOG_ENABLED 1 +#define MW_LOG_ENABLED 1 +/* +0 only print the informtion +1.print the function and line +2 print the file , line ,function +*/ +#define LOG_LEVEL 0 + + + +/****************************************************************************** + * Sequencer + ******************************************************************************/ +#define CFG_SEQ_Prio_0 0 + +/** +* This is the list of task id required by the application +* Each Id shall be in the range 0..1<31 +*/ +#define CFG_SEQ_TASK_LORAMAC_PROCESS (1 << 1) +#define CFG_SEQ_TASK_LORA_SEND_ON_TX_TIMER (1 << 2) +#define CFG_SEQ_TASK_LORA_CERTIF_PROCESS (1 << 3) + +/****************************************************************************** + * LOW POWER MANAGER + ******************************************************************************/ +/** + * Supported requester to the MCU Low Power Manager - can be increased up to 32 + * It lits a bit mapping of all user of the Low Power Manager + */ +typedef enum +{ + LPM_APPLI_Id = (1 << 0), + LPM_LIB_Id = (1 << 1), + LPM_RTC_Id = (1 << 2), + LPM_GPS_Id = (1 << 3), + LPM_UART_RX_Id = (1 << 4), + LPM_UART_TX_Id = (1 << 5), + LPM_TCXO_WA_Id = (1 << 6), +} LPM_Id_t; + +#ifdef __cplusplus +} +#endif + +#endif /* __APP_CONF_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.c new file mode 100644 index 00000000..8bc8909d --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.c @@ -0,0 +1,413 @@ + +/* Includes ------------------------------------------------------------------*/ +#include "timer.h" +#include "app_system.h" +#include "app_lorawan.h" +#include "stm32_lpm.h" + +#include "adc_if.h" +#include "lorawan_version.h" + +#include +#include "sensor_parser.h" + +#define APP_TX_DUTYCYCLE 30000 //ms +#define LORAWAN_DOWNLINK_PORT 2 +#define LORAWAN_UPLINK_PORT 10 + + +k_mail_q_t mail_q; +#define DATA_CNT 26 +uint8_t mail_buf[DATA_CNT]; + + +typedef struct device_data_st { + uint8_t data[DATA_CNT]; +} __PACKED__ dev_data_t; + + +/*! + * user main_callback function declare , you need to implement them + * and register. + */ +static uint8_t LORA_GetBatteryLevel(void); +static uint16_t LORA_GetTemperatureLevel(void); +static void GetUniqueId(uint8_t *id); +static uint32_t GetRandomSeed(void); + +static void LoraMacProcessNotify(void); + + +void mac_event_callback(APP_EVENT_t evt,const void* param); + +static LoRaMainCallback_t LoRaMainCallbacks = { mac_event_callback, + LoraMacProcessNotify, + LORA_GetBatteryLevel, + LORA_GetTemperatureLevel, + GetUniqueId, + GetRandomSeed, + }; + + + +#define LORAWAN_APP_DATA_BUFF_SIZE 64 +static uint8_t app_data_buff[LORAWAN_APP_DATA_BUFF_SIZE]; +lw_app_data_t app_data = { app_data_buff, 0, 0 }; + + +/*send task function declaration*/ +static TimerEvent_t send_timer; +static void send_process(void *args); +static void cycle_send_event(void *context); +static void Lora_start_send(void); + +k_task_t lora_mac_process_task; +//4096 is miniest stack size to work normally +k_stack_t lora_mac_process_task_stack[4096]; + +k_sem_t lora_mac_process_sem; + +//MAC²ãÈÎÎñ´¦Àí +void LoraMacProcess_task_entry(void *args) +{ + while(1) + { + tos_sem_pend(&lora_mac_process_sem, TOS_TIME_FOREVER); + LoRaMacProcess(NULL); + } + +} +/*Exported functions ---------------------------------------------------------*/ +void MX_LoRaWAN_Init(void) +{ + printf("Lora node powered by TencentOS-tiny\r\n"); + + /* Configure the Lora Stack*/ + lw_init(&LoRaMainCallbacks); + + APP_LOG("APP_VERSION= %02X.%02X.%02X.%02X\r\n", (uint8_t)(__APP_VERSION >> 24), (uint8_t)(__APP_VERSION >> 16), (uint8_t)(__APP_VERSION >> 8), (uint8_t)__APP_VERSION); + APP_LOG("MAC_VERSION= %02X.%02X.%02X.%02X\r\n", (uint8_t)(__LORA_MAC_VERSION >> 24), (uint8_t)(__LORA_MAC_VERSION >> 16), (uint8_t)(__LORA_MAC_VERSION >> 8), (uint8_t)__LORA_MAC_VERSION); + + /*Class*/ + lw_request_class(CLASS_A); + + /*channel 80-87*/ + LWChannel_mask_t ch={0x0000,0,0,0,0,0x00FF}; + lw_current_chmask_set(&ch); + + /*tx dr*/ + lw_config_tx_datarate_set(DR_3); + + /*OTAA*/ + lw_config_otaa_set(LORA_ENABLE); + + /*enable adr*/ + lw_adr_set(LORA_ENABLE); + + /*set retry*/ + lw_confirm_retry_set(3); + + printf("lorawan init ok.\r\n"); +} + +uint8_t pool[DATA_CNT]; +#define CMD_LEN_MAX 50 +char cmd_buf[CMD_LEN_MAX]; +dev_data_t dev_data; + +uint16_t report_period = 10; + +void uart_output(const char *str) +{ + /* if using c lib printf through uart, a simpler one is: */ + printf(str); +} + +void recv_callback(uint8_t *data, uint8_t len) +{ + int i = 0; + + printf("len: %d\n", len); + + for (i = 0; i < len; ++i) { + printf("data[%d]: %d\n", i, data[i]); + } + + if (len == 1) { + report_period = data[0]; + } else if (len >= 2) { + report_period = data[0] | (data[1] << 8); + } + printf("report_period: %d\n", report_period); +} + +void application_entry(void *arg) +{ + + int i = 0; + int ret = 0; + int send_failed_count = 0; + + tos_mail_q_create(&mail_q, pool, DATA_CNT, sizeof(uint8_t)); + tos_shell_init(cmd_buf, sizeof(cmd_buf), uart_output); + + //create task to process loramac + tos_sem_create_max(&lora_mac_process_sem, 0, 1); + tos_task_create(&lora_mac_process_task, + "lora_mac_process_task", + LoraMacProcess_task_entry, + NULL, + 2, + lora_mac_process_task_stack, + sizeof(lora_mac_process_task_stack), + 10); + + //report pm2.5 data + while (1) { + size_t mail_size; + + tos_mail_q_pend(&mail_q, &dev_data.data, &mail_size, TOS_TIME_FOREVER); + + /*fill the data*/ + i = 0; + app_data.port = LORAWAN_UPLINK_PORT; + + for (i = 0; i < mail_size; i++) { + app_data.buff[i] = dev_data.data[i]; + printf("[%d] %x\n", i, dev_data.data[i]); + } + printf("\n\n"); + app_data.size = i; + + /*Check if it is in OTAA mode*/ + if(LORA_ENABLE == lw_config_otaa_get()) + { + /*check if it is already joined*/ + if(lw_join_status() != LORA_SET) + { + lw_join(); + continue; + } + } + + ret = lw_send(&app_data, LORAWAN_CONFIRMED_MSG); + if (ret != LORAMAC_STATUS_OK ) + { + printf("LoRa Send data faild!, retcode = %d, count is %d\r\n",ret, send_failed_count); + send_failed_count++; + if (send_failed_count > 10) + { + NVIC_SystemReset();// when lora send faied more than 10 times , cpu reset to reconnect. + } + } + else + { + send_failed_count = 0; + } + + //tos_task_delay(10000); + } + + //Lora_start_send(); +} + +void Lora_start_send(void) +{ + /* send everytime timer elapses */ + TimerInit(&send_timer, cycle_send_event); + TimerSetValue(&send_timer, APP_TX_DUTYCYCLE); + cycle_send_event(NULL); +} + +static void cycle_send_event(void *args) +{ + send_process(NULL); + /*Wait for next tx slot*/ + TimerStart(&send_timer); + //tos_timer_start(&send_timer); +} + +static void send_process(void *args) +{ + int16_t temperature = 0; + uint8_t batteryLevel=0; + + /*Check if it is in OTAA mode*/ + if(LORA_ENABLE == lw_config_otaa_get()) + { + /*check if it is already joined*/ + if(lw_join_status() != LORA_SET) + { + lw_join(); + return; + } + } + + APP_LOG("SEND REQUEST=======================================>\n\r"); + /*fill the data*/ + uint32_t i = 0; + + app_data.port = LORAWAN_UPLINK_PORT; + + batteryLevel = LORA_GetBatteryLevel(); /* 1 (very low) to 254 (fully charged) */ + temperature = SYS_GetTemperatureLevel(); /* report Temperature */ + + app_data.buff[i++] = batteryLevel * 100 / 254; + app_data.buff[i++] = temperature>>8; + app_data.buff[i++] = temperature&0xff; + + app_data.size = i; + + /*you can set the channel by using these function*/ +// LWChannel_mask_t ch_r={0}; +// LWChannel_mask_t ch_w={0x00FF,0,0,0,0,0}; + +// lw_current_chmask_set(&ch_w); +// APP_LOG("ch_write: %04X %04X %04X %04X %04X %04X\r\n",ch_w.mask[0],ch_w.mask[1],ch_w.mask[2],ch_w.mask[3],ch_w.mask[4],ch_w.mask[5]); +// lw_current_chmask_get(&ch_r); +// APP_LOG("ch_read: %04X %04X %04X %04X %04X %04X\r\n",ch_r.mask[0],ch_r.mask[1],ch_r.mask[2],ch_r.mask[3],ch_r.mask[4],ch_r.mask[5]); + + + lw_send(&app_data, LORAWAN_CONFIRMED_MSG); + + +} + + +void mac_event_callback(APP_EVENT_t evt,const void* param) +{ + switch(evt) + { + case APP_RX_EVENT:{ + lw_app_data_t* rx_data = (lw_app_data_t*)param; + + switch(rx_data->port) + { + case 2: + APP_LOG("%s\r\n",rx_data->buff); + APP_LOG("size = %d\r\n",rx_data->size); + APP_LOG("<===============================>");break; + case 3: + lw_request_class(CLASS_A);break; + case 4: + lw_request_class(CLASS_B);break; + case 5: + lw_request_class(CLASS_C);break; + } + + if(rx_data->fpending) + { + app_data.size = 0; + app_data.port = LORAWAN_UPLINK_PORT; + lw_send(&app_data, LORAWAN_UNCONFIRMED_MSG); + } + + }break; + + case APP_JOINED_EVENT:{ + APP_LOG("end node joined \n\r"); + //lw_request_class(CLASS_A); + }break; + + case APP_CONFIRM_ClASS_EVENT:{ + DeviceClass_t* cur_class = (DeviceClass_t*)param; + APP_LOG("==================Switch to Class%c done\n\r","ABC"[*cur_class]); + /*Optionnal*/ + /*informs the server that switch has occurred ASAP*/ + app_data.size = 0; + app_data.port = LORAWAN_UPLINK_PORT; + lw_send(&app_data, LORAWAN_UNCONFIRMED_MSG); + }break; + + case APP_TX_DONE_EVENT:{ + lw_app_data_t* tx_done = (lw_app_data_t*)param; + + if(tx_done->ack){ + APP_LOG("Network Server \"ack\" an uplink data confirmed message transmission\n\r"); + } + else{ + APP_LOG("tx =======> down\n\r"); + } + }break; + + default :break; + } +} +static void LoraMacProcessNotify(void) +{ + tos_sem_post(&lora_mac_process_sem); +} + +/** + * @brief This function return the battery level + * @param none + * @retval the battery level 1 (very low) to 254 (fully charged) + */ +static uint8_t LORA_GetBatteryLevel(void) +{ + /* USER CODE BEGIN 1 */ + uint16_t batteryLevelmV; + uint8_t batteryLevel = 0; + + batteryLevelmV = (uint16_t) SYS_GetBatteryLevel(); + + /* Convert batterey level from mV to linea scale: 1 (very low) to 254 (fully charged) */ + if(batteryLevelmV > VDD_BAT) + { + batteryLevel = 254; + } + else if(batteryLevelmV < VDD_MIN) + { + batteryLevel = 0; + } + else + { + batteryLevel = (((uint32_t)(batteryLevelmV - VDD_MIN) * 254) / (VDD_BAT - VDD_MIN)); + } + APP_LOG("VDDA= %d\n\r", batteryLevel); + + return batteryLevel; /* 1 (very low) to 254 (fully charged) */ + /* USER CODE END 1 */ +} + +static uint16_t LORA_GetTemperatureLevel(void) +{ + return (uint16_t) SYS_GetTemperatureLevel(); +} + + +/** + * @brief This function return a random seed + * @note based on the device unique ID + * @param None + * @retval see + */ +static uint32_t GetRandomSeed(void) +{ + return ((HAL_GetUIDw0()) ^ (HAL_GetUIDw1()) ^ (HAL_GetUIDw2())); +} + +/** + * @brief This function return a unique ID + * @param unique ID + * @retval none + */ +static void GetUniqueId(uint8_t *id) +{ + uint32_t ID_1_3_val = HAL_GetUIDw0() + HAL_GetUIDw2(); + uint32_t ID_2_val = HAL_GetUIDw1(); + + id[7] = (ID_1_3_val) >> 24; + id[6] = (ID_1_3_val) >> 16; + id[5] = (ID_1_3_val) >> 8; + id[4] = (ID_1_3_val); + id[3] = (ID_2_val) >> 24; + id[2] = (ID_2_val) >> 16; + id[1] = (ID_2_val) >> 8; + id[0] = (ID_2_val); +} + + + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.h new file mode 100644 index 00000000..abd99aae --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_lorawan.h @@ -0,0 +1,57 @@ +/** + ****************************************************************************** + * @file app_lorawan.h + * @author MCD Application Team + * @brief header of application of the LRWAN Middleware + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __APP_LORAWAN_H__ +#define __APP_LORAWAN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "lora.h" + +/* Exported constants --------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +/** +* @brief Init Lora Application +* @param None +* @retval None +*/ +void MX_LoRaWAN_Init(void); +/** +* @brief Send Lora Data +* @param None +* @retval None +*/ +void MX_LoRaWAN_Process(void); + + +#ifdef __cplusplus +} +#endif + +#endif /*__APP_LORAWAN_H__*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.c new file mode 100644 index 00000000..e6da26ac --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.c @@ -0,0 +1,129 @@ +#include +#include +#include "main.h" +#include "app_system.h" +#include "adc_if.h" + +#include "stm32_systime.h" +#include "stm32_lpm.h" + +#include "usart_if.h" +/** + * @brief Set all pins such to minimized consumption (necessary for some STM32 families) + * @param none + * @retval None + */ +static void Gpio_PreInit(void); +/** + * @brief Returns sec and msec based on the systime in use + * @param none + * @retval none + */ +static void TimestampNow(uint8_t *buff, uint16_t* size); + +/* Exported functions ---------------------------------------------------------*/ + +/** + * @brief initialises the system (dbg pins, trace, mbmux, systiemr, LPM, ...) + * @param none + * @retval none + */ +void SystemApp_Init(void) +{ + Gpio_PreInit(); + + vcom_Init(NULL); + + MX_USART2_UART_Init(); + + /*Initialize the temperature and Battery measurement services */ + SYS_InitMeasurement(); + +#if LOW_POWER_MODE_ENBLE + /*Init low power manager*/ + UTIL_LPM_Init(); + /* Disable Stand-by mode */ + UTIL_LPM_SetOffMode(LPM_APPLI_Id, UTIL_LPM_DISABLE); + + #if defined (LPM_STOP_MODE_DISABLE) && (LPM_STOP_MODE_DISABLE == 1) + /* Disable Stop Mode */ + UTIL_LPM_SetStopMode(LPM_APPLI_Id, UTIL_LPM_DISABLE); + #elif !defined (LPM_STOP_MODE_DISABLE) + #error LPM_STOP_MODE_DISABLE not defined + #endif +#endif +} + +/** + * @brief redefines __weak function in stm32_seq.c such to enter low power + * @param none + * @retval none + */ +void UTIL_SEQ_Idle(void) +{ +#if LOW_POWER_MODE_ENBLE + UTIL_LPM_EnterLowPower(); +#endif +} + +/* Private functions ---------------------------------------------------------*/ + +static void TimestampNow(uint8_t *buff, uint16_t* size) +{ + SysTime_t curtime = SysTimeGet(); + sprintf((char *)buff, "%ds%d:", curtime.Seconds, curtime.SubSeconds); + *size = strlen((char *)buff); +} + + + +static void Gpio_PreInit(void) +{ + GPIO_InitTypeDef GPIO_InitStruct = {0}; + + /* Configure all IOs in analog input */ + /* Except PA143 and PA14 (SWCLK and SWD) for debug*/ + /* PA13 and PA14 are configured in debug_init */ + /* Configure all GPIO as analog to reduce current consumption on non used IOs */ + /* Enable GPIOs clock */ + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + __HAL_RCC_GPIOC_CLK_ENABLE(); + __HAL_RCC_GPIOH_CLK_ENABLE(); + + GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; + GPIO_InitStruct.Pull = GPIO_NOPULL; + /* All GPIOs except debug pins (SWCLK and SWD) */ + GPIO_InitStruct.Pin = GPIO_PIN_All & (~(GPIO_PIN_13 | GPIO_PIN_14)); + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + + /* All GPIOs */ + GPIO_InitStruct.Pin = GPIO_PIN_All; + HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); + HAL_GPIO_Init(GPIOH, &GPIO_InitStruct); + + /* Disable GPIOs clock */ + __HAL_RCC_GPIOA_CLK_DISABLE(); + __HAL_RCC_GPIOB_CLK_DISABLE(); + __HAL_RCC_GPIOC_CLK_DISABLE(); + __HAL_RCC_GPIOH_CLK_DISABLE(); +} + +/* Disable StopMode when traces need to be printed */ +void UTIL_ADV_TRACE_PreSendHook (void) +{ +#if LOW_POWER_MODE_ENBLE + UTIL_LPM_SetStopMode(LPM_UART_TX_Id , UTIL_LPM_DISABLE ); +#endif +} +/* Reenable StopMode when traces have been printed */ +void UTIL_ADV_TRACE_PostSendHook (void) +{ +#if LOW_POWER_MODE_ENBLE + UTIL_LPM_SetStopMode(LPM_UART_TX_Id , UTIL_LPM_ENABLE ); +#endif +} + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.h new file mode 100644 index 00000000..ff147310 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/app_system.h @@ -0,0 +1,71 @@ +/** + ****************************************************************************** + * @file app_system.h + * @author MCD Application Team + * @brief function prototypes for app_system.c file + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __APP_SYSTEM_H__ +#define __APP_SYSTEM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include +#include "app_conf.h" + +#include "mw_log_conf.h" +#include + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ + +#if defined (APP_LOG_ENABLED) && (APP_LOG_ENABLED == 1) + #define APP_LOG LOG_PRINT + #define APP_PPRINTF printf + #define APP_TPRINTF printf + #define APP_PRINTF printf +#elif defined (APP_LOG_ENABLED) && (APP_LOG_ENABLED == 0) + #define APP_LOG(...) + #define APP_PPRINTF(...) + #define APP_TPRINTF(...) + #define APP_PRINTF(...) +#else + #error "APP_LOG_ENABLED not defined or out of range <0,1>" +#endif + +/* Defines -------------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +/** + * @brief initialises the system (dbg pins, trace, systiemr, LPM, ...) + * @param none + * @retval none + */ +void SystemApp_Init(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __APP_SYSTEM_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/lorawan_version.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/lorawan_version.h new file mode 100644 index 00000000..429ad4b7 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/lorawan_version.h @@ -0,0 +1,52 @@ +/****************************************************************************** + * @file lorawan_version.h + * @author MCD Application Team + * @brief defines the lora mac version + ****************************************************************************** +* @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LORAWAN_VERSION_H__ +#define __LORAWAN_VERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "lora_mac_version.h" +/* Exported constants --------------------------------------------------------*/ +#define __APP_VERSION_MAIN (0x00U) /*!< [31:24] main version */ +#define __APP_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */ +#define __APP_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ +#define __APP_VERSION_RC (0x00U) /*!< [7:0] release candidate */ +#define __APP_VERSION ((__APP_VERSION_MAIN <<24)\ + |(__APP_VERSION_SUB1 << 16)\ + |(__APP_VERSION_SUB2 << 8 )\ + |(__APP_VERSION_RC)) + +#define __MAC_VERSION (uint32_t) (LORA_MAC_VERSION ) + +/* Exported types ------------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + +#ifdef __cplusplus +} +#endif + +#endif /*__LORAWAN_VERSION_H__*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/mcu_init.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/mcu_init.c new file mode 100644 index 00000000..1468d0a1 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/mcu_init.c @@ -0,0 +1,120 @@ +#include "mcu_init.h" +#include "app_system.h" +#include "app_lorawan.h" + +int fputc(int ch, FILE *f) +{ + if (ch == '\n') { + HAL_UART_Transmit(&huart1, (void *)"\r", 1, 30000); + } + HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF); + return ch; + +} + +int _write(int fd, char *ptr, int len) +{ + (void)HAL_UART_Transmit(&huart1, (uint8_t *)ptr, len, 0xFFFF); + return len; +} + +int fgetc(FILE *f) +{ + /* Place your implementation of fgetc here */ + /* e.g. readwrite a character to the USART2 and Loop until the end of transmission */ + uint8_t ch = 0; + HAL_UART_Receive(&huart1, &ch, 1,30000); + return ch; +} + +void board_init(void) +{ + HAL_Init(); + SystemClock_Config(); + SystemApp_Init(); + MX_LoRaWAN_Init(); +} + +/** + * @brief System Clock Configuration + * @retval None + */ +void SystemClock_Config(void) +{ + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + + /** Initializes the CPU, AHB and APB busses clocks + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.LSEState = RCC_LSE_OFF; + RCC_OscInitStruct.HSICalibrationValue = 70; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV2; + RCC_OscInitStruct.PLL.PLLN = 30; + RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV5; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV5; + RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV5; + if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) + { + Error_Handler(); + } + + /** Configure the SYSCLKSource, HCLK, PCLK1 and PCLK2 clocks dividers + */ + RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2 | RCC_CLOCKTYPE_HCLK3); + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; + + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) + { + Error_Handler(); + } +} + + +/* USER CODE BEGIN 4 */ + +/* USER CODE END 4 */ + +/** + * @brief This function is executed in case of error occurrence. + * @retval None + */ +void Error_Handler(void) +{ + /* USER CODE BEGIN Error_Handler_Debug */ + /* User can add his own implementation to report the HAL error return state */ + while(1) + { + } + /* USER CODE END Error_Handler_Debug */ +} + +#ifdef USE_FULL_ASSERT +/** + * @brief Reports the name of the source file and the source line number + * where the assert_param error has occurred. + * @param file: pointer to the source file name + * @param line: assert_param error line source number + * @retval None + */ +void assert_failed(uint8_t *file, uint32_t line) +{ + /* USER CODE BEGIN 6 */ + /* User can add his own implementation to report the file name and line number, + ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ + /* Infinite loop */ + while (1) + { + } + + /* USER CODE END 6 */ +} +#endif /* USE_FULL_ASSERT */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/sensor_parser.c similarity index 100% rename from board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c rename to board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/sensor_parser.c diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/sensor_parser.h similarity index 100% rename from board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h rename to board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/sensor_parser.h diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/stm32wlxx_it.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/stm32wlxx_it.c new file mode 100644 index 00000000..6d5001dd --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/App/stm32wlxx_it.c @@ -0,0 +1,255 @@ +/* USER CODE BEGIN Header */ +/** + ****************************************************************************** + * @file Templates/Src/stm32wlxx_it.c + * @author MCD Application Team + * @brief Main Interrupt Service Routines. + * This file provides template for all exceptions handler and + * peripherals interrupt service routine. + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ +/* USER CODE END Header */ + +/* Includes ------------------------------------------------------------------*/ +#include "main.h" +#include "stm32wlxx_it.h" +#include "tos_k.h" +#include "sensor_parser.h" +/* Private includes ----------------------------------------------------------*/ +/* USER CODE BEGIN Includes */ +/* USER CODE END Includes */ + +/* Private typedef -----------------------------------------------------------*/ +/* USER CODE BEGIN TD */ + +/* USER CODE END TD */ + +/* Private define ------------------------------------------------------------*/ +/* USER CODE BEGIN PD */ + +/* USER CODE END PD */ + +/* Private macro -------------------------------------------------------------*/ +/* USER CODE BEGIN PM */ + +/* USER CODE END PM */ + +/* Private variables ---------------------------------------------------------*/ +/* USER CODE BEGIN PV */ + +/* USER CODE END PV */ + +/* Private function prototypes -----------------------------------------------*/ +/* USER CODE BEGIN PFP */ + +/* USER CODE END PFP */ + +/* Private user code ---------------------------------------------------------*/ +/* USER CODE BEGIN 0 */ + +/* USER CODE END 0 */ + +/* External variables --------------------------------------------------------*/ +extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart2; +extern SUBGHZ_HandleTypeDef hsubghz; +/* USER CODE BEGIN EV */ + +/* USER CODE END EV */ + +/******************************************************************************/ +/* Cortex Processor Interruption and Exception Handlers */ +/******************************************************************************/ +/** + * @brief This function handles Non maskable interrupt. + */ +void NMI_Handler(void) +{ + /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ + + /* USER CODE END NonMaskableInt_IRQn 0 */ + /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ + + /* USER CODE END NonMaskableInt_IRQn 1 */ +} + +/** + * @brief This function handles Hard fault interrupt. + */ +void HardFault_Handler(void) +{ + /* USER CODE BEGIN HardFault_IRQn 0 */ + + /* USER CODE END HardFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_HardFault_IRQn 0 */ + /* USER CODE END W1_HardFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Memory management fault. + */ +void MemManage_Handler(void) +{ + /* USER CODE BEGIN MemoryManagement_IRQn 0 */ + + /* USER CODE END MemoryManagement_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_MemoryManagement_IRQn 0 */ + /* USER CODE END W1_MemoryManagement_IRQn 0 */ + } +} + +/** + * @brief This function handles Prefetch fault, memory access fault. + */ +void BusFault_Handler(void) +{ + /* USER CODE BEGIN BusFault_IRQn 0 */ + + /* USER CODE END BusFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_BusFault_IRQn 0 */ + /* USER CODE END W1_BusFault_IRQn 0 */ + } +} + +/** + * @brief This function handles Undefined instruction or illegal state. + */ +void UsageFault_Handler(void) +{ + /* USER CODE BEGIN UsageFault_IRQn 0 */ + + /* USER CODE END UsageFault_IRQn 0 */ + while (1) + { + /* USER CODE BEGIN W1_UsageFault_IRQn 0 */ + /* USER CODE END W1_UsageFault_IRQn 0 */ + } +} + +/** + * @brief This function handles System service call via SWI instruction. + */ +void SVC_Handler(void) +{ + /* USER CODE BEGIN SVCall_IRQn 0 */ + + /* USER CODE END SVCall_IRQn 0 */ + /* USER CODE BEGIN SVCall_IRQn 1 */ + + /* USER CODE END SVCall_IRQn 1 */ +} + +/** + * @brief This function handles Debug monitor. + */ +void DebugMon_Handler(void) +{ + /* USER CODE BEGIN DebugMonitor_IRQn 0 */ + + /* USER CODE END DebugMonitor_IRQn 0 */ + /* USER CODE BEGIN DebugMonitor_IRQn 1 */ + + /* USER CODE END DebugMonitor_IRQn 1 */ +} + +/** + * @brief This function handles Pendable request for system service. + */ +__weak void PendSV_Handler(void) +{ + /* USER CODE BEGIN PendSV_IRQn 0 */ + + /* USER CODE END PendSV_IRQn 0 */ + /* USER CODE BEGIN PendSV_IRQn 1 */ + + /* USER CODE END PendSV_IRQn 1 */ +} + +/** + * @brief This function handles System tick timer. + */ +void SysTick_Handler(void) +{ + /* USER CODE BEGIN SysTick_IRQn 0 */ + + /* USER CODE END SysTick_IRQn 0 */ + HAL_IncTick(); + if (tos_knl_is_running()) + { + tos_knl_irq_enter(); + tos_tick_handler(); + tos_knl_irq_leave(); + } + /* USER CODE BEGIN SysTick_IRQn 1 */ + + /* USER CODE END SysTick_IRQn 1 */ +} + +/******************************************************************************/ +/* STM32WLxx Peripheral Interrupt Handlers */ +/* Add here the Interrupt Handlers for the used peripherals. */ +/* For the available peripheral interrupt handler names, */ +/* please refer to the startup file (startup_stm32wlxx.s). */ +/******************************************************************************/ + +void USART1_IRQHandler(void) +{ + /* USER CODE BEGIN USART1_IRQn 0 */ + + /* USER CODE END USART1_IRQn 0 */ + HAL_UART_IRQHandler(&huart1); + /* USER CODE BEGIN USART2_IRQn 1 */ + + /* USER CODE END USART2_IRQn 1 */ +} + +void USART2_IRQHandler(void) +{ + /* USER CODE BEGIN LPUART1_IRQn 0 */ + + /* USER CODE END LPUART1_IRQn 0 */ + tos_knl_irq_enter(); + HAL_UART_IRQHandler(&huart2); + tos_knl_irq_leave(); + /* USER CODE BEGIN LPUART1_IRQn 1 */ + + /* USER CODE END LPUART1_IRQn 1 */ +} + +void Radio_IRQHandler(void) +{ + HAL_SUBGHZ_IRQHandler(&hsubghz); +} + +/* USER CODE BEGIN 1 */ +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) +{ + extern uint8_t msg; + + if(huart ->Instance == USART2) + { + tos_shell_input_byte(msg); + HAL_UART_Receive_IT(&huart2, (uint8_t*)&msg, 1); + + } +} +/* USER CODE END 1 */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/lorawan_conf.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/lorawan_conf.h new file mode 100644 index 00000000..d2ae10af --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/lorawan_conf.h @@ -0,0 +1,91 @@ +/** + ****************************************************************************** + * @file lorawan_conf.h + * @author MCD Application Team + * @brief configures lorawan instances + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __LORAWAN_CONF_H__ +#define __LORAWAN_CONF_H__ + +#ifdef __cplusplus +extern "C" { +#endif +/* Includes ------------------------------------------------------------------*/ +#include "stm32_systime.h" +#include "app_conf.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ +/* Defines ------------------------------------------------------------------*/ +#ifndef CRITICAL_SECTION_BEGIN +#define CRITICAL_SECTION_BEGIN( ) UTILS_ENTER_CRITICAL_SECTION( ) +#endif +#ifndef CRITICAL_SECTION_END +#define CRITICAL_SECTION_END( ) UTILS_EXIT_CRITICAL_SECTION( ) +#endif + +/* Region ------------------------------------*/ +/* the region listed here will be linked in the MW code */ +/* the applic (on app_conf.h) shall just configure one region at the time */ +//#define REGION_AS923 +//#define REGION_AU915 +#define REGION_CN470 +#define REGION_CN470ALI +//#define REGION_CN779 +//#define REGION_EU433 +#define REGION_EU868 +//#define REGION_KR920 +//#define REGION_IN865 +#define REGION_US915 +//#define REGION_RU864 + + + + +#ifdef LORAMAC_CLASSB_ENABLED +/* CLASS B LSE crystall calibration*/ + /*! + * \brief Temperature coefficient of the clock source + */ +#define RTC_TEMP_COEFFICIENT ( -0.035 ) + +/*! + * \brief Temperature coefficient deviation of the clock source + */ +#define RTC_TEMP_DEV_COEFFICIENT ( 0.0035 ) + +/*! + * \brief Turnover temperature of the clock source + */ +#define RTC_TEMP_TURNOVER ( 25.0 ) + +/*! + * \brief Turnover temperature deviation of the clock source + */ +#define RTC_TEMP_DEV_TURNOVER ( 5.0 ) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __LORAWAN_CONF_H__ */ +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ + diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/mw_log_conf.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/mw_log_conf.h new file mode 100644 index 00000000..af4aa905 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/mw_log_conf.h @@ -0,0 +1,73 @@ +/** + ****************************************************************************** + * @file mw_log_conf.h + * @author MCD Application Team + * @brief Interface layer CM4 System to MBMUX (Mailbox Multiplexer) + ******************************************************************************* + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __MW_LOG_CONF_H__ +#define __MW_LOG_CONF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include "app_conf.h" +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* Exported macros -----------------------------------------------------------*/ + +#if LOG_LEVEL == 0 + #define LOG_PRINT printf +#elif LOG_LEVEL == 1 + #define LOG_PRINT(...) do{printf("<>\r\n"\ + ,__LINE__, __FUNCTION__);\ + printf(__VA_ARGS__);}while(0); +#elif LOG_LEVEL == 2 + #define LOG_PRINT(...) do{printf("<<<%s ->line:%d ;function:%s >>>\r\n"\ + ,__FILE__,__LINE__, __FUNCTION__);\ + printf(__VA_ARGS__);}while(0); +#endif + +#if defined (MW_LOG_ENABLED) && (MW_LOG_ENABLED == 1) + #define PPRINTF printf + #define TPRINTF printf + #define PRINTF printf + #define MW_LOG LOG_PRINT +#else + #define PPRINTF(...) + #define TPRINTF(...) + #define PRINTF(...) + #define MW_LOG(...) +#endif + +/* Defines -------------------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + + + +#ifdef __cplusplus +} +#endif + +#endif /*__MW_LOG_CONF_H__ */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/radio_conf.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/radio_conf.h new file mode 100644 index 00000000..14ef11a7 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/radio_conf.h @@ -0,0 +1,64 @@ +/******************************************************************************* + * @file radio_conf.h + * @author MCD Application Team + * @brief Header of radio configuration + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __RADIO_CONF_H__ +#define __RADIO_CONF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "platform.h" +#include "mw_log_conf.h" + +#include "radio_driver.h" +#include "app_conf.h" +#include "stm32_mem.h" + +#ifndef CRITICAL_SECTION_BEGIN +#define CRITICAL_SECTION_BEGIN( ) UTILS_ENTER_CRITICAL_SECTION( ) +#endif +#ifndef CRITICAL_SECTION_END +#define CRITICAL_SECTION_END( ) UTILS_EXIT_CRITICAL_SECTION( ) +#endif +/* Exported types ------------------------------------------------------------*/ +/* Defines ------------------------*/ +#define RADIO_RX_BUF_SIZE 255 + +//#define LET_SUBGHZ_MW_USING_DGB_LINE1_PIN +//#define LET_SUBGHZ_MW_USING_DGB_LINE2_PIN + +/* Function mapping */ +#define RADIO_DELAY_MS HAL_Delay +#define RADIO_MEMSET8( dest, value, size ) UTIL_MEM_set_8(dest, value, size ) + + +/* Exported constants --------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __RADIO_CONF_H__*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/systime.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/systime.h new file mode 100644 index 00000000..31ab25db --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/systime.h @@ -0,0 +1,41 @@ +/****************************************************************************** + * @file systime.h + * @author MCD Application Team + * @brief map middleware systime + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ + +#ifndef __SYSTIME_H__ +#define __SYSTIME_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "stm32_systime.h" +/* Exported constants --------------------------------------------------------*/ +/* Exported types ------------------------------------------------------------*/ +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +/* Exported functions ------------------------------------------------------- */ + + +#ifdef __cplusplus +} +#endif + +#endif /*__SYSTIME_H__*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer.h new file mode 100644 index 00000000..97912016 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer.h @@ -0,0 +1,72 @@ +/****************************************************************************** + * @file timer.h + * @author MCD Application Team + * @brief wrapper to timer server + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under Ultimate Liberty license + * SLA0044, the "License"; You may not use this file except in compliance with + * the License. You may obtain a copy of the License at: + * www.st.com/SLA0044 + * + ****************************************************************************** + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __TIMER_H__ +#define __TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +//#include "stm32_timer.h" +#include + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +#define TIMER_MAX_VAL 0xFFFFFFFFU + +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +#define TimerTime_t k_tick_t + +#define TimerEvent_t k_timer_t + +#define TimerInit(HANDLE, CB) do {\ + tos_timer_create( HANDLE, TIMER_MAX_VAL, 0, CB, NULL, TOS_OPT_TIMER_ONESHOT);\ + } while(0) + +#define TimerSetValue(HANDLE, TIMEOUT) do{ \ + tos_timer_delay_change(HANDLE, TIMEOUT);\ + } while(0) + +#define TimerStart(HANDLE) do {\ + tos_timer_start(HANDLE);\ + } while(0) + +#define TimerStop(HANDLE) do {\ + tos_timer_stop(HANDLE);\ + } while(0) + +#define TimerGetCurrentTime TIMER_GetCurrentTime + +#define TimerGetElapsedTime TIMER_GetElapsedTime + +uint8_t TIMER_GetCurrentTime(void); + +uint8_t TIMER_GetElapsedTime(TimerTime_t past); + +/* Exported functions ------------------------------------------------------- */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIMER_H__*/ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer_wrapper.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer_wrapper.c new file mode 100644 index 00000000..7e541fab --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/timer_wrapper.c @@ -0,0 +1,18 @@ +#include +#include "timer.h" +#include "rtc_if.h" + + +uint8_t TIMER_GetCurrentTime(void) +{ + uint32_t now = RTC_GetTimerValue( ); + return RTC_Tick2ms(now); +} + +uint8_t TIMER_GetElapsedTime(TimerTime_t past) +{ + uint32_t nowInTicks = RTC_GetTimerValue(); + uint32_t pastInTicks = RTC_ms2Tick(past); + /* intentional wrap around. Works Ok if tick duation below 1ms */ + return RTC_Tick2ms(nowInTicks - pastInTicks); +} \ No newline at end of file diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/utilities_conf.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/utilities_conf.h new file mode 100644 index 00000000..914fa6f5 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/Target/utilities_conf.h @@ -0,0 +1,118 @@ +/** + ****************************************************************************** + * @file utilities_conf.h + * @author MCD Application Team + * @brief Configuration file to utilities + ****************************************************************************** + * @attention + * + *

© Copyright (c) 2019 STMicroelectronics. + * All rights reserved.

+ * + * This software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + * opensource.org/licenses/BSD-3-Clause + * + ****************************************************************************** + */ + + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef UTILITIES_CONF_H +#define UTILITIES_CONF_H + +#ifdef __cplusplus +extern "C" { +#endif + + + +/* Includes ------------------------------------------------------------------*/ +#include "stm32wlxx.h" + +/* definitions to be provided to "sequencer" utility */ +#include "stm32_mem.h" +/* definition and callback for tiny_vsnprintf */ +#include "stm32_tiny_vsnprintf.h" + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/****************************************************************************** + * Common + ******************************************************************************/ +#if defined(__CC_ARM) +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__), zero_init)) +#elif defined(__ICCARM__) +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) +#else /* __GNUC__ */ +#define UTIL_PLACE_IN_SECTION( __x__ ) __attribute__((section (__x__))) +#endif + +#undef ALIGN +#ifdef WIN32 +#define ALIGN(n) +#else +#define ALIGN(n) __attribute__((aligned(n))) +#endif + +/*---------------------------------------------------------------------------*/ +/* sequencer configuration */ +/*---------------------------------------------------------------------------*/ +#define UTIL_SEQ_RFU 0 + +#define UTIL_SEQ_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() +#define UTIL_SEQ_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() +#define UTIL_SEQ_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() +#define UTIL_SEQ_MEMSET8( dest, value, size ) UTIL_MEM_set_8( dest, value, size ) + + +/* External variables --------------------------------------------------------*/ +/* Exported macros -----------------------------------------------------------*/ +#define UTILS_INIT_CRITICAL_SECTION() +#define UTILS_ENTER_CRITICAL_SECTION() uint32_t primask_bit= __get_PRIMASK();\ + __disable_irq() +#define UTILS_EXIT_CRITICAL_SECTION() __set_PRIMASK(primask_bit) + + +/* Exported functions ------------------------------------------------------- */ +/****************************************************************************** + * trace\advanced + * the define option + * UTIL_ADV_TRACE_CONDITIONNAL shall be defined if you want use conditionnal function + * UTIL_ADV_TRACE_UNCHUNK_MODE shall be defined if you want use the unchunk mode + * + ******************************************************************************/ + + +#define VLEVEL_OFF 0 +#define VLEVEL_L 1 /* just essential traces */ +#define VLEVEL_M 2 +#define VLEVEL_H 3 /* all traces */ + +#define TS_OFF 0 /*Log without TimeStamp*/ +#define TS_ON 1 /*Log with TimeStamp*/ + +#define T_REG_OFF 0 /*Log without bitmask*/ + +#define UTIL_ADV_TRACE_CONDITIONNAL +#define UTIL_ADV_TRACE_UNCHUNK_MODE +#define UTIL_ADV_TRACE_DEBUG(...) +#define UTIL_ADV_TRACE_INIT_CRITICAL_SECTION( ) UTILS_INIT_CRITICAL_SECTION() +#define UTIL_ADV_TRACE_ENTER_CRITICAL_SECTION( ) UTILS_ENTER_CRITICAL_SECTION() +#define UTIL_ADV_TRACE_EXIT_CRITICAL_SECTION( ) UTILS_EXIT_CRITICAL_SECTION() +#define UTIL_ADV_TRACE_TMP_BUF_SIZE (256U) +#define UTIL_ADV_TRACE_TMP_MAX_TIMESTMAP_SIZE (15U) +#define UTIL_ADV_TRACE_FIFO_SIZE (512U) +#define UTIL_ADV_TRACE_MEMSET8( dest, value, size) UTIL_MEM_set_8((dest),(value),(size)) +#define UTIL_ADV_TRACE_VSNPRINTF(...) tiny_vsnprintf_like(__VA_ARGS__) + + +#ifdef __cplusplus +} +#endif + +#endif /*UTILITIES_CONF_H */ + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvoptx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvoptx new file mode 100644 index 00000000..fbb23bdc --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvoptx @@ -0,0 +1,1673 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + TencentOS_Tiny + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\List\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32WLxx_CM4 -FL040000 -FS08000000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM) + + + 0 + ST-LINKIII-KEIL_SWO + -U51FF68064965575333151687 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO31 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4.FLM -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + + + 0 + 0 + 122 + 0 +
134244104
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\kernel\core\tos_task.c + + \\TencentOS_Tiny\../../../../kernel/core/tos_task.c\122 +
+ + 1 + 0 + 105 + 1 +
134218200
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S + + \\TencentOS_Tiny\../../../../arch/arm/arm-v7m/cortex-m4/armcc/port_s.S\105 +
+ + 2 + 0 + 97 + 1 +
134218196
+ 0 + 0 + 0 + 0 + 0 + 1 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S + + \\TencentOS_Tiny\../../../../arch/arm/arm-v7m/cortex-m4/armcc/port_s.S\97 +
+
+ + + 0 + 1 + task + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + +
+
+ + + Application/MDK-ARM + 0 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + .\startup_stm32wle5xx.s + startup_stm32wle5xx.s + 0 + 0 + + + + + Application/User + 1 + 0 + 0 + 0 + + 2 + 2 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\adc.c + adc.c + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\adc_if.c + adc_if.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\dma.c + dma.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\gpio.c + gpio.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\rtc.c + rtc.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\rtc_if.c + rtc_if.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\stm32_lpm_if.c + stm32_lpm_if.c + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\stm32wlxx_hal_msp.c + stm32wlxx_hal_msp.c + 0 + 0 + + + 2 + 10 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\usart.c + usart.c + 0 + 0 + + + 2 + 11 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\usart_if.c + usart_if.c + 0 + 0 + + + 2 + 12 + 1 + 0 + 0 + 0 + .\App\mcu_init.c + mcu_init.c + 0 + 0 + + + 2 + 13 + 1 + 0 + 0 + 0 + .\App\stm32wlxx_it.c + stm32wlxx_it.c + 0 + 0 + + + + + Drivers/STM32WLxx_HAL_Driver + 0 + 0 + 0 + 0 + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal.c + stm32wlxx_hal.c + 0 + 0 + + + 3 + 15 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_cortex.c + stm32wlxx_hal_cortex.c + 0 + 0 + + + 3 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_dma.c + stm32wlxx_hal_dma.c + 0 + 0 + + + 3 + 17 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_dma_ex.c + stm32wlxx_hal_dma_ex.c + 0 + 0 + + + 3 + 18 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_exti.c + stm32wlxx_hal_exti.c + 0 + 0 + + + 3 + 19 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_flash.c + stm32wlxx_hal_flash.c + 0 + 0 + + + 3 + 20 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_flash_ex.c + stm32wlxx_hal_flash_ex.c + 0 + 0 + + + 3 + 21 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_gpio.c + stm32wlxx_hal_gpio.c + 0 + 0 + + + 3 + 22 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_pwr.c + stm32wlxx_hal_pwr.c + 0 + 0 + + + 3 + 23 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_pwr_ex.c + stm32wlxx_hal_pwr_ex.c + 0 + 0 + + + 3 + 24 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rcc.c + stm32wlxx_hal_rcc.c + 0 + 0 + + + 3 + 25 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rcc_ex.c + stm32wlxx_hal_rcc_ex.c + 0 + 0 + + + 3 + 26 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_tim.c + stm32wlxx_hal_tim.c + 0 + 0 + + + 3 + 27 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_tim_ex.c + stm32wlxx_hal_tim_ex.c + 0 + 0 + + + 3 + 28 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_uart.c + stm32wlxx_hal_uart.c + 0 + 0 + + + 3 + 29 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_uart_ex.c + stm32wlxx_hal_uart_ex.c + 0 + 0 + + + 3 + 30 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_adc.c + stm32wlxx_hal_adc.c + 0 + 0 + + + 3 + 31 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_adc_ex.c + stm32wlxx_hal_adc_ex.c + 0 + 0 + + + 3 + 32 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rtc.c + stm32wlxx_hal_rtc.c + 0 + 0 + + + 3 + 33 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rtc_ex.c + stm32wlxx_hal_rtc_ex.c + 0 + 0 + + + 3 + 34 + 1 + 0 + 0 + 0 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_subghz.c + stm32wlxx_hal_subghz.c + 0 + 0 + + + + + Drivers/CMSIS + 0 + 0 + 0 + 0 + + 4 + 35 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\system_stm32wlxx.c + system_stm32wlxx.c + 0 + 0 + + + + + tos/arch + 0 + 0 + 0 + 0 + + 5 + 36 + 1 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c + tos_cpu.c + 0 + 0 + + + 5 + 37 + 1 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c + port_c.c + 0 + 0 + + + 5 + 38 + 2 + 0 + 0 + 0 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S + port_s.S + 0 + 0 + + + + + tos/kernel + 0 + 0 + 0 + 0 + + 6 + 39 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_barrier.c + tos_barrier.c + 0 + 0 + + + 6 + 40 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_binary_heap.c + tos_binary_heap.c + 0 + 0 + + + 6 + 41 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_bitmap.c + tos_bitmap.c + 0 + 0 + + + 6 + 42 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_char_fifo.c + tos_char_fifo.c + 0 + 0 + + + 6 + 43 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_completion.c + tos_completion.c + 0 + 0 + + + 6 + 44 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_countdownlatch.c + tos_countdownlatch.c + 0 + 0 + + + 6 + 45 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_event.c + tos_event.c + 0 + 0 + + + 6 + 46 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_global.c + tos_global.c + 0 + 0 + + + 6 + 47 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mail_queue.c + tos_mail_queue.c + 0 + 0 + + + 6 + 48 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_message_queue.c + tos_message_queue.c + 0 + 0 + + + 6 + 49 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mmblk.c + tos_mmblk.c + 0 + 0 + + + 6 + 50 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mmheap.c + tos_mmheap.c + 0 + 0 + + + 6 + 51 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_mutex.c + tos_mutex.c + 0 + 0 + + + 6 + 52 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_pend.c + tos_pend.c + 0 + 0 + + + 6 + 53 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_mail_queue.c + tos_priority_mail_queue.c + 0 + 0 + + + 6 + 54 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_message_queue.c + tos_priority_message_queue.c + 0 + 0 + + + 6 + 55 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_priority_queue.c + tos_priority_queue.c + 0 + 0 + + + 6 + 56 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_ring_queue.c + tos_ring_queue.c + 0 + 0 + + + 6 + 57 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_robin.c + tos_robin.c + 0 + 0 + + + 6 + 58 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_rwlock.c + tos_rwlock.c + 0 + 0 + + + 6 + 59 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sched.c + tos_sched.c + 0 + 0 + + + 6 + 60 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sem.c + tos_sem.c + 0 + 0 + + + 6 + 61 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_stopwatch.c + tos_stopwatch.c + 0 + 0 + + + 6 + 62 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_sys.c + tos_sys.c + 0 + 0 + + + 6 + 63 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_task.c + tos_task.c + 0 + 0 + + + 6 + 64 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_tick.c + tos_tick.c + 0 + 0 + + + 6 + 65 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_time.c + tos_time.c + 0 + 0 + + + 6 + 66 + 1 + 0 + 0 + 0 + ..\..\..\..\kernel\core\tos_timer.c + tos_timer.c + 0 + 0 + + + + + tos/cmsis + 0 + 0 + 0 + 0 + + 7 + 67 + 1 + 0 + 0 + 0 + ..\..\..\..\osal\cmsis_os\cmsis_os.c + cmsis_os.c + 0 + 0 + + + + + TOS-CONFIG + 0 + 0 + 0 + 0 + + 8 + 68 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\main.c + main.c + 0 + 0 + + + 8 + 69 + 5 + 0 + 0 + 0 + ..\..\TOS_CONFIG\tos_config.h + tos_config.h + 0 + 0 + + + + + APP + 0 + 0 + 0 + 0 + + 9 + 70 + 1 + 0 + 0 + 0 + .\App\app_lorawan.c + app_lorawan.c + 0 + 0 + + + 9 + 71 + 1 + 0 + 0 + 0 + .\App\app_system.c + app_system.c + 0 + 0 + + + 9 + 72 + 5 + 0 + 0 + 0 + .\App\app_conf.h + app_conf.h + 0 + 0 + + + 9 + 73 + 5 + 0 + 0 + 0 + .\App\Commissioning.h + Commissioning.h + 0 + 0 + + + 9 + 74 + 1 + 0 + 0 + 0 + .\Target\timer_wrapper.c + timer_wrapper.c + 0 + 0 + + + + + Hardware + 1 + 0 + 0 + 0 + + 10 + 75 + 1 + 0 + 0 + 0 + .\App\sensor_parser.c + sensor_parser.c + 0 + 0 + + + + + lorawan/pattern + 0 + 0 + 0 + 0 + + 11 + 76 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic\lora.c + lora.c + 0 + 0 + + + 11 + 77 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic\lorawan_info.c + lorawan_info.c + 0 + 0 + + + + + lorawan/mac + 0 + 0 + 0 + 0 + + 12 + 78 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\aes.c + aes.c + 0 + 0 + + + 12 + 79 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\cmac.c + cmac.c + 0 + 0 + + + 12 + 80 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\soft-se.c + soft-se.c + 0 + 0 + + + 12 + 81 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMac.c + LoRaMac.c + 0 + 0 + + + 12 + 82 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacAdr.c + LoRaMacAdr.c + 0 + 0 + + + 12 + 83 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacClassB.c + LoRaMacClassB.c + 0 + 0 + + + 12 + 84 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacCommands.c + LoRaMacCommands.c + 0 + 0 + + + 12 + 85 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacConfirmQueue.c + LoRaMacConfirmQueue.c + 0 + 0 + + + 12 + 86 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacCrypto.c + LoRaMacCrypto.c + 0 + 0 + + + 12 + 87 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacParser.c + LoRaMacParser.c + 0 + 0 + + + 12 + 88 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacSerializer.c + LoRaMacSerializer.c + 0 + 0 + + + + + lorawan/region + 0 + 0 + 0 + 0 + + 13 + 89 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\Region.c + Region.c + 0 + 0 + + + 13 + 90 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionAS923.c + RegionAS923.c + 0 + 0 + + + 13 + 91 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionAU915.c + RegionAU915.c + 0 + 0 + + + 13 + 92 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN470.c + RegionCN470.c + 0 + 0 + + + 13 + 93 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN470ALI.c + RegionCN470ALI.c + 0 + 0 + + + 13 + 94 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN779.c + RegionCN779.c + 0 + 0 + + + 13 + 95 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCommon.c + RegionCommon.c + 0 + 0 + + + 13 + 96 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionEU433.c + RegionEU433.c + 0 + 0 + + + 13 + 97 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionEU868.c + RegionEU868.c + 0 + 0 + + + 13 + 98 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionIN865.c + RegionIN865.c + 0 + 0 + + + 13 + 99 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionKR920.c + RegionKR920.c + 0 + 0 + + + 13 + 100 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionRU864.c + RegionRU864.c + 0 + 0 + + + 13 + 101 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionUS915.c + RegionUS915.c + 0 + 0 + + + + + lorawan/common + 0 + 0 + 0 + 0 + + 14 + 102 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\LoRaWAN\Utilities\utilities.c + utilities.c + 0 + 0 + + + + + SubGHz_Phy/radio + 0 + 0 + 0 + 0 + + 15 + 103 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver\radio.c + radio.c + 0 + 0 + + + 15 + 104 + 1 + 0 + 0 + 0 + ..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver\radio_driver.c + radio_driver.c + 0 + 0 + + + + + Utilities + 0 + 0 + 0 + 0 + + 16 + 105 + 1 + 0 + 0 + 0 + ..\..\BSP\Utilities\lpm\tiny_lpm\stm32_lpm.c + stm32_lpm.c + 0 + 0 + + + 16 + 106 + 1 + 0 + 0 + 0 + ..\..\BSP\Utilities\misc\stm32_mem.c + stm32_mem.c + 0 + 0 + + + 16 + 107 + 1 + 0 + 0 + 0 + ..\..\BSP\Utilities\misc\stm32_systime.c + stm32_systime.c + 0 + 0 + + + + + ::CMSIS + 0 + 0 + 0 + 1 + + +
diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvprojx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvprojx new file mode 100644 index 00000000..7c4ce239 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/TencentOS_Tiny.uvprojx @@ -0,0 +1,1017 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + TencentOS_Tiny + 0x4 + ARM-ADS + 6100001::V6.10.1::.\ARMCLANG + 1 + + + STM32WLE5JCIx + STMicroelectronics + Keil.STM32WLxx_DFP.1.0.2.OEM + http://www.keil.com/pack + IRAM(0x20000000,0x10000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4 -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM)) + 0 + $$Device:STM32WLE5JCIx$Drivers\Device\ST\STM32WLxx\Include\stm32wlxx.h + + + + + + + + + + $$Device:STM32WLE5JCIx$CMSIS\SVD\STM32WLE5_CM4.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Obj\ + TencentOS_Tiny + 1 + 0 + 1 + 1 + 1 + .\List\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 0 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM4 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM4 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4107 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M4" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x10000 + + + 1 + 0x8000000 + 0x40000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x40000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x10000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 7 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 1 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + USE_HAL_DRIVER,STM32WLE5xx,CORE_CM4 + + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32WLxx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG;..\..\BSP\Middlewares\LoRaWAN\Conf;..\..\BSP\Middlewares\LoRaWAN\Crypto;..\..\BSP\Middlewares\LoRaWAN\Mac;..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic;..\..\BSP\Middlewares\LoRaWAN\Utilities;..\..\BSP\Middlewares\SubGHz_Phy;..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver;..\..\BSP\Inc;.\App;.\Target;..\..\BSP\Utilities\lpm\tiny_lpm;..\..\BSP\Utilities\misc + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + --diag_suppress L6314W + + + + + + + + Application/MDK-ARM + + + startup_stm32wle5xx.s + 2 + .\startup_stm32wle5xx.s + + + + + Application/User + + + adc.c + 1 + ..\..\BSP\Src\adc.c + + + adc_if.c + 1 + ..\..\BSP\Src\adc_if.c + + + dma.c + 1 + ..\..\BSP\Src\dma.c + + + gpio.c + 1 + ..\..\BSP\Src\gpio.c + + + rtc.c + 1 + ..\..\BSP\Src\rtc.c + + + rtc_if.c + 1 + ..\..\BSP\Src\rtc_if.c + + + stm32_lpm_if.c + 1 + ..\..\BSP\Src\stm32_lpm_if.c + + + stm32wlxx_hal_msp.c + 1 + ..\..\BSP\Src\stm32wlxx_hal_msp.c + + + usart.c + 1 + ..\..\BSP\Src\usart.c + + + usart_if.c + 1 + ..\..\BSP\Src\usart_if.c + + + mcu_init.c + 1 + .\App\mcu_init.c + + + stm32wlxx_it.c + 1 + .\App\stm32wlxx_it.c + + + + + Drivers/STM32WLxx_HAL_Driver + + + stm32wlxx_hal.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal.c + + + stm32wlxx_hal_cortex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_cortex.c + + + stm32wlxx_hal_dma.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_dma.c + + + stm32wlxx_hal_dma_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_dma_ex.c + + + stm32wlxx_hal_exti.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_exti.c + + + stm32wlxx_hal_flash.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_flash.c + + + stm32wlxx_hal_flash_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_flash_ex.c + + + stm32wlxx_hal_gpio.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_gpio.c + + + stm32wlxx_hal_pwr.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_pwr.c + + + stm32wlxx_hal_pwr_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_pwr_ex.c + + + stm32wlxx_hal_rcc.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rcc.c + + + stm32wlxx_hal_rcc_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rcc_ex.c + + + stm32wlxx_hal_tim.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_tim.c + + + stm32wlxx_hal_tim_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_tim_ex.c + + + stm32wlxx_hal_uart.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_uart.c + + + stm32wlxx_hal_uart_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_uart_ex.c + + + stm32wlxx_hal_adc.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_adc.c + + + stm32wlxx_hal_adc_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_adc_ex.c + + + stm32wlxx_hal_rtc.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rtc.c + + + stm32wlxx_hal_rtc_ex.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_rtc_ex.c + + + stm32wlxx_hal_subghz.c + 1 + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Src\stm32wlxx_hal_subghz.c + + + + + Drivers/CMSIS + + + system_stm32wlxx.c + 1 + ..\..\BSP\Src\system_stm32wlxx.c + + + + + tos/arch + + + tos_cpu.c + 1 + ..\..\..\..\arch\arm\arm-v7m\common\tos_cpu.c + + + port_c.c + 1 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_c.c + + + port_s.S + 2 + ..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc\port_s.S + + + + + tos/kernel + + + tos_barrier.c + 1 + ..\..\..\..\kernel\core\tos_barrier.c + + + tos_binary_heap.c + 1 + ..\..\..\..\kernel\core\tos_binary_heap.c + + + tos_bitmap.c + 1 + ..\..\..\..\kernel\core\tos_bitmap.c + + + tos_char_fifo.c + 1 + ..\..\..\..\kernel\core\tos_char_fifo.c + + + tos_completion.c + 1 + ..\..\..\..\kernel\core\tos_completion.c + + + tos_countdownlatch.c + 1 + ..\..\..\..\kernel\core\tos_countdownlatch.c + + + tos_event.c + 1 + ..\..\..\..\kernel\core\tos_event.c + + + tos_global.c + 1 + ..\..\..\..\kernel\core\tos_global.c + + + tos_mail_queue.c + 1 + ..\..\..\..\kernel\core\tos_mail_queue.c + + + tos_message_queue.c + 1 + ..\..\..\..\kernel\core\tos_message_queue.c + + + tos_mmblk.c + 1 + ..\..\..\..\kernel\core\tos_mmblk.c + + + tos_mmheap.c + 1 + ..\..\..\..\kernel\core\tos_mmheap.c + + + tos_mutex.c + 1 + ..\..\..\..\kernel\core\tos_mutex.c + + + tos_pend.c + 1 + ..\..\..\..\kernel\core\tos_pend.c + + + tos_priority_mail_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_mail_queue.c + + + tos_priority_message_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_message_queue.c + + + tos_priority_queue.c + 1 + ..\..\..\..\kernel\core\tos_priority_queue.c + + + tos_ring_queue.c + 1 + ..\..\..\..\kernel\core\tos_ring_queue.c + + + tos_robin.c + 1 + ..\..\..\..\kernel\core\tos_robin.c + + + tos_rwlock.c + 1 + ..\..\..\..\kernel\core\tos_rwlock.c + + + tos_sched.c + 1 + ..\..\..\..\kernel\core\tos_sched.c + + + tos_sem.c + 1 + ..\..\..\..\kernel\core\tos_sem.c + + + tos_stopwatch.c + 1 + ..\..\..\..\kernel\core\tos_stopwatch.c + + + tos_sys.c + 1 + ..\..\..\..\kernel\core\tos_sys.c + + + tos_task.c + 1 + ..\..\..\..\kernel\core\tos_task.c + + + tos_tick.c + 1 + ..\..\..\..\kernel\core\tos_tick.c + + + tos_time.c + 1 + ..\..\..\..\kernel\core\tos_time.c + + + tos_timer.c + 1 + ..\..\..\..\kernel\core\tos_timer.c + + + + + tos/cmsis + + + cmsis_os.c + 1 + ..\..\..\..\osal\cmsis_os\cmsis_os.c + + + + + TOS-CONFIG + + + main.c + 1 + ..\..\BSP\Src\main.c + + + tos_config.h + 5 + ..\..\TOS_CONFIG\tos_config.h + + + + + APP + + + app_lorawan.c + 1 + .\App\app_lorawan.c + + + app_system.c + 1 + .\App\app_system.c + + + app_conf.h + 5 + .\App\app_conf.h + + + Commissioning.h + 5 + .\App\Commissioning.h + + + timer_wrapper.c + 1 + .\Target\timer_wrapper.c + + + + + Hardware + + + sensor_parser.c + 1 + .\App\sensor_parser.c + + + + + lorawan/pattern + + + lora.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic\lora.c + + + lorawan_info.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic\lorawan_info.c + + + + + lorawan/mac + + + aes.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\aes.c + + + cmac.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\cmac.c + + + soft-se.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Crypto\soft-se.c + + + LoRaMac.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMac.c + + + LoRaMacAdr.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacAdr.c + + + LoRaMacClassB.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacClassB.c + + + LoRaMacCommands.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacCommands.c + + + LoRaMacConfirmQueue.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacConfirmQueue.c + + + LoRaMacCrypto.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacCrypto.c + + + LoRaMacParser.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacParser.c + + + LoRaMacSerializer.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\LoRaMacSerializer.c + + + + + lorawan/region + + + Region.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\Region.c + + + RegionAS923.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionAS923.c + + + RegionAU915.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionAU915.c + + + RegionCN470.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN470.c + + + RegionCN470ALI.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN470ALI.c + + + RegionCN779.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCN779.c + + + RegionCommon.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionCommon.c + + + RegionEU433.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionEU433.c + + + RegionEU868.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionEU868.c + + + RegionIN865.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionIN865.c + + + RegionKR920.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionKR920.c + + + RegionRU864.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionRU864.c + + + RegionUS915.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Mac\region\RegionUS915.c + + + + + lorawan/common + + + utilities.c + 1 + ..\..\BSP\Middlewares\LoRaWAN\Utilities\utilities.c + + + + + SubGHz_Phy/radio + + + radio.c + 1 + ..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver\radio.c + + + radio_driver.c + 1 + ..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver\radio_driver.c + + + + + Utilities + + + stm32_lpm.c + 1 + ..\..\BSP\Utilities\lpm\tiny_lpm\stm32_lpm.c + + + stm32_mem.c + 1 + ..\..\BSP\Utilities\misc\stm32_mem.c + + + stm32_systime.c + 1 + ..\..\BSP\Utilities\misc\stm32_systime.c + + + + + ::CMSIS + + + + + + + + + + + + + + + + + + +
diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/startup_stm32wle5xx.s b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/startup_stm32wle5xx.s new file mode 100644 index 00000000..7f965b48 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan_pm25/startup_stm32wle5xx.s @@ -0,0 +1,359 @@ +;****************************************************************************** +;* File Name : startup_stm32wle5xx_cm4.s +;* Author : MCD Application Team +;* Description : STM32WLE5xx devices vector table for MDK-ARM toolchain. +;* This module performs: +;* - Set the initial SP +;* - Set the initial PC == Reset_Handler +;* - Set the vector table entries with the exceptions ISR address +;* - Branches to __main in the C library (which eventually +;* calls main()). +;* After Reset the CortexM4 processor is in Thread mode, +;* priority is Privileged, and the Stack is set to Main. +;* <<< Use Configuration Wizard in Context Menu >>> +;****************************************************************************** +;* @attention +;* +;* Copyright (c) 2019 STMicroelectronics. All rights reserved. +;* +;* This software component is licensed by ST under BSD 3-Clause license, +;* the "License"; You may not use this file except in compliance with the +;* License. You may obtain a copy of the License at: +;* opensource.org/licenses/BSD-3-Clause +;* +;****************************************************************************** + +; Amount of memory (in bytes) allocated for Stack +; Tailor this value to your application needs +; Stack Configuration +; Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Stack_Size EQU 0x00000800 + + AREA STACK, NOINIT, READWRITE, ALIGN=3 +Stack_Mem SPACE Stack_Size +__initial_sp + + +; Heap Configuration +; Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> +; + +Heap_Size EQU 0x00000200 + + AREA HEAP, NOINIT, READWRITE, ALIGN=3 +__heap_base +Heap_Mem SPACE Heap_Size +__heap_limit + + PRESERVE8 + THUMB + + +; Vector Table Mapped to Address 0 at Reset + AREA RESET, DATA, READONLY + EXPORT __Vectors + EXPORT __Vectors_End + EXPORT __Vectors_Size + +__Vectors DCD __initial_sp ; Top of Stack + DCD Reset_Handler ; Reset Handler + DCD NMI_Handler ; NMI Handler + DCD HardFault_Handler ; Hard Fault Handler + DCD MemManage_Handler ; MPU Fault Handler + DCD BusFault_Handler ; Bus Fault Handler + DCD UsageFault_Handler ; Usage Fault Handler + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD SVC_Handler ; SVCall Handler + DCD DebugMon_Handler ; Debug Monitor Handler + DCD 0 ; Reserved + DCD PendSV_Handler ; PendSV Handler + DCD SysTick_Handler ; SysTick Handler + + ; External Interrupts + DCD WWDG_IRQHandler ; Window WatchDog + DCD PVD_PVM_IRQHandler ; PVD and PVM detector + DCD TAMP_STAMP_LSECSS_SSRU_IRQHandler ; RTC Tamper, RTC TimeStamp, LSECSS and RTC SSR Underflow Interrupts + DCD RTC_WKUP_IRQHandler ; RTC Wakeup Interrupt + DCD FLASH_IRQHandler ; FLASH global Interrupt + DCD RCC_IRQHandler ; RCC Interrupt + DCD EXTI0_IRQHandler ; EXTI Line 0 Interrupt + DCD EXTI1_IRQHandler ; EXTI Line 1 Interrupt + DCD EXTI2_IRQHandler ; EXTI Line 2 Interrupt + DCD EXTI3_IRQHandler ; EXTI Line 3 Interrup + DCD EXTI4_IRQHandler ; EXTI Line 4 Interrupt + DCD DMA1_Channel1_IRQHandler ; DMA1 Channel 1 Interrupt + DCD DMA1_Channel2_IRQHandler ; DMA1 Channel 2 Interrupt + DCD DMA1_Channel3_IRQHandler ; DMA1 Channel 3 Interrupt + DCD DMA1_Channel4_IRQHandler ; DMA1 Channel 4 Interrupt + DCD DMA1_Channel5_IRQHandler ; DMA1 Channel 5 Interrupt + DCD DMA1_Channel6_IRQHandler ; DMA1 Channel 6 Interrupt + DCD DMA1_Channel7_IRQHandler ; DMA1 Channel 7 Interrupt + DCD ADC1_IRQHandler ; ADC1 Interrupt + DCD DAC_IRQHandler ; DAC Interrupt + DCD 0 ; Reserved + DCD COMP_IRQHandler ; COMP1 and COMP2 Interrupts + DCD EXTI9_5_IRQHandler ; EXTI Lines [9:5] Interrupt + DCD TIM1_BRK_IRQHandler ; TIM1 Break Interrupt + DCD TIM1_UP_IRQHandler ; TIM1 Update Interrupts + DCD TIM1_TRG_COM_IRQHandler ; TIM1 Trigger and Communication Interrupts + DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare Interrupt + DCD TIM2_IRQHandler ; TIM2 Global Interrupt + DCD TIM16_IRQHandler ; TIM16 Global Interrupt + DCD TIM17_IRQHandler ; TIM17 Global Interrupt + DCD I2C1_EV_IRQHandler ; I2C1 Event Interrupt + DCD I2C1_ER_IRQHandler ; I2C1 Error Interrupt + DCD I2C2_EV_IRQHandler ; I2C2 Event Interrupt + DCD I2C2_ER_IRQHandler ; I2C2 Error Interrupt + DCD SPI1_IRQHandler ; SPI1 Interrupt + DCD SPI2_IRQHandler ; SPI2 Interrupt + DCD USART1_IRQHandler ; USART1 Interrupt + DCD USART2_IRQHandler ; USART2 Interrupt + DCD LPUART1_IRQHandler ; LPUART1 Interrupt + DCD LPTIM1_IRQHandler ; LPTIM1 Interrupt + DCD LPTIM2_IRQHandler ; LPTIM2 Interrupt + DCD EXTI15_10_IRQHandler ; EXTI Lines1[15:10 ]Interrupts + DCD RTC_Alarm_IRQHandler ; RTC Alarms (A and B) Interrupt + DCD LPTIM3_IRQHandler ; LPTIM3 Interrupt + DCD SUBGHZSPI_IRQHandler ; SUBGHZSPI Interrupt + DCD 0 ; Reserved + DCD 0 ; Reserved + DCD HSEM_IRQHandler ; HSEM0 Interrupt + DCD I2C3_EV_IRQHandler ; I2C3 Event Interrupt + DCD I2C3_ER_IRQHandler ; I2C3 Error Interrupt + DCD Radio_IRQHandler ; Radio Interrupt + DCD AES_IRQHandler ; AES Interrupt + DCD RNG_IRQHandler ; RNG1 Interrupt + DCD PKA_IRQHandler ; PKA Interrupt + DCD DMA2_Channel1_IRQHandler ; DMA2 Channel 1 Interrupt + DCD DMA2_Channel2_IRQHandler ; DMA2 Channel 2 Interrupt + DCD DMA2_Channel3_IRQHandler ; DMA2 Channel 3 Interrupt + DCD DMA2_Channel4_IRQHandler ; DMA2 Channel 4 Interrupt + DCD DMA2_Channel5_IRQHandler ; DMA2 Channel 5 Interrupt + DCD DMA2_Channel6_IRQHandler ; DMA2 Channel 6 Interrupt + DCD DMA2_Channel7_IRQHandler ; DMA2 Channel 7 Interrupt + DCD DMAMUX1_OVR_IRQHandler ; DMAMUX overrun Interrupt + +__Vectors_End + +__Vectors_Size EQU __Vectors_End - __Vectors + + AREA |.text|, CODE, READONLY + +; Reset handler +Reset_Handler PROC + EXPORT Reset_Handler [WEAK] + IMPORT SystemInit + IMPORT __main + + LDR R0, =SystemInit + BLX R0 + LDR R0, =__main + BX R0 + ENDP + +; Dummy Exception Handlers (infinite loops which can be modified) + +NMI_Handler PROC + EXPORT NMI_Handler [WEAK] + B . + ENDP +HardFault_Handler\ + PROC + EXPORT HardFault_Handler [WEAK] + B . + ENDP +MemManage_Handler\ + PROC + EXPORT MemManage_Handler [WEAK] + B . + ENDP +BusFault_Handler\ + PROC + EXPORT BusFault_Handler [WEAK] + B . + ENDP +UsageFault_Handler\ + PROC + EXPORT UsageFault_Handler [WEAK] + B . + ENDP +SVC_Handler PROC + EXPORT SVC_Handler [WEAK] + B . + ENDP +DebugMon_Handler\ + PROC + EXPORT DebugMon_Handler [WEAK] + B . + ENDP +PendSV_Handler PROC + EXPORT PendSV_Handler [WEAK] + B . + ENDP +SysTick_Handler PROC + EXPORT SysTick_Handler [WEAK] + B . + ENDP + +Default_Handler PROC + + EXPORT WWDG_IRQHandler [WEAK] + EXPORT PVD_PVM_IRQHandler [WEAK] + EXPORT TAMP_STAMP_LSECSS_SSRU_IRQHandler [WEAK] + EXPORT RTC_WKUP_IRQHandler [WEAK] + EXPORT FLASH_IRQHandler [WEAK] + EXPORT RCC_IRQHandler [WEAK] + EXPORT EXTI0_IRQHandler [WEAK] + EXPORT EXTI1_IRQHandler [WEAK] + EXPORT EXTI2_IRQHandler [WEAK] + EXPORT EXTI3_IRQHandler [WEAK] + EXPORT EXTI4_IRQHandler [WEAK] + EXPORT DMA1_Channel1_IRQHandler [WEAK] + EXPORT DMA1_Channel2_IRQHandler [WEAK] + EXPORT DMA1_Channel3_IRQHandler [WEAK] + EXPORT DMA1_Channel4_IRQHandler [WEAK] + EXPORT DMA1_Channel5_IRQHandler [WEAK] + EXPORT DMA1_Channel6_IRQHandler [WEAK] + EXPORT DMA1_Channel7_IRQHandler [WEAK] + EXPORT ADC1_IRQHandler [WEAK] + EXPORT DAC_IRQHandler [WEAK] + EXPORT COMP_IRQHandler [WEAK] + EXPORT EXTI9_5_IRQHandler [WEAK] + EXPORT TIM1_BRK_IRQHandler [WEAK] + EXPORT TIM1_UP_IRQHandler [WEAK] + EXPORT TIM1_TRG_COM_IRQHandler [WEAK] + EXPORT TIM1_CC_IRQHandler [WEAK] + EXPORT TIM2_IRQHandler [WEAK] + EXPORT TIM16_IRQHandler [WEAK] + EXPORT TIM17_IRQHandler [WEAK] + EXPORT I2C1_EV_IRQHandler [WEAK] + EXPORT I2C1_ER_IRQHandler [WEAK] + EXPORT I2C2_EV_IRQHandler [WEAK] + EXPORT I2C2_ER_IRQHandler [WEAK] + EXPORT SPI1_IRQHandler [WEAK] + EXPORT SPI2_IRQHandler [WEAK] + EXPORT USART1_IRQHandler [WEAK] + EXPORT USART2_IRQHandler [WEAK] + EXPORT LPUART1_IRQHandler [WEAK] + EXPORT LPTIM1_IRQHandler [WEAK] + EXPORT LPTIM2_IRQHandler [WEAK] + EXPORT EXTI15_10_IRQHandler [WEAK] + EXPORT RTC_Alarm_IRQHandler [WEAK] + EXPORT LPTIM3_IRQHandler [WEAK] + EXPORT SUBGHZSPI_IRQHandler [WEAK] + EXPORT HSEM_IRQHandler [WEAK] + EXPORT I2C3_EV_IRQHandler [WEAK] + EXPORT I2C3_ER_IRQHandler [WEAK] + EXPORT Radio_IRQHandler [WEAK] + EXPORT AES_IRQHandler [WEAK] + EXPORT RNG_IRQHandler [WEAK] + EXPORT PKA_IRQHandler [WEAK] + EXPORT DMA2_Channel1_IRQHandler [WEAK] + EXPORT DMA2_Channel2_IRQHandler [WEAK] + EXPORT DMA2_Channel3_IRQHandler [WEAK] + EXPORT DMA2_Channel4_IRQHandler [WEAK] + EXPORT DMA2_Channel5_IRQHandler [WEAK] + EXPORT DMA2_Channel6_IRQHandler [WEAK] + EXPORT DMA2_Channel7_IRQHandler [WEAK] + EXPORT DMAMUX1_OVR_IRQHandler [WEAK] + +WWDG_IRQHandler +PVD_PVM_IRQHandler +TAMP_STAMP_LSECSS_SSRU_IRQHandler +RTC_WKUP_IRQHandler +FLASH_IRQHandler +RCC_IRQHandler +EXTI0_IRQHandler +EXTI1_IRQHandler +EXTI2_IRQHandler +EXTI3_IRQHandler +EXTI4_IRQHandler +DMA1_Channel1_IRQHandler +DMA1_Channel2_IRQHandler +DMA1_Channel3_IRQHandler +DMA1_Channel4_IRQHandler +DMA1_Channel5_IRQHandler +DMA1_Channel6_IRQHandler +DMA1_Channel7_IRQHandler +ADC1_IRQHandler +DAC_IRQHandler +COMP_IRQHandler +EXTI9_5_IRQHandler +TIM1_BRK_IRQHandler +TIM1_UP_IRQHandler +TIM1_TRG_COM_IRQHandler +TIM1_CC_IRQHandler +TIM2_IRQHandler +TIM16_IRQHandler +TIM17_IRQHandler +I2C1_EV_IRQHandler +I2C1_ER_IRQHandler +I2C2_EV_IRQHandler +I2C2_ER_IRQHandler +SPI1_IRQHandler +SPI2_IRQHandler +USART1_IRQHandler +USART2_IRQHandler +LPUART1_IRQHandler +LPTIM1_IRQHandler +LPTIM2_IRQHandler +EXTI15_10_IRQHandler +RTC_Alarm_IRQHandler +LPTIM3_IRQHandler +SUBGHZSPI_IRQHandler +HSEM_IRQHandler +I2C3_EV_IRQHandler +I2C3_ER_IRQHandler +Radio_IRQHandler +AES_IRQHandler +RNG_IRQHandler +PKA_IRQHandler +DMA2_Channel1_IRQHandler +DMA2_Channel2_IRQHandler +DMA2_Channel3_IRQHandler +DMA2_Channel4_IRQHandler +DMA2_Channel5_IRQHandler +DMA2_Channel6_IRQHandler +DMA2_Channel7_IRQHandler +DMAMUX1_OVR_IRQHandler + + B . + + ENDP + + ALIGN + +;******************************************************************************* +; User Stack and Heap initialization +;******************************************************************************* + IF :DEF:__MICROLIB + + EXPORT __initial_sp + EXPORT __heap_base + EXPORT __heap_limit + + ELSE + + IMPORT __use_two_region_memory + EXPORT __user_initial_stackheap + +__user_initial_stackheap + + LDR R0, = Heap_Mem + LDR R1, =(Stack_Mem + Stack_Size) + LDR R2, = (Heap_Mem + Heap_Size) + LDR R3, = Stack_Mem + BX LR + + ALIGN + + ENDIF + + END + +;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****