STM32CubeMX and STM32CubeIDE thread-safe solution Application note

2022-04-20
●Introduction
■This application note describes the thread-safe solution, implemented in STM32CubeMX and STM32CubeIDE, to ensure safe and reliable operation with respect to concurrent calls to C library functions:
▲The thread-safe issue and the solution described in this application note is only related to functions containing a critical section, operating on one single instance of global data, like malloc() or free().
▲The application note does not address reentrance as there is no locking mechanism in the thread-safe solution protecting the user against reentrance-related issues. It is instead the user's responsibility to make sure that each C library function,like strtok(), is called with its own thread context.
■The C libraries, bundled with the toolchains promoted in the STM32Cube ecosystem, are by default not protected against concurrency. This means that the usage of malloc(), free(), or any other function implicitly calling these functions is not safe in multi-threaded systems. These multi-threaded systems can be either bare-metal or RTOS-based systems.
■This application note is a guideline to get started with the thread-safe solution, create, and build projects with the suitable thread-safe strategy to ensure that the supported C libraries are protected against concurrency. The proposed RTOS strategies and their implementations apply to the FreeRTOS™ real-time operating system only.
■Section 2 presents the thread-safe issue and the proposed solution, while Section 3 and Section 4 describe the implementation of thread-safe setting in STM32CubeMX and the various files generated, using the compatible toolchains.
■Section 5 shows common bare-metal and FreeRTOS™ examples illustrating how to ensure safe application by adopting the thread-safe solution.

ST

STM32CubeMXSTM32CubeIDE

More

Part#

More

More

Application note & Design Guide

More

More

Please see the document for details

More

More

English Chinese Chinese and English Japanese

30-Nov-2021

Revision 1

AN5731

700 KB

- The full preview is over. If you want to read the whole 20 page document,please Sign in/Register -
  • +1 Like
  • Add to Favorites

Recommend

All reproduced articles on this site are for the purpose of conveying more information and clearly indicate the source. If media or individuals who do not want to be reproduced can contact us, which will be deleted.

Contact Us

Email: