added freeRTOS RuntimeStatistics
This commit is contained in:
42
.mxproject
42
.mxproject
File diff suppressed because one or more lines are too long
@@ -183,11 +183,12 @@ void CLSFirmwareUpdateTask_func(void *argument) {
|
|||||||
wait_for_start(&args);
|
wait_for_start(&args);
|
||||||
|
|
||||||
running(&args);
|
running(&args);
|
||||||
FirmwareUpdateDone done = {
|
|
||||||
.device_id = args.device,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
//FirmwareUpdateDone done = {
|
||||||
|
// .device_id = args.device,
|
||||||
|
//};
|
||||||
//UsbDataPacketSendMessage(UsbPackageType_FIRMWAREUPDATEDONE, &buffer,FirmwareUpdateDone_fields,&done);
|
//UsbDataPacketSendMessage(UsbPackageType_FIRMWAREUPDATEDONE, &buffer,FirmwareUpdateDone_fields,&done);
|
||||||
|
|
||||||
f_close(&fw_file);
|
f_close(&fw_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -148,9 +148,11 @@ FDCAN2.TxBuffersNbr=1
|
|||||||
FDCAN2.TxEventsNbr=2
|
FDCAN2.TxEventsNbr=2
|
||||||
FDCAN2.TxFifoQueueElmtsNbr=1
|
FDCAN2.TxFifoQueueElmtsNbr=1
|
||||||
FREERTOS.HEAP_NUMBER=5
|
FREERTOS.HEAP_NUMBER=5
|
||||||
FREERTOS.IPParameters=Tasks01,configTOTAL_HEAP_SIZE,configQUEUE_REGISTRY_SIZE,configUSE_NEWLIB_REENTRANT,HEAP_NUMBER
|
FREERTOS.IPParameters=Tasks01,configTOTAL_HEAP_SIZE,configQUEUE_REGISTRY_SIZE,configUSE_NEWLIB_REENTRANT,HEAP_NUMBER,configGENERATE_RUN_TIME_STATS,configRECORD_STACK_HIGH_ADDRESS
|
||||||
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
|
FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
|
||||||
|
FREERTOS.configGENERATE_RUN_TIME_STATS=1
|
||||||
FREERTOS.configQUEUE_REGISTRY_SIZE=16
|
FREERTOS.configQUEUE_REGISTRY_SIZE=16
|
||||||
|
FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1
|
||||||
FREERTOS.configTOTAL_HEAP_SIZE=0x6c00
|
FREERTOS.configTOTAL_HEAP_SIZE=0x6c00
|
||||||
FREERTOS.configUSE_NEWLIB_REENTRANT=1
|
FREERTOS.configUSE_NEWLIB_REENTRANT=1
|
||||||
File.Version=6
|
File.Version=6
|
||||||
@@ -169,6 +171,8 @@ I2C2.I2C_Speed_Mode=I2C_Standard
|
|||||||
I2C2.IPParameters=Timing,I2C_Speed_Mode,Analog_Filter,I2C_Rise_Time,I2C_Fall_Time
|
I2C2.IPParameters=Timing,I2C_Speed_Mode,Analog_Filter,I2C_Rise_Time,I2C_Fall_Time
|
||||||
I2C2.Timing=0x00D0D8FF
|
I2C2.Timing=0x00D0D8FF
|
||||||
KeepUserPlacement=false
|
KeepUserPlacement=false
|
||||||
|
LPUART1.BaudRate=2000000
|
||||||
|
LPUART1.IPParameters=BaudRate
|
||||||
Mcu.CPN=STM32H723VGT6
|
Mcu.CPN=STM32H723VGT6
|
||||||
Mcu.Family=STM32H7
|
Mcu.Family=STM32H7
|
||||||
Mcu.IP0=ADC1
|
Mcu.IP0=ADC1
|
||||||
@@ -182,12 +186,13 @@ Mcu.IP15=RNG
|
|||||||
Mcu.IP16=RTC
|
Mcu.IP16=RTC
|
||||||
Mcu.IP17=SDMMC1
|
Mcu.IP17=SDMMC1
|
||||||
Mcu.IP18=SYS
|
Mcu.IP18=SYS
|
||||||
Mcu.IP19=USART1
|
Mcu.IP19=TIM2
|
||||||
Mcu.IP2=CRC
|
Mcu.IP2=CRC
|
||||||
Mcu.IP20=USART3
|
Mcu.IP20=USART1
|
||||||
Mcu.IP21=USB_DEVICE
|
Mcu.IP21=USART3
|
||||||
Mcu.IP22=USB_OTG_HS
|
Mcu.IP22=USB_DEVICE
|
||||||
Mcu.IP23=VREFBUF
|
Mcu.IP23=USB_OTG_HS
|
||||||
|
Mcu.IP24=VREFBUF
|
||||||
Mcu.IP3=DEBUG
|
Mcu.IP3=DEBUG
|
||||||
Mcu.IP4=DMA
|
Mcu.IP4=DMA
|
||||||
Mcu.IP5=FATFS
|
Mcu.IP5=FATFS
|
||||||
@@ -195,7 +200,7 @@ Mcu.IP6=FDCAN1
|
|||||||
Mcu.IP7=FDCAN2
|
Mcu.IP7=FDCAN2
|
||||||
Mcu.IP8=FREERTOS
|
Mcu.IP8=FREERTOS
|
||||||
Mcu.IP9=I2C1
|
Mcu.IP9=I2C1
|
||||||
Mcu.IPNb=24
|
Mcu.IPNb=25
|
||||||
Mcu.Name=STM32H723VGTx
|
Mcu.Name=STM32H723VGTx
|
||||||
Mcu.Package=LQFP100
|
Mcu.Package=LQFP100
|
||||||
Mcu.Pin0=PE2
|
Mcu.Pin0=PE2
|
||||||
@@ -256,12 +261,13 @@ Mcu.Pin58=VP_RTC_VS_RTC_Calendar
|
|||||||
Mcu.Pin59=VP_RTC_VS_RTC_WakeUp_intern
|
Mcu.Pin59=VP_RTC_VS_RTC_WakeUp_intern
|
||||||
Mcu.Pin6=PA1
|
Mcu.Pin6=PA1
|
||||||
Mcu.Pin60=VP_SYS_VS_tim1
|
Mcu.Pin60=VP_SYS_VS_tim1
|
||||||
Mcu.Pin61=VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
Mcu.Pin61=VP_TIM2_VS_ClockSourceINT
|
||||||
Mcu.Pin62=VP_VREFBUF_V_VREFBUF
|
Mcu.Pin62=VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
||||||
|
Mcu.Pin63=VP_VREFBUF_V_VREFBUF
|
||||||
Mcu.Pin7=PA2
|
Mcu.Pin7=PA2
|
||||||
Mcu.Pin8=PA3
|
Mcu.Pin8=PA3
|
||||||
Mcu.Pin9=PA5
|
Mcu.Pin9=PA5
|
||||||
Mcu.PinsNb=63
|
Mcu.PinsNb=64
|
||||||
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-EEPRMA1.4.2.0
|
Mcu.ThirdParty0=STMicroelectronics.X-CUBE-EEPRMA1.4.2.0
|
||||||
Mcu.ThirdPartyNb=1
|
Mcu.ThirdPartyNb=1
|
||||||
Mcu.UserConstants=
|
Mcu.UserConstants=
|
||||||
@@ -296,6 +302,7 @@ NVIC.SavedSvcallIrqHandlerGenerated=true
|
|||||||
NVIC.SavedSystickIrqHandlerGenerated=true
|
NVIC.SavedSystickIrqHandlerGenerated=true
|
||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
|
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:false\:true\:false\:true\:false
|
||||||
NVIC.TIM1_UP_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
NVIC.TIM1_UP_IRQn=true\:15\:0\:false\:false\:true\:false\:false\:true\:true
|
||||||
|
NVIC.TIM2_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
NVIC.TimeBase=TIM1_UP_IRQn
|
NVIC.TimeBase=TIM1_UP_IRQn
|
||||||
NVIC.TimeBaseIP=TIM1
|
NVIC.TimeBaseIP=TIM1
|
||||||
NVIC.USART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
NVIC.USART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||||
@@ -612,6 +619,9 @@ SH.GPXTI3.0=GPIO_EXTI3
|
|||||||
SH.GPXTI3.ConfNb=1
|
SH.GPXTI3.ConfNb=1
|
||||||
STMicroelectronics.X-CUBE-EEPRMA1.4.2.0.BoardOoPartJjEEPROM_Checked=false
|
STMicroelectronics.X-CUBE-EEPRMA1.4.2.0.BoardOoPartJjEEPROM_Checked=false
|
||||||
STMicroelectronics.X-CUBE-EEPRMA1.4.2.0_SwParameter=EEPROMCcBoardOoPartJjM24JjM24XX\:true;
|
STMicroelectronics.X-CUBE-EEPRMA1.4.2.0_SwParameter=EEPROMCcBoardOoPartJjM24JjM24XX\:true;
|
||||||
|
TIM2.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
|
||||||
|
TIM2.IPParameters=AutoReloadPreload,Prescaler
|
||||||
|
TIM2.Prescaler=275
|
||||||
USART1.BaudRate=1000000
|
USART1.BaudRate=1000000
|
||||||
USART1.FIFOMode=FIFOMODE_ENABLE
|
USART1.FIFOMode=FIFOMODE_ENABLE
|
||||||
USART1.IPParameters=VirtualMode-Asynchronous,TXFIFOThreshold,RXFIFOThreshold,FIFOMode,BaudRate
|
USART1.IPParameters=VirtualMode-Asynchronous,TXFIFOThreshold,RXFIFOThreshold,FIFOMode,BaudRate
|
||||||
@@ -653,6 +663,8 @@ VP_RTC_VS_RTC_WakeUp_intern.Mode=WakeUp
|
|||||||
VP_RTC_VS_RTC_WakeUp_intern.Signal=RTC_VS_RTC_WakeUp_intern
|
VP_RTC_VS_RTC_WakeUp_intern.Signal=RTC_VS_RTC_WakeUp_intern
|
||||||
VP_SYS_VS_tim1.Mode=TIM1
|
VP_SYS_VS_tim1.Mode=TIM1
|
||||||
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
|
VP_SYS_VS_tim1.Signal=SYS_VS_tim1
|
||||||
|
VP_TIM2_VS_ClockSourceINT.Mode=Internal
|
||||||
|
VP_TIM2_VS_ClockSourceINT.Signal=TIM2_VS_ClockSourceINT
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Mode=CDC_HS
|
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Mode=CDC_HS
|
||||||
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
VP_USB_DEVICE_VS_USB_DEVICE_CDC_HS.Signal=USB_DEVICE_VS_USB_DEVICE_CDC_HS
|
||||||
VP_VREFBUF_V_VREFBUF.Mode=ExternalMode
|
VP_VREFBUF_V_VREFBUF.Mode=ExternalMode
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ add_link_options(
|
|||||||
|
|
||||||
# Add project symbols (macros)
|
# Add project symbols (macros)
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
|
ULOG_ENABLED
|
||||||
${symbols_SYMB}
|
${symbols_SYMB}
|
||||||
${symbols_c_SYMB}
|
${symbols_c_SYMB}
|
||||||
${symbols_cxx_SYMB}
|
${symbols_cxx_SYMB}
|
||||||
@@ -131,7 +132,7 @@ include_directories(${PROJECT_BINARY_DIR})
|
|||||||
add_executable(${CMAKE_PROJECT_NAME})
|
add_executable(${CMAKE_PROJECT_NAME})
|
||||||
target_sources(${CMAKE_PROJECT_NAME} PUBLIC ${sources_SRCS})
|
target_sources(${CMAKE_PROJECT_NAME} PUBLIC ${sources_SRCS})
|
||||||
|
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Tasks CLS CLS_BSP)
|
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC Tasks CLS CLS_BSP ulog)
|
||||||
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC PROTOS)
|
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC PROTOS)
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC uart_driver)
|
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC uart_driver)
|
||||||
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC lwrb)
|
#target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC lwrb)
|
||||||
|
|||||||
@@ -51,6 +51,10 @@
|
|||||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
extern uint32_t SystemCoreClock;
|
extern uint32_t SystemCoreClock;
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
extern void configureTimerForRunTimeStats(void);
|
||||||
|
extern unsigned long getRunTimeCounterValue(void);
|
||||||
|
/* USER CODE END 0 */
|
||||||
#endif
|
#endif
|
||||||
#ifndef CMSIS_device_header
|
#ifndef CMSIS_device_header
|
||||||
#define CMSIS_device_header "stm32h7xx.h"
|
#define CMSIS_device_header "stm32h7xx.h"
|
||||||
@@ -70,6 +74,7 @@
|
|||||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||||
#define configTOTAL_HEAP_SIZE ((size_t)0x6c00)
|
#define configTOTAL_HEAP_SIZE ((size_t)0x6c00)
|
||||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||||
|
#define configGENERATE_RUN_TIME_STATS 1
|
||||||
#define configUSE_TRACE_FACILITY 1
|
#define configUSE_TRACE_FACILITY 1
|
||||||
#define configUSE_16_BIT_TICKS 0
|
#define configUSE_16_BIT_TICKS 0
|
||||||
#define configUSE_MUTEXES 1
|
#define configUSE_MUTEXES 1
|
||||||
@@ -77,6 +82,7 @@
|
|||||||
#define configUSE_RECURSIVE_MUTEXES 1
|
#define configUSE_RECURSIVE_MUTEXES 1
|
||||||
#define configUSE_COUNTING_SEMAPHORES 1
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||||
|
#define configRECORD_STACK_HIGH_ADDRESS 1
|
||||||
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
||||||
/* Defaults to size_t for backward compatibility, but can be changed
|
/* Defaults to size_t for backward compatibility, but can be changed
|
||||||
if lengths will always be less than the number of bytes in a size_t. */
|
if lengths will always be less than the number of bytes in a size_t. */
|
||||||
@@ -166,7 +172,11 @@ standard names. */
|
|||||||
|
|
||||||
#define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 0
|
#define USE_CUSTOM_SYSTICK_HANDLER_IMPLEMENTATION 0
|
||||||
|
|
||||||
#define portDONT_DISCARD __attribute__((used))
|
/* USER CODE BEGIN 2 */
|
||||||
|
/* Definitions needed when configGENERATE_RUN_TIME_STATS is on */
|
||||||
|
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS configureTimerForRunTimeStats
|
||||||
|
#define portGET_RUN_TIME_COUNTER_VALUE getRunTimeCounterValue
|
||||||
|
/* USER CODE END 2 */
|
||||||
|
|
||||||
/* USER CODE BEGIN Defines */
|
/* USER CODE BEGIN Defines */
|
||||||
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
/* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ void FDCAN2_IT0_IRQHandler(void);
|
|||||||
void FDCAN1_IT1_IRQHandler(void);
|
void FDCAN1_IT1_IRQHandler(void);
|
||||||
void FDCAN2_IT1_IRQHandler(void);
|
void FDCAN2_IT1_IRQHandler(void);
|
||||||
void TIM1_UP_IRQHandler(void);
|
void TIM1_UP_IRQHandler(void);
|
||||||
|
void TIM2_IRQHandler(void);
|
||||||
void USART1_IRQHandler(void);
|
void USART1_IRQHandler(void);
|
||||||
void USART3_IRQHandler(void);
|
void USART3_IRQHandler(void);
|
||||||
void SDMMC1_IRQHandler(void);
|
void SDMMC1_IRQHandler(void);
|
||||||
|
|||||||
52
Core/Inc/tim.h
Normal file
52
Core/Inc/tim.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.h
|
||||||
|
* @brief This file contains all the function prototypes for
|
||||||
|
* the tim.c file
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||||
|
#ifndef __TIM_H__
|
||||||
|
#define __TIM_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Includes */
|
||||||
|
|
||||||
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
|
extern TIM_HandleTypeDef htim2;
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Private defines */
|
||||||
|
|
||||||
|
/* USER CODE END Private defines */
|
||||||
|
|
||||||
|
void MX_TIM2_Init(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN Prototypes */
|
||||||
|
|
||||||
|
/* USER CODE END Prototypes */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __TIM_H__ */
|
||||||
|
|
||||||
@@ -22,12 +22,16 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
|
|
||||||
/* Private includes ----------------------------------------------------------*/
|
/* Private includes ----------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN Includes */
|
/* USER CODE BEGIN Includes */
|
||||||
#include "UsbDataHandler.h"
|
#include "UsbDataHandler.h"
|
||||||
#include "CanDataTask.h"
|
#include "CanDataTask.h"
|
||||||
#include "CLS.h"
|
#include "CLS.h"
|
||||||
#include "fatfs.h"
|
#include "fatfs.h"
|
||||||
|
#include "ulog.h"
|
||||||
|
#include "stdio.h"
|
||||||
|
#include "tim.h"
|
||||||
/* USER CODE END Includes */
|
/* USER CODE END Includes */
|
||||||
|
|
||||||
/* Private typedef -----------------------------------------------------------*/
|
/* Private typedef -----------------------------------------------------------*/
|
||||||
@@ -67,6 +71,23 @@ void StartDefaultTask(void *argument);
|
|||||||
extern void MX_USB_DEVICE_Init(void);
|
extern void MX_USB_DEVICE_Init(void);
|
||||||
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
|
||||||
|
|
||||||
|
/* Hook prototypes */
|
||||||
|
void configureTimerForRunTimeStats(void);
|
||||||
|
unsigned long getRunTimeCounterValue(void);
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
/* Functions needed when configGENERATE_RUN_TIME_STATS is on */
|
||||||
|
__weak void configureTimerForRunTimeStats(void)
|
||||||
|
{
|
||||||
|
HAL_TIM_Base_Start(&htim2);
|
||||||
|
}
|
||||||
|
|
||||||
|
__weak unsigned long getRunTimeCounterValue(void)
|
||||||
|
{
|
||||||
|
return __HAL_TIM_GetCounter(&htim2);
|
||||||
|
}
|
||||||
|
/* USER CODE END 1 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FreeRTOS initialization
|
* @brief FreeRTOS initialization
|
||||||
* @param None
|
* @param None
|
||||||
@@ -98,8 +119,11 @@ void MX_FREERTOS_Init(void) {
|
|||||||
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
|
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
|
||||||
|
|
||||||
/* USER CODE BEGIN RTOS_THREADS */
|
/* USER CODE BEGIN RTOS_THREADS */
|
||||||
|
ULOG_INFO("Setup UsbDataHandler");
|
||||||
UsbDataHandler_Start();
|
UsbDataHandler_Start();
|
||||||
|
ULOG_INFO("Setup CanDataTask");
|
||||||
CanDataTask_start();
|
CanDataTask_start();
|
||||||
|
ULOG_INFO("Setup CLS");
|
||||||
CLS_Init();
|
CLS_Init();
|
||||||
/* USER CODE END RTOS_THREADS */
|
/* USER CODE END RTOS_THREADS */
|
||||||
|
|
||||||
@@ -119,6 +143,7 @@ void MX_FREERTOS_Init(void) {
|
|||||||
void StartDefaultTask(void *argument)
|
void StartDefaultTask(void *argument)
|
||||||
{
|
{
|
||||||
/* init code for USB_DEVICE */
|
/* init code for USB_DEVICE */
|
||||||
|
MX_USB_DEVICE_Init();
|
||||||
/* USER CODE BEGIN StartDefaultTask */
|
/* USER CODE BEGIN StartDefaultTask */
|
||||||
|
|
||||||
|
|
||||||
@@ -136,6 +161,12 @@ void StartDefaultTask(void *argument)
|
|||||||
retSD = f_write(&SDFile,&counter,sizeof(counter),&size);
|
retSD = f_write(&SDFile,&counter,sizeof(counter),&size);
|
||||||
retSD = f_close(&SDFile);
|
retSD = f_close(&SDFile);
|
||||||
|
|
||||||
|
{
|
||||||
|
char output[64];
|
||||||
|
snprintf(output,64,"Read SD Bootcount %lld" ,counter);
|
||||||
|
ULOG_INFO(output);
|
||||||
|
}
|
||||||
|
|
||||||
/* Infinite loop */
|
/* Infinite loop */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ extern FDCAN_HandleTypeDef hfdcan1;
|
|||||||
extern FDCAN_HandleTypeDef hfdcan2;
|
extern FDCAN_HandleTypeDef hfdcan2;
|
||||||
extern RTC_HandleTypeDef hrtc;
|
extern RTC_HandleTypeDef hrtc;
|
||||||
extern SD_HandleTypeDef hsd1;
|
extern SD_HandleTypeDef hsd1;
|
||||||
|
extern TIM_HandleTypeDef htim2;
|
||||||
extern TIM_HandleTypeDef htim1;
|
extern TIM_HandleTypeDef htim1;
|
||||||
|
|
||||||
/* USER CODE BEGIN EV */
|
/* USER CODE BEGIN EV */
|
||||||
@@ -318,6 +319,20 @@ void TIM1_UP_IRQHandler(void)
|
|||||||
/* USER CODE END TIM1_UP_IRQn 1 */
|
/* USER CODE END TIM1_UP_IRQn 1 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function handles TIM2 global interrupt.
|
||||||
|
*/
|
||||||
|
void TIM2_IRQHandler(void)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_IRQn 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_IRQn 0 */
|
||||||
|
HAL_TIM_IRQHandler(&htim2);
|
||||||
|
/* USER CODE BEGIN TIM2_IRQn 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_IRQn 1 */
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function handles USART1 global interrupt.
|
* @brief This function handles USART1 global interrupt.
|
||||||
*/
|
*/
|
||||||
|
|||||||
111
Core/Src/tim.c
Normal file
111
Core/Src/tim.c
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/* USER CODE BEGIN Header */
|
||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
* @file tim.c
|
||||||
|
* @brief This file provides code for the configuration
|
||||||
|
* of the TIM instances.
|
||||||
|
******************************************************************************
|
||||||
|
* @attention
|
||||||
|
*
|
||||||
|
* Copyright (c) 2024 STMicroelectronics.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under terms that can be found in the LICENSE file
|
||||||
|
* in the root directory of this software component.
|
||||||
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||||
|
*
|
||||||
|
******************************************************************************
|
||||||
|
*/
|
||||||
|
/* USER CODE END Header */
|
||||||
|
/* Includes ------------------------------------------------------------------*/
|
||||||
|
#include "tim.h"
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
|
/* USER CODE END 0 */
|
||||||
|
|
||||||
|
TIM_HandleTypeDef htim2;
|
||||||
|
|
||||||
|
/* TIM2 init function */
|
||||||
|
void MX_TIM2_Init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM2_Init 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 0 */
|
||||||
|
|
||||||
|
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||||
|
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||||
|
|
||||||
|
/* USER CODE BEGIN TIM2_Init 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 1 */
|
||||||
|
htim2.Instance = TIM2;
|
||||||
|
htim2.Init.Prescaler = 275;
|
||||||
|
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||||
|
htim2.Init.Period = 4294967295;
|
||||||
|
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||||
|
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||||
|
if (HAL_TIM_Base_Init(&htim2) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||||
|
if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||||
|
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||||
|
if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
|
||||||
|
{
|
||||||
|
Error_Handler();
|
||||||
|
}
|
||||||
|
/* USER CODE BEGIN TIM2_Init 2 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_Init 2 */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(tim_baseHandle->Instance==TIM2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_MspInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspInit 0 */
|
||||||
|
/* TIM2 clock enable */
|
||||||
|
__HAL_RCC_TIM2_CLK_ENABLE();
|
||||||
|
|
||||||
|
/* TIM2 interrupt Init */
|
||||||
|
HAL_NVIC_SetPriority(TIM2_IRQn, 5, 0);
|
||||||
|
HAL_NVIC_EnableIRQ(TIM2_IRQn);
|
||||||
|
/* USER CODE BEGIN TIM2_MspInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(tim_baseHandle->Instance==TIM2)
|
||||||
|
{
|
||||||
|
/* USER CODE BEGIN TIM2_MspDeInit 0 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspDeInit 0 */
|
||||||
|
/* Peripheral clock disable */
|
||||||
|
__HAL_RCC_TIM2_CLK_DISABLE();
|
||||||
|
|
||||||
|
/* TIM2 interrupt Deinit */
|
||||||
|
HAL_NVIC_DisableIRQ(TIM2_IRQn);
|
||||||
|
/* USER CODE BEGIN TIM2_MspDeInit 1 */
|
||||||
|
|
||||||
|
/* USER CODE END TIM2_MspDeInit 1 */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* USER CODE BEGIN 1 */
|
||||||
|
|
||||||
|
/* USER CODE END 1 */
|
||||||
@@ -39,7 +39,7 @@ void MX_LPUART1_UART_Init(void)
|
|||||||
|
|
||||||
/* USER CODE END LPUART1_Init 1 */
|
/* USER CODE END LPUART1_Init 1 */
|
||||||
hlpuart1.Instance = LPUART1;
|
hlpuart1.Instance = LPUART1;
|
||||||
hlpuart1.Init.BaudRate = 209700;
|
hlpuart1.Init.BaudRate = 2000000;
|
||||||
hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
|
hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
|
||||||
hlpuart1.Init.StopBits = UART_STOPBITS_1;
|
hlpuart1.Init.StopBits = UART_STOPBITS_1;
|
||||||
hlpuart1.Init.Parity = UART_PARITY_NONE;
|
hlpuart1.Init.Parity = UART_PARITY_NONE;
|
||||||
|
|||||||
5209
Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_tim.h
Normal file
5209
Drivers/STM32H7xx_HAL_Driver/Inc/stm32h7xx_ll_tim.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -25,6 +25,7 @@ set(sources_SRCS ${sources_SRCS}
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/fdcan.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/fdcan.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/gpio.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/gpio.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/i2c.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/i2c.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/tim.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/rng.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/rng.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/rtc.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/rtc.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/sdmmc.c
|
${CMAKE_CURRENT_SOURCE_DIR}/Core/Src/sdmmc.c
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
add_subdirectory(lwrb)
|
add_subdirectory(lwrb)
|
||||||
add_subdirectory(uart_driver)
|
add_subdirectory(uart_driver)
|
||||||
add_subdirectory(nanopb)
|
add_subdirectory(nanopb)
|
||||||
|
add_subdirectory(ulog)
|
||||||
Reference in New Issue
Block a user