AM263Px MCU+ SDK  10.01.00
FreeRTOS POSIX

Introduction

This example shows usage of POSIX APIs with FreeRTOS running underneath the POSIX layer. Usage of POSIX thread and POSIX message queue is shown in this example.

The example does the below

  • Creates worker message queues and worker threads
  • Creates a dispatcher thread
  • The dispatcher thread sends messages to each worker message queue
  • After few iterations, a exit message is sent and dispatcher and worker threads then exit
  • The main thread waits until all the created threads have finished.

Supported Combinations

Parameter Value
CPU + OS r5fss0-0 freertos
Toolchain ti-arm-clang
Boards am263px-cc, am263px-lp
Example folder examples/kernel/freertos/posix_demo

Steps to Run the Example

See Also

FreeRTOS

Sample Output

Shown below is a sample output when the application is run,

Worker mqueue #[1879656984] - start
Worker mqueue #[1879657136] - start
Worker mqueue #[1879657288] - start
Worker mqueue #[1879657440] - start
Dispatcher thread - start
Dispatcher iteration #[0] -- Sending msg to worker mqueue #[1879656984].
Dispatcher iteration #[1] -- Sending msg to worker mqueue #[1879657136].
Dispatcher iteration #[2] -- Sending msg to worker mqueue #[1879657288].
Dispatcher iteration #[3] -- Sending msg to worker mqueue #[1879657440].
Dispatcher iteration #[4] -- Sending msg to worker mqueue #[1879656984].
Dispatcher iteration #[5] -- Sending msg to worker mqueue #[1879657136].
Dispatcher iteration #[6] -- Sending msg to worker mqueue #[1879657288].
Dispatcher iteration #[7] -- Sending msg to worker mqueue #[1879657440].
Dispatcher iteration #[8] -- Sending msg to worker mqueue #[1879656984].
Worker thread #[1879657592] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879657592] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879657592] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879670840] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879670840] -- Received eWORKER_CTRL_MSG_CONTINUE
Dispatcher iteration #[9] -- Sending msg to worker mqueue #[1879657136].
Worker thread #[1879662008] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879662008] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879662008] -- Received eWORKER_CTRL_MSG_CONTINUE
Dispatcher [0] -- Sending eWORKER_CTRL_MSG_EXIT to worker thread #[1879656984].
Dispatcher [1] -- Sending eWORKER_CTRL_MSG_EXIT to worker thread #[1879657136].
Dispatcher [2] -- Sending eWORKER_CTRL_MSG_EXIT to worker thread #[1879657288].
Worker thread #[1879657592] -- Finished. Exit now.
Worker thread #[1879666424] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879666424] -- Received eWORKER_CTRL_MSG_CONTINUE
Worker thread #[1879666424] -- Finished. Exit now.
Dispatcher [3] -- Sending eWORKER_CTRL_MSG_EXIT to worker thread #[1879657440].
Worker thread #[1879662008] -- Finished. Exit now.
Worker thread #[1879670840] -- Finished. Exit now.
All tests have passed!!