You are viewing an older revision! See the latest version

CMSIS RTOS

Table of Contents

    The CMSIS-RTOS library provides a scheduler to run concurrently multiple threads of execution and methods for the exchange of data among these threads.

    CMSIS-RTOS Library URL: http://mbed.org/projects/libraries-testing/svn/rtos

    Thread

    [Not converted]

    Mutex

    /media/uploads/emilmont/mutex.png

    [Not converted]

    Semaphore

    /media/uploads/emilmont/semaphore.png

    [Not converted]

    Signals

    [Not converted]

    Message Queue

    /media/uploads/emilmont/messagequeue.png

    Memory Pool

    [Not converted]

    Mail Queue

    /media/uploads/emilmont/mailqueue.png

    [Not converted]

    Timer

    [Not converted]

    Interrupt Service Routines

    The same CMSIS-RTOS can be used in ISR. The only two warnings are:

    • Mutexes can not be used.
    • Wait in ISR is not allowed: all the timeouts in method parameters have to be set to 0 (no wait).

    [Not converted]

    No wait in ISR

    When calling an rtos object method in an ISR all the timeout parameters have to be set to 0 (no wait): waiting in ISR is not allowed.

    Stack Configuration

    The stack configuration is very dependent from the underling CMSIS-RTOS implementation.

    As first reference implementation we are using RTX. One of the limitation of the RTX implementation is that it requires to statically configure the maximum number of threads and the size of the memory pool for their stacks.

    Our initial RTX configuration choices are likely to change in response to the mbed users feedback:

    mbed NXP LPC11U24mbed NXP LPC1768
    Max number of user threads + (timer)3 + (1)7 + (1)
    Default stack size in bytes0.5 Kb1 Kb

    RAM Usage

    Importing the rtos library you will immediately consume 25% of the available RAM on your mbed for stack usage.

    configuration

    We will soon release the sources of our current RTX implementation and you will be able to edit the configuration as you like.

    Additionally, in the future we will favour CMSIS-RTOS implementations that do not require the editing of a configuration file to specify the maximum number of threads.

    The current stack configuration is a temporary implementation detail.

    Status and Error Codes

    The Status and Error Codes section lists all the return values that the CMSIS-RTOS functions will return:

    • osOK: function completed; no event occurred.
    • osEventSignal: function completed; signal event occurred.
    • osEventMessage: function completed; message event occurred.
    • osEventMail: function completed; mail event occurred.
    • osEventTimeout: function completed; timeout occurred.
    • osErrorParameter: parameter error: a mandatory parameter was missing or specified an incorrect object.
    • osErrorResource: resource not available: a specified resource was not available.
    • osErrorTimeoutResource: resource not available within given time: a specified resource was not available within the timeout period.
    • osErrorISR: not allowed in ISR context: the function cannot be called from interrupt service routines.
    • osErrorISRRecursive: function called multiple times from ISR with same object.
    • osErrorPriority: system cannot determine priority or thread has illegal priority.
    • osErrorNoMemory: system is out of memory: it was impossible to allocate or reserve memory for the operation.
    • osErrorValue: value of a parameter is out of range.
    • osErrorOS: unspecified RTOS error: run-time error but no other error message fits.

    osEvent

    The osEvent data structure is returned by get methods of Queue and Mail objects. This data structure contains both an error code and a pointer to the actual data:

    osEvent

      * status       [osStatus    ]: status code (event or error information)
    
    union: either {
      * value
        * v          [uint32_t    ]: message as 32-bit value 
        * p          [void *      ]: message or mail as void pointer 
    } or {
      * def
        * mail_id    [osMailQId   ]: mail id obtained by osMailCreate 
        * message_id [osMessageQId]: message id obtained by osMessageCreate
    }
    

    All wikipages