hrlasas.blogg.se

Atollic truestudio printf tutorail
Atollic truestudio printf tutorail




  1. #Atollic truestudio printf tutorail update#
  2. #Atollic truestudio printf tutorail code#

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)

  • Create tasks as OS kernel objects, providing a name, a given amount of RAM and a priority level.
  • Performs MCU init, including clock settings and some low-level peripheral configurations.
  • Next, still in main.c, let us prototype two global functions that we will use for the implementation of two so-called ' tasks' in the FreeRTOS vocabulary: // FreeRTOS tasksĪnd now, let us write the main() function which basically: ) ĭoing so, you just have to include main.h in main.c and all the required functions will be available: /* Int my_sprintf (char *out, const char *format.

    atollic truestudio printf tutorail

    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

    atollic truestudio printf tutorail

    * - 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

    atollic truestudio printf tutorail

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






    Atollic truestudio printf tutorail