added freeRTOS RuntimeStatistics
This commit is contained in:
@@ -22,12 +22,16 @@
|
||||
#include "task.h"
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "UsbDataHandler.h"
|
||||
#include "CanDataTask.h"
|
||||
#include "CLS.h"
|
||||
#include "fatfs.h"
|
||||
#include "ulog.h"
|
||||
#include "stdio.h"
|
||||
#include "tim.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -67,6 +71,23 @@ void StartDefaultTask(void *argument);
|
||||
extern void MX_USB_DEVICE_Init(void);
|
||||
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
|
||||
* @param None
|
||||
@@ -98,8 +119,11 @@ void MX_FREERTOS_Init(void) {
|
||||
defaultTaskHandle = osThreadNew(StartDefaultTask, NULL, &defaultTask_attributes);
|
||||
|
||||
/* USER CODE BEGIN RTOS_THREADS */
|
||||
ULOG_INFO("Setup UsbDataHandler");
|
||||
UsbDataHandler_Start();
|
||||
ULOG_INFO("Setup CanDataTask");
|
||||
CanDataTask_start();
|
||||
ULOG_INFO("Setup CLS");
|
||||
CLS_Init();
|
||||
/* USER CODE END RTOS_THREADS */
|
||||
|
||||
@@ -119,7 +143,8 @@ void MX_FREERTOS_Init(void) {
|
||||
void StartDefaultTask(void *argument)
|
||||
{
|
||||
/* init code for USB_DEVICE */
|
||||
/* USER CODE BEGIN StartDefaultTask */
|
||||
MX_USB_DEVICE_Init();
|
||||
/* USER CODE BEGIN StartDefaultTask */
|
||||
|
||||
|
||||
retSD = f_mount(&SDFatFS,SDPath,0);
|
||||
@@ -136,6 +161,12 @@ void StartDefaultTask(void *argument)
|
||||
retSD = f_write(&SDFile,&counter,sizeof(counter),&size);
|
||||
retSD = f_close(&SDFile);
|
||||
|
||||
{
|
||||
char output[64];
|
||||
snprintf(output,64,"Read SD Bootcount %lld" ,counter);
|
||||
ULOG_INFO(output);
|
||||
}
|
||||
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user