Tools

From scmRTOS

Jump to: navigation, search

Contents

scmRTOS Integrity Checker

Abstract

The key features of the scmRTOS are max speed and min code/RAM size requirements. To achieve these purposes the OS code has been written almost without runtime checks. Nevertheless, all OS parts are safe enough for the using. This became possible thanks to C++ programming language and its static strong typing. Unfortunately, programming language (and language tools such as compiler, linker) cannot control OS integrity over separate compilation! Therefore, processes types definition, processes declaration and process count have to be checked manually (by user). But everyone knows that the user (a human) can be a forgetful, careless, etc. or be abstracted on his project and, thus, can make mistake. In any case, OS configuration and integrity checking is the job for appropriate tool.

Integrity Checker utility is intended to free user from tedious and stupid job and, also, to improve checking quality.

DESCRIPTION

Integrity Checker utility scans the project source directory (directories), reads and analyzes .h, .c and .cpp files. The utility carries out the following checks:

  • Process count specified with macro scmRTOS_PROCESS_COUNT must agree with number of processes declared in the project.
  • Process priorities must constitute unbroken sequence without "holes" and duplicates and the sequence must begin from pr0. For example, if we have declared 4 processes, these processes must have the following priority values: pr0, pr1, pr2, pr3.
  • Two or more processes of the same type are not allowed. More than one process of the same type is valid thing in respect to the programming language but this is invalid for OS because each process must have its own process function. This process function is declared as static class member function, therefore, in case of two (or more) objects (processes) of the same type (class), these processes will share process function. In most cases this is error.

If any of these checks not passed the tool issues the corresponding error.

Note: Integrity Checker does NOT support preprocessor directives, so, for example, code:

#if 0
typedef OS::process<OS::pr4, 768> TCommandProc;
#endif

is not treated as comment. C/C++ comments are supported.

USAGE

The tool is used in the following manner:

 scmIC [options] DirName1 [DirName2 ... DirNameN]

Where scmIC is scmIC.py or scmIC.exe;

options are:

 -q - suppress output;
 -s - show summary;
 -r - recursive folder processing;


DirName1 [DirName2 ... DirNameN] - absolute or relative path of directory with project sources.

To proper working of the checker, the project must meet the following requirements:

  • All process types must be defined with help of typedef.
  • Process's root functions (Execs) must be qualified with macro OS_PROCESS.

It's strongly recommended to launch the tool just after source files compiled and before (or after) linking of the project. The main reason to use the integrity checker after compilation of sources is that the checker does not perform full parsing of the source files (such as compiler does) and in case of some syntax errors in the source files the checker can work incorrectly. To avoid this the compiler should be launched before the checker. For example, assume we have project with 3 sources located in directory %PROJECT%Src. We can build the project in the following way:

 compiler_executable compiler_options %PROJECT%\Src\file1.cpp
 compiler_executable compiler_options %PROJECT%\Src\file2.cpp
 compiler_executable compiler_options %PROJECT%\Src\file3.cpp
 
 scmIC %PROJECT%\Src
 
 linker_executable linker_options file1.obj file2.obj file3.obj

When using of make utility for project building the integrity checker can be placed as the command in explicit rule which performs project building before linking command, for example (GNU make):

$(target) : $(all_obj)
    @scmIC.exe $(SRC_DIR)
    @$(LINK) $(all_obj) $(LFLAGS)

USAGE VARIANTS

There are two variants of usage.

Primarily, scmRTOS Integrity Checker is Python script. So, to use script the user has to install Python interpreter. Just launch scmIC.py as described above.

Since far not all users have Python interpreter installed and do not want to install it, another way of usage is offered. In this case Python script is converted in executable scmIC.exe and launched as usual exe file.

DOWNLOAD

All files can be downloaded from Project Download Page:

  • scmIC.py is placed in scmIC.py.zip archive.
  • scmIC.exe is placed in scmIC.exe.zip archive.
Personal tools