Configure IAR DLIB for thread safety

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Configure IAR DLIB for thread safety

    In prior versions of embOS that I used with IAR Workbench and ARM7/9 CPUs there was documentation for configuring IAR's DLIB to be thread safe by somehow configuring it to use embOS mutexes for certain operations. This involved wither rebuilding DLIB with some special headers and/or calling OS_INIT_SYS_LOCKS() at some point in the system initialization.

    I'm currently working with an embOS built for the Cortex M3 (embOS 3.60d, soon to be 3.80h I think). However, there's no mention of this in documentation - all it says in the embOS_CM3_IAR.pdf document is (Chapter 5 - Compiler Specifics):
    embOS for CM3 and IAR compiler may be used with standard IAR system libraries for most of all projects. Heap management and file operation functions of standard system libraries are not reentrant and can therefore not be used with embOS, if non thread safe functions are used from different tasks. For heap management, embOS delivers its own thread safe functions which may be used. These functions are described in embOS CPU independent manual.
    I seem to recall that this is where other versions of embOS that I've used described using OS_INI_SYS_LOCKS() and/or the other options. Has this support been removed (whether by Segger or IAR)?
  • In embOS CM3 IAR V3.60d thread safe libraries are not yet documented, the latest embOS manual says:

    5.2. Thread safe system libraries, OS_INIT_SYS_LOCKS()
    Using heap management or other functions which are normally non reentrant
    requires a special initialization sequence when these functions shall be used
    with embOS and may be called from different tasks.
    Using C++ projects with dynamic object creation will also require the same initialization
    procedure.
    To switch the system libraries to thread safe mode, the embOS function
    OS_INIT_SYS_LOCKS() has to be called before the system is started.
    A typical embOS initialization for thread safe usage of system libraries would
    look like follows:

    C Source Code

    1. int main(void) {
    2. OS_IncDI(); /* Initially disable interrupts */
    3. OS_InitKern(); /* Initialize OS */
    4. OS_INIT_SYS_LOCKS(); /* Activate thread safe library */
    5. OS_InitHW(); /* Initialize Hardware for OS */
    6. /* You need to create at least one task before calling OS_Start() */
    7. OS_CREATETASK(&TCBHP, "HP Task", HPTask, 100, StackHP);
    8. OS_CREATETASK(&TCBLP, "LP Task", LPTask, 50, StackLP);
    9. OS_Start(); /* Start multitasking */
    10. return 0;
    11. }
    Display All


    So please use the latest embOS version 3.80h.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Since we are working all the time to improve embOS it is always a good choice to use the latest version.

    You are always welcome to ask us for features you are missing!
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.