
In this very first example, vTask1() simply toggles the LED every 300ms, while vTask2() outputs a console message every 1s. If you get there, there's something wrong.Īnd finally, the implementation of each task. The while(1) loop is placed here to catch abnormal behavior in the debugger.
#Atollic truestudio printf tutorail code#
Any code below this function call will never execute if everything goes well. It starts the OS scheduler that manages tasks execution. In a common FreeRTOS application, the vTaskStartScheduler() function never returns. XTaskCreate(vTask2, "Task_2", 256, NULL, 2, NULL) XTaskCreate(vTask1, "Task_1", 256, NULL, 1, NULL)

We will take this opportunity to regroup all the headers in main.h as follows: /* Let-us first include FreeRTOS headers into the project. Output sent to: nucleo_64_F072_FreeRTOS.list Hopefully, you'll get a clean build report with no error or warnings: Generate build reports. Save all the project files, clean the project and rebuild all. * This function handles PendSVC exception. * This function handles SVCall exception. #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 7 * 1024 ) )įinally, open stm32f0xx_it.c and comment the 3 interrupt handlers implementations, as FreeRTOS needs its own definition of these: #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configCPU_CLOCK_HZ ( 48000000UL ) * FreeRTOS API DOCUMENTATION AVAILABLE ON THE WEB SITE. * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE * These definitions should be adjusted for your particular hardware and Second, tune the FreeRTOS configuration as follows: /*. Repair any error or warning, what we want is a perfectly clean base for further FreeRTOS integration:
#Atollic truestudio printf tutorail update#
Update SystemCoreClock global variableĬlean project from any previous build then rebuild all. *- Use PA8 as MCO output at 48/16 = 3MHz -*/ } while ((SW_Status != RCC_CFGR_SWS_PLL) & (timeout > 0)) SW_Status = (RCC->CFGR & RCC_CFGR_SWS_Msk) Wait until PLL becomes main switch input Select the main PLL as system clock source

* - Switching to PLL at 48MHz Now! Fasten your seat belt! -*/ * - Until this point, MCU was still clocked by HSI at 8MHz -*/ Enable FLASH Prefetch Buffer and set Flash Latency (required for high speed)įLASH->ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY } while ((PLL_Status = 0) & (timeout > 0)) PLL_Status = RCC->CR & RCC_CR_PLLRDY_Msk } while ((HSE_Status = 0) & (timeout > 0)) HSE_Status = RCC->CR & RCC_CR_HSERDY_Msk

Now, edit main.c with a very minimal code: /*
