RZ/A Flexible Software Package Documentation  Release v3.0.0

 
Azure RTOS ThreadX Port (rm_threadx_port)

ThreadX port for RZ MCUs.

Overview

Note
The ThreadX Port does not provide any interfaces to the user. Consult the ThreadX documentation at https://docs.microsoft.com/en-us/azure/rtos/threadx/ for further information.

Features

The RZ ThreadX port supports the following features:

Configuration

Build Time Configurations for ThreadX

The following build time configurations are defined in fsp_cfg/azure/tx/tx_user.h:

ConfigurationOptionsDefaultDescription
General > Custom tx_user.hManual EntryAdd a path to your custom tx_user.h file. It can be used to override some or all of the configurations defined here, and to define additional configurations.
General > Error Checking
  • Enabled
  • Disabled
Enabled The ThreadX basic API error checking can be bypassed by compiling with the symbol TX_DISABLE_ERROR_CHECKING defined.
General > Max PrioritiesValue must be a multiple of 32 and in range 32 to 102432 Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32.
General > Minimum StackValue must be greater than 0200 Define the minimum stack for a ThreadX thread on this processor. If the size supplied during thread creation is less than this value, the thread create call will return an error.
General > Stack Filling
  • Enabled
  • Disabled
Enabled Determine is stack filling is enabled. By default, ThreadX stack filling is enabled, which places an 0xEF pattern in each byte of each thread's stack. This is used by debuggers with ThreadX-awareness and by the ThreadX run-time stack checking feature.
General > Preemption Threshold
  • Enabled
  • Disabled
Disabled Determine if preemption-threshold should be disabled. By default, preemption-threshold is disabled. If the application does not use preemption-threshold, it may be disabled to reduce code size and improve performance.
General > Notify Callbacks
  • Enabled
  • Disabled
Disabled Determine if the notify callback option should be disabled. By default, notify callbacks are disabled. If the application does not use notify callbacks, they may be disabled to reduce code size and improve performance.
General > Inline Thread Resume Suspend
  • Enabled
  • Disabled
Disabled Determine if the tx_thread_resume and tx_thread_suspend services should have their internal code in-line. This results in a larger image, but improves the performance of the thread resume and suspend services.
General > Not Interruptable
  • Enabled
  • Disabled
Disabled Determine if the internal ThreadX code is non-interruptable. This results in smaller code size and less processing overhead, but increases the interrupt lockout time.
General > IAR Library Support
  • Enabled
  • Disabled
Disabled Enable IAR library support (IAR compiler only). When IAR Library Support is Enabled, enable the linker option --threaded_lib. In the IAR IDE, this can be enabled in Project > Options > General Options > Library Configuration > Enable thread support in library.
General > BSD Support
  • Enabled
  • Disabled
Disabled Defines TX_THREAD_EXTENSION_1 to bsd_err_no in order to support NXD BSD.
General > FileX Pointer
  • Enabled
  • Disabled
Enabled Determine if there is a FileX pointer in the thread control block. By default, the pointer is there for legacy/backwards compatibility. The pointer must also be there for applications using FileX. Disable this to save space in the thread control block.
General > Use FPU
  • Enabled
  • Disabled
Disabled To save registers for FPU at context switching, Set this menu Enabled and call tx_thread_fp_enable() at the top of thread that uses FPU.
Timer > Timer Ticks Per SecondValue must be greater than 01000 Define the number of times the system timer runs per second. Default is 100 ticks per second, which results in a tick every 10ms.
Timer > Timer Thread Stack SizeValue must be greater than 01024 Define the system timer thread's default stack size and priority. These are only applicable if TX_TIMER_PROCESS_IN_ISR is disabled.
Timer > Timer Thread PriorityValue must be greater than 00 Define the system timer thread's default stack size and priority. These are only applicable if TX_TIMER_PROCESS_IN_ISR is disabled.
Timer > Timer Process In ISR
  • Enabled
  • Disabled
Enabled Determine if timer expirations (application timers, timeouts, and tx_thread_sleep calls should be processed within the a system timer thread or directly in the timer ISR. When disabled, the timer thread is used. When enabled, timer expiration processing is done directly from the timer ISR, thereby eliminating the timer thread control block, stack, and context switching to activate it.
Timer > Reactivate Inline
  • Enabled
  • Disabled
Disabled Determine if in-line timer reactivation should be used within the timer expiration processing. By default, this is disabled and a function call is used. When enabled, reactivating is performed in-line resulting in faster timer processing but slightly larger code size.
Timer > Timer
  • Enabled
  • Disabled
Enabled Determine if no timer processing is required. This option will help eliminate the timer processing when not needed.
Trace > Event Trace
  • Enabled
  • Disabled
Disabled Determine if the trace event logging code should be enabled. This causes slight increases in code size and overhead, but provides the ability to generate system trace information which is available for viewing in TraceX.
Trace > Trace Buffer NameName must be a valid C symbolg_tx_trace_buffer Name of trace buffer symbol, only used if Event Trace is enabled.
Trace > Memory section for Trace BufferManual Entry.bss Specify the memory section where the Trace Buffer will be allocated, only used if Event Trace is enabled. To view TraceX data, export this buffer as raw binary data to a file (.trx extension recommended) and open it with Microsoft Azure RTOS TraceX.
Trace > Trace Buffer SizeValue must be greater than 065536 Trace buffer size in bytes, only used if Event Trace is enabled
Trace > Trace Buffer Number of RegistriesValue must be greater than 030 Number of registries available to TraceX, only used if Event Trace is enabled
Performance > Block Pool Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers block pool performance information.
Performance > Byte Pool Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers byte pool performance information.
Performance > Event Flags Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers event flags performance information.
Performance > Mutex Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers mutex performance information.
Performance > Queue Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers queue performance information.
Performance > Semaphore Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers semaphore performance information.
Performance > Thread Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers thread performance information.
Performance > Timer Performance Info
  • Enabled
  • Disabled
Disabled When enabled, ThreadX gathers timer performance information.
Interrupts > SysTick Interrupt PriorityMCU Specific OptionsSelect the Systick interrupt priority.
Interrupts > Maximum Interrupt PriorityMCU Specific OptionsThe maximum priority (lowest numerical value) an interrupt can have and use scheduler services. Interrupts with higher priority can interrupt most scheduler critical sections. Setting this to Priority 0 (highest) disables this feature. This feature is not available on MCUs that do not have the BASEPRI register.

Clock Configuration

The ThreadX port uses the SysTick timer as the system clock. The timer rate is configured in the ThreadX component under General > Timer Ticks Per Second.

Pin Configuration

This module does not use I/O pins.

Usage Notes

Interrupt Priorities

When no threads are ready to run, the ThreadX port spins in the PendSV_Handler, which is fixed at the lowest interrupt priority. The MCU does not service any other interrupts of the lowest priority while no threads are ready to run.

Warning
Do not attempt to wake a thread from an interrupt with the lowest available interrupt priority unless the application has created an idle thread.

Low Power Modes

The idle processing executes WFI() when no thread is ready to run. If the MCU is configured to enter software standby mode or deep software standby mode when the idle processing executes WFI(), the RZ ThreadX port changes the low power mode to sleep mode so the idle processing can wake from SysTick. The low power mode settings are restored when the MCU wakes from sleep mode.