Crossware

Table of Contents        Previous topic       Next topic       

C/C++ COMPILER->Pragmas->#pragma pid

#pragma pid(pid_number)

The pid pragma is provided to enable source level debugging when the ARM fast context switch extension (FCSE) is enabled.

The pid pragma tells the compiler that all subsequent functions are going to be associated with process identifier pid_number.

In the following example, the two functions pid72() and pid72_entry() will be associated with pid 72 (decimal).

#pragma pid(72)

#pragma code_seg("__pid72")

void pid72()
{
    volatile int i;
    i++;
    while (1);
}

void pid72_entry()
{
    pid72();
}

When the PID register of the FCSE contains 72, the Crossware debugger  (and simuluator) will be able to find the source file and line numbers for these two functions when required and display the source code associated with the current value of the program counter.  In this way it is possible to single step through the source code of multiple processes even though the execution addresses may be identical.

In the above example, the compiler will place the two functions in a code section named __pid72.  It is up to the developer to locate this section correctly using appropriate entries in the linker script.

#pragma pid(0) can be used to clear the pid number associated with subsequent functions.

Only functions are affected by the pid pragma.  It has no effect on data.