-
Notifications
You must be signed in to change notification settings - Fork 6
Initialisation and Ready to Drive
The hardware initialisation process is mostly handled by the code generated automatically by STM32CubeIDE from the project configuration file.
Initialisation of the RTOS threads happens in App_ThreadX_Init()
which is called during the ThreadX kernel initialisation (tx_kernel_enter()
). The initialisation process is as follows:
- Allocate memory for the stack of each thread from the application memory pool using
tx_byte_allocate()
. - Create each thread using
tx_thread_create()
. - Initialise the message passing system (?).
- Complete the ready-to-drive procedure.
- Exit initialisation and begin running the ThreadX scheduler.
The RTOS kernel will not begin scheduling threads until the ready-to-drive procedure is completed. This is handled by the ready_to_drive()
function which:
- Turns on the built-in red LED.
- Waits for a rising edge on the ready-to-drive input signal.
- Drives the buzzer output pin for the number of seconds specified by
READY_TO_DRIVE_BUZZER_TIME
. - Turns off the built-in red LED.
The ready-to-drive input signal can be overridden for testing by setting READY_TO_DRIVE_OVERRIDE
in the configuration header which will use the 'USER' button on the dev board as a replacement for the ready-to-drive signal. The behaviour of the process is otherwise the same.