22
CHAPTER 4
Standard system libraries
4.1 Standard system libraries
embOS for Cortex-M and IAR may be used with IAR standard libraries.
If non thread-safe functions are used from different tasks, embOS functions may be used
to encapsulate these functions and guarantee mutual exclusion.
The system libraries from the IAR Embedded Workbench come with built-in hook functions,
which enable thread-safe calls of all system functions automatically when supported by the
operating system.
embOS compiled for IAR Embedded Workbench is prepared to use these hook functions.
Adding source code modules, which are delivered with embOS, activate the automatic
thread locking functionality of the new IAR DLib.
4.2 Thread-safe system libraries
Using embOS with
C++
projects and file operations or just normal call of heap management
functions may require thread-safe system libraries if these functions are called from dif-
ferent tasks. Thread-safe system libraries require some locking mechanism which is RTOS
specific.
To activate thread-safe system library functionality, special source modules delivered with
embOS have to be included in the project. How to use these locking mechanisms depends
on the IAR compiler version.
4.2.1 IAR compiler V6.10 to V7.80
To enable the automatic thread-safe locking functions, the source module
xmtx.c
which
is included in every CPU specific Setup folder of the embOS shipment has to be included
in the project.
To support thread-safe file i/o functionality, the source module
xmtx2.c
has to be added.
The embOS libraries compiled for and with the IAR compiler / workbench V6 come with
all code required to automatically handle the thread-safe system libraries when the source
module
xmtx.c
and
xmtx2.c
from the embOS shipment are included in the project.
Note that thread-safe system library and file i/o support is required only, when non thread-
safe functions are called from multiple tasks, or thread-local storage is used in multiple
tasks.
With IAR compiler version V6.40 to V7.80, the thread-safe system library hook functions
delivered with embOS are
not
automatically linked in, even if they are included in the
project.
To enable the automatic thread-safe locking functions, the project options for the linker
have to be setup to replace the default locking functions from the system libraries by the
functions delivered with embOS.
Activate the checkbox
“Use command line options”
in the dialog
Project -> Options
-> Linker -> Extra options
then, in the
“Command line options:”
field, add the
following lines:
--redirect __iar_Locksyslock=__iar_Locksyslock_mtx
--redirect __iar_Unlocksyslock=__iar_Unlocksyslock_mtx
--redirect __iar_Lockfilelock=__iar_Lockfilelock_mtx
--redirect __iar_Unlockfilelock=__iar_Unlockfilelock_mtx
--keep __iar_Locksyslock_mtx
4.2.2 IAR compiler V8.10 and newer
To enable the automatic thread-safe locking functions, the source module
xmtx.c
which is
included in every CPU specific Setup folder of the embOS shipment has to be included in
embOS-MPU for Cortex-M and IAR
© 2010-2020 SEGGER Microcontroller GmbH
Содержание embOS-MPU
Страница 4: ...4 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 6: ...6 embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 21: ...Chapter 4 CPU and compiler specifics embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...
Страница 44: ...Chapter 8 VFP support embOS MPU for Cortex M and IAR 2010 2020 SEGGER Microcontroller GmbH ...