IBM Support

Differences between the standard C RTS and MISRA-C RTS

Question & Answer


Question

What differences are there between the standard C TargetRTS (RunTime System) and MISRA-C RTS in IBM Rational Rose RealTime?

Cause

Documentation defect APAR PK30128 was submitted to improve the MISRA-C documentation but has been closed as a permanent restriction.

Answer

This technote includes some general information about the MISRA-C RTS and the key differences between the standard C TargetRTS in IBM Rational Rose RealTime.

  1. MISRA C available target configuration options
    1. DEBUGGING Enabled
      To enable debugging capabilities of Rose RealTime, including the Target Observability in MISRA C models, select the following target configuration:

      NT40-DEBUGS.x86-VisualC++-6.0-DEFAULT

      This configuration however uses file operations and hence is not MISRA C compliant. This configuration, therefore, should only be used only for debugging purposes. For deployment, it will be important to use any of the remaining three configurations (see, below) or build your own configuration using the TargetRTS wizard.

    2. STDIO & Default LOGGING Enabled, no DEBUGGING
      To enable STDIO & default LOGGING capabilities with no DEBUGGING select the following target configuration:

      NT40-MINIMALS.x86-VisualC++-6.0-WITH-STDIO

    3. Default LOGGING Enabled, no STDIO or DEBUGGING
      To enable default LOGGING capabilities with no STDIO or DEBUGGING, select the following target configuration:

      NT40-MINS.x86-VisualC++-6.0-NO-STDIO

      This library (target configuration) provides the flexibility to use the LOGGING facility (with the use of conio.h). However, STDIO is disabled.

      Note: The configurations NT40-DEBUGS.x86-VisualC++-6.0-DEFAULT, NT40-MINIMALS.x86-VisualC++-6.0-WITH-STDIO and NT40-MINS.x86-VisualC++-6.0-NO-STDIO may be used with the example model "SendReceiveData.rtmdl" provided in the "C:\Program Files\Rational\Rose Realtime\Examples\MISRAC" folder of your Release location.

    4. NO STDIO, DEBUGGING or Default LOGGING
      If you do not wish to enable STDIO, DEBUGGING or default LOGGING, select the following target configuration:

      NT40-MINCONFIGS.x86-VisualC++-6.0-NO-STD-NO-LOG

      If this target configuration is selected, you may use your own logging mechanism.

      The model "SendReceiveData-MISRAC.rtmdl" (located in "C:\Program Files\Rational\Rose Realtime\Examples\MISRAC") uses the target configuration NT40-MINCONFIGS.x86-VisualC++-6.0-NO-STD-NO-LOG. In this example model, the logging is accomplished using "cputs", "conio.h" and has been included in the common preface.

  2. Creating Multi-Threaded Models

    The Rose RealTime TargetRTS wizard memory buffer size is currently set to 25K. For multi-threaded models the memory required may be more, depending on the MSGQUEUE size. In this case, you would need to reconfigure the size and rebuild the TargetRTS. Also, as this release does not include a multi-threaded library, if you wish to use multi-threading, refer to the following instructions.

    A new option "MEMORY_BUFFER" has been added in the TargetRTS wizard. This sets the size of the buffer of the memory manager. The memory manager allocates in size chunks of 512, therefore indicate the size as a multiple of 512. Memory consumption while using Rose RealTime threads may be high, including a normal thread creation requiring 20000 bytes per thread. The memory buffer default size is currently 25560, assuming that a typical MISRA C application will not be multi-threaded, as the use multithreading calls in for the need for a threads library. Therefore, while debugging or creating multi-thread applications, increase the size of the memory buffer as needed. Failure to change this field might result in a thread creation failure.

    To edit the TargetRTS to use threading:
    • Start the TargetRTS Wizard and then click on the "Target Button".
    • Edit the RTTarget.h to include threading. This can be done by setting the flag "USE_THREADS" to "1". Also, set the default debug priority to "4" (for example) by adding a new macro as shown below:

      #define DEFAULT_DEBUG_PRIORITY 4
    • While building / rebuilding, the "BUILD FLAT" option should be unchecked for the library to be MISRA C compliant. (By default it is unchecked. You NOT check it and build / rebuild)

  3. Names of Classes & Members must be MISRA C 1.4 compliant

    The Rose RealTime MISRA C Add-In requires code be compliant with the MISRA C rule 1.4. The names of the variables / classes / attributes etc. used in the model must be within the 32 byte limit, which the MISRA C rule 1.4 dictates.

    When using the Rose RealTime MISRA C Add-In you must assure that the lengths of variables are within this range. Rose RealTime Codegen parses the model and generates the source code appending "rtg_" to the method / variable names. If the names of classes and/or members are beyond the 32 byte limit, the generated code will not be MISRA C rule 1.4 compliant.

  4. Limitations of the MISRA C Add-In
    The following describes the Limitations of the Rose RealTime MISRA C Add-In:
    • The code is not MISRA C ADVISORY RULE NO: 11.3 compliant.
    • The generated code is not MISRA C ADVISORY RULE 16.7 compliant although the TargetRTS is fully compliant.
    • The debug libraries are not MISRA C compliant ( Debugging and Debugger ) . This is due to the fact that the debug operation requires file operations to debug from the Rose RealTime environment.
    • The Rose Real Time MemManager is slightly faster than dlmalloc() although it has been customized for embedded system.

  5. Memory allocation and deallocation
    Memory allocation and deallocation in Rose Real Time MISRA-C is different from Rose Real Time C.
    C-TargetRTS usage the function like free() and malloc() for memory allocation/deallocation in the system.
    While in MISRA-C TargetRTS it usages a MEMORY_BUFFER which is fixed chunk of memory assigned at the creation of target configuration which intern usage function like RTfree() and RTmalloc() - which are defined under $RTS_HOME/RTPubl/memmanager.c specifically designed for Rose Real Time memory management in MISRA-C only.
[{"Product":{"code":"SSSHKL","label":"Rational Rose RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"TargetRTS","Platform":[{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"2003.06.15;2003.06.15b;2003.06.16;7.0;7.0.0.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

More support for:
Rational Rose RealTime

Software version:
2003.06.15, 2003.06.15b, 2003.06.16, 7.0, 7.0.0.1

Operating system(s):
Solaris, Windows, Linux

Document number:
621897

Modified date:
16 June 2018

UID

swg21377031