From 01279df4bd82e1f35599e4ca59a18e5756fda212 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 26 Sep 2022 16:43:28 +0200 Subject: freertos blink demo working --- stm32f091/FreeRTOSConfig.h | 12 +++++++++--- stm32f091/main.c | 7 ++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/stm32f091/FreeRTOSConfig.h b/stm32f091/FreeRTOSConfig.h index 17c0ce7..b1a692a 100644 --- a/stm32f091/FreeRTOSConfig.h +++ b/stm32f091/FreeRTOSConfig.h @@ -50,7 +50,7 @@ #if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__) #include extern uint32_t SystemCoreClock; - void xPortSysTickHandler(void); + // void xPortSysTickHandler(void); #endif #define configUSE_PREEMPTION 1 #define configSUPPORT_STATIC_ALLOCATION 1 @@ -63,9 +63,9 @@ #define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configTOTAL_HEAP_SIZE ((size_t)3072) #define configMAX_TASK_NAME_LEN ( 16 ) +#define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 #define configUSE_MUTEXES 1 -#define configUSE_TRACE_FACILITY 1 #define configQUEUE_REGISTRY_SIZE 8 #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_COUNTING_SEMAPHORES 1 @@ -99,6 +99,12 @@ to exclude the API function. */ #define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_eTaskGetState 1 +/* + * The CMSIS-RTOS V2 FreeRTOS wrapper is dependent on the heap implementation used + * by the application thus the correct define need to be enabled below + */ +#define USE_FreeRTOS_HEAP_4 + /* Normal assert() semantics without relying on the provision of an assert.h header file. */ /* USER CODE BEGIN 1 */ @@ -113,7 +119,7 @@ standard names. */ /* IMPORTANT: This define is commented when used with STM32Cube firmware, when the timebase source is SysTick, to prevent overwriting SysTick_Handler defined within STM32Cube HAL */ -/* #define xPortSysTickHandler SysTick_Handler */ +#define xPortSysTickHandler SysTick_Handler /* USER CODE BEGIN Defines */ /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ diff --git a/stm32f091/main.c b/stm32f091/main.c index cc815c9..848bfac 100644 --- a/stm32f091/main.c +++ b/stm32f091/main.c @@ -6,7 +6,7 @@ #define PORT GPIOA #define PIN 5 -void task_1(void *pv_parameters) { +void task_1() { uint8_t led = 1; while (1) { @@ -14,9 +14,7 @@ void task_1(void *pv_parameters) { PORT->ODR |= (led << PIN); led ^= 1; - vTaskDelay(200 / portTICK_RATE_MS); - // for (unsigned int gert = 0; gert < 100000; gert++) - // asm("nop"); + vTaskDelay(1000 / portTICK_RATE_MS); } } @@ -26,7 +24,6 @@ int main() { PORT->MODER &= ~(0b11 << (PIN * 2)); PORT->MODER |= (0b01 << (PIN * 2)); - // task_1(0); xTaskCreate(task_1, "task1", 128, NULL, 1, NULL); vTaskStartScheduler(); } -- cgit v1.2.3