Skip to Content
Hands-On RTOS with Microcontrollers
book

Hands-On RTOS with Microcontrollers

by Brian Amos
May 2020
Intermediate to advanced
496 pages
13h 54m
English
Packt Publishing
Content preview from Hands-On RTOS with Microcontrollers

Creating a task

When a task is created using dynamically allocated memory, the call will look something like this (see Chapter 7, The FreeRTOS Scheduler, for more details on the parameters that are not related to memory allocation):

BaseType_t retVal = xTaskCreate( Task1, "task1", StackSizeWords, NULL,        tskIDLE_PRIORITY + 2, tskHandlePtr);assert_param(retVal != pdPASS);

There are a few relevant pieces of information, relevant to memory allocation, to note about this call:

  • The call to xTaskCreate may fail. This is because there is no guarantee that enough space will be available for storing the task's stack and TCB on the FreeRTOS heap. The only way to ensure that it was created successfully is to check the return value, retVal.
  • The only parameter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers - Second Edition

Hands-On RTOS with Microcontrollers - Second Edition

Jim Yuill, Penn Linder

Publisher Resources

ISBN: 9781838826734Supplemental Content