From 2fe25879f36f5d6df103420cf8e120259e5bccc5 Mon Sep 17 00:00:00 2001 From: "Ivan I. Ovchinnikov" Date: Thu, 23 Jul 2026 21:53:22 +0300 Subject: [PATCH] base blink migrated, code generated (tasks added in MX). tuned --- Core/Inc/FreeRTOSConfig.h | 7 ++----- Core/Inc/stm32f7xx_hal_conf.h | 2 +- Core/Src/freertos.c | 6 +++--- Core/Src/main.c | 7 ++----- Core/Src/stm32f7xx_hal_msp.c | 1 - Core/Src/stm32f7xx_hal_timebase_tim.c | 1 + Core/Src/usart.c | 1 + stm_os_sampler.ioc | 5 +++-- 8 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Core/Inc/FreeRTOSConfig.h b/Core/Inc/FreeRTOSConfig.h index f42ecf6..66b4c70 100755 --- a/Core/Inc/FreeRTOSConfig.h +++ b/Core/Inc/FreeRTOSConfig.h @@ -63,7 +63,7 @@ #define configCPU_CLOCK_HZ ( SystemCoreClock ) #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES ( 56 ) -#define configMINIMAL_STACK_SIZE ((uint16_t)128) +#define configMINIMAL_STACK_SIZE ((uint16_t)256) #define configTOTAL_HEAP_SIZE ((size_t)15360) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 1 @@ -87,10 +87,7 @@ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( 2 ) #define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH 256 - -/* The following flag must be enabled only when using newlib */ -#define configUSE_NEWLIB_REENTRANT 1 +#define configTIMER_TASK_STACK_DEPTH 512 /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ diff --git a/Core/Inc/stm32f7xx_hal_conf.h b/Core/Inc/stm32f7xx_hal_conf.h index b3f5cce..44e5f19 100755 --- a/Core/Inc/stm32f7xx_hal_conf.h +++ b/Core/Inc/stm32f7xx_hal_conf.h @@ -52,6 +52,7 @@ /* #define HAL_SRAM_MODULE_ENABLED */ /* #define HAL_SDRAM_MODULE_ENABLED */ /* #define HAL_HASH_MODULE_ENABLED */ +/* #define HAL_I2C_MODULE_ENABLED */ /* #define HAL_I2S_MODULE_ENABLED */ /* #define HAL_IWDG_MODULE_ENABLED */ /* #define HAL_LPTIM_MODULE_ENABLED */ @@ -84,7 +85,6 @@ #define HAL_RCC_MODULE_ENABLED #define HAL_FLASH_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED -#define HAL_I2C_MODULE_ENABLED #define HAL_CORTEX_MODULE_ENABLED /* ########################## HSE/HSI Values adaptation ##################### */ diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index 7e643c2..791d1fa 100755 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -78,21 +78,21 @@ uint16_t rxIndex = 0; // Индекс в буфере приёма osThreadId_t defaultTaskHandle; const osThreadAttr_t defaultTask_attributes = { .name = "defaultTask", - .stack_size = 128 * 4, + .stack_size = 256 * 4, .priority = (osPriority_t) osPriorityNormal, }; /* Definitions for myLed */ osThreadId_t myLedHandle; const osThreadAttr_t myLed_attributes = { .name = "myLed", - .stack_size = 128 * 4, + .stack_size = 256 * 4, .priority = (osPriority_t) osPriorityNormal, }; /* Definitions for myUART */ osThreadId_t myUARTHandle; const osThreadAttr_t myUART_attributes = { .name = "myUART", - .stack_size = 128 * 4, + .stack_size = 256 * 4, .priority = (osPriority_t) osPriorityNormal, }; diff --git a/Core/Src/main.c b/Core/Src/main.c index 2e9776c..9599691 100755 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -98,9 +98,7 @@ int main(void) /* USER CODE END 2 */ /* Init scheduler */ - osKernelInitialize(); - - /* Call init function for freertos objects (in cmsis_os2.c) */ + osKernelInitialize(); /* Call init function for freertos objects (in cmsis_os2.c) */ MX_FREERTOS_Init(); /* Start scheduler */ @@ -245,8 +243,7 @@ void Error_Handler(void) } /* USER CODE END Error_Handler_Debug */ } - -#ifdef USE_FULL_ASSERT +#ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred. diff --git a/Core/Src/stm32f7xx_hal_msp.c b/Core/Src/stm32f7xx_hal_msp.c index 42c8a3a..09d8c18 100755 --- a/Core/Src/stm32f7xx_hal_msp.c +++ b/Core/Src/stm32f7xx_hal_msp.c @@ -17,7 +17,6 @@ ****************************************************************************** */ /* USER CODE END Header */ - /* Includes ------------------------------------------------------------------*/ #include "main.h" /* USER CODE BEGIN Includes */ diff --git a/Core/Src/stm32f7xx_hal_timebase_tim.c b/Core/Src/stm32f7xx_hal_timebase_tim.c index 7d72d45..051f448 100755 --- a/Core/Src/stm32f7xx_hal_timebase_tim.c +++ b/Core/Src/stm32f7xx_hal_timebase_tim.c @@ -78,6 +78,7 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) status = HAL_TIM_Base_Init(&htim1); if (status == HAL_OK) { + /* Start the TIM time Base generation in interrupt mode */ status = HAL_TIM_Base_Start_IT(&htim1); if (status == HAL_OK) diff --git a/Core/Src/usart.c b/Core/Src/usart.c index 1e129c5..bf281ca 100755 --- a/Core/Src/usart.c +++ b/Core/Src/usart.c @@ -140,3 +140,4 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle) /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ + diff --git a/stm_os_sampler.ioc b/stm_os_sampler.ioc index 7cd23db..3aac132 100644 --- a/stm_os_sampler.ioc +++ b/stm_os_sampler.ioc @@ -4,8 +4,9 @@ CAD.pinconfig= CAD.provider= CORTEX_M7.IPParameters=default_mode_Activation CORTEX_M7.default_mode_Activation=1 -FREERTOS.IPParameters=Tasks01 -FREERTOS.Tasks01=defaultTask,24,256,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL +FREERTOS.FootprintOK=true +FREERTOS.IPParameters=Tasks01,FootprintOK +FREERTOS.Tasks01=defaultTask,24,256,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;myLed,24,256,StartLedTask,Default,NULL,Dynamic,NULL,NULL;myUART,24,256,StartUARTTask,Default,NULL,Dynamic,NULL,NULL File.Version=6 GPIO.groupedBy=Group By Peripherals KeepUserPlacement=false