While using a multithreaded environment there is a need to use multithread support in the standard library, (for example calls to malloc()).
Multi thread support can be enabled in the standard library. Read the chapter: 'Enabling Multithread Support' in the Development Guide.
After implementing the system/file lock interface, it is possible to verify that the system lock functions are called when calling for example malloc/free. Just set breakpoints in the *Mtxinit, *Mtxlock and *Mtxunlock functions, and step over a call to malloc/free.
If using an RTOS, the first thing to consider is if there is a real reason to implement the multithread support.
Many RTOS vendors have already done that kind of implementation, for example:
When using the combination of a multi-thread RTOS and C++ the compiler option
needs to be used. In the IDE, the option can be specified in Project -> Options -> C/C++ Compiler -> Extra Options.
The reason is that C++ constructors/destructors could be called from several RTOS threads.
If using IAR Embedded Workbench for ARM version 6.60 and newer enable the linker option:
This can be done via the IDE option: Project -> Options -> General Options -> Library Configuration -> Enable thread support in the library.
If using versions 6.40 or 6.50 add a number of linker options (--redirect) to Project -> Options -> Linker -> Extra Options to enable multithread support.
The --redirect options are documented in the file
Note that these options need to be added, even when using an RTOS implementation.
All product names are trademarks or registered trademarks of their respective owners.