Tx_Thread_Sync application description

This application provides an example of Azure RTOS ThreadX stack usage, it shows how to develop an application using the ThreadX synchronization APIs. The main entry function tx_application_define() is called by ThreadX during kernel start, at this stage, the application creates 2 threads with the same priorities :

The function “Led_Toggle()” is the entry function for both threads to toggle the leds.Therefore it is considered as a “critical section” that needs protection with a ‘SyncObject’ flag in the file “app_threadx.h” Each thread is running in an infinite loop as following:

By default the ‘SyncObject’ is defined as “TX_MUTEX”. It is possible to use a binary “TX_SEMAPHORE” by tuning the compile flags in the file “app_threadx.h”.

Expected success behavior

Error behaviors

‘LED_BLUE’ toggles every 1 second if any error occurs and LED_GREEN switched OFF.

Assumptions if any

None

Known limitations

None

ThreadX usage hints

Keywords

RTOS, ThreadX, Threading, Semaphore, Mutex

Hardware and Software environment

How to use it ?

In order to make the program work, you must do the following :