This document describes the issues raised when building code for an SMP platform.
The only difference between building for an SMP and non-SMP system, is the inclusion of the SMPSAFE keyword in the mmp file.
However, before the SMPSAFE keyword can be used, the ROM compatibility mode should be understood and enabled. It is described below.
This specifies how the resulting build will execute code that has not been marked as SMP safe, for example, existing applications produced by third party developers. However, ROM compatibility mode does not guarantee that non-SMP code will work. By default, ROM compatibility is turned off. It is expected that code will be tested on a SMP platform to verify that it is SMP safe. Which compatibility mode is to be used will be decided during the ROM integration stage.
The ROM compatibility mode takes the form of two new rombuild parameters (only one can be used at any one time).
There are two parts to using ROM compatibility mode:
Specifying that it is to be turned on and which type of ROM compatibility is to be used. This is done with a new parameter for the rombuild tool.
Adding the appropriate macros in the baseport iby and oby files.
The arguments of rombuild that relate to ROM compatibility are:
rombuild argument |
Description |
---|---|
-d SMPCOMPATMODE |
Enables regular compatibility mode. This means that all the threads in unsafe processes (non-SMP safe) are restricted, so that only the ready thread with the highest priority can run. In regular compatibility mode, a thread group is created for each process. This thread group will have the same priority as the highest priority thread that it contains. These thread groups can be assigned to any of the available processors, not just CPU 0. |
-d SMPCOMPATCPU0 |
Enables CPU 0 only mode. This means that all threads in unsafe processes (non-SMP safe) can only execute on CPU 0. |
In order for the ROM compatibility mode arguments to work, changes have to be made to the iby and oby files of the baseport being used. This takes the form of setting the appropriate flags:
Flag |
Description |
Default Value |
---|---|---|
SMPUNSAFECOMPAT |
Sets the state of the regular compatibility mode. |
off |
SMPUNSAFECPU0 |
Sets the state of the CPU 0 mode. |
off |
The only valid values for these flags are on or off.
The following line has to be added to the baseport iby and oby files:
#include <rom/include/kernel.hby>
An example of the use of above flags is:
#ifdef SMP #if defined(SMPCOMPATMODE) && defined(SMPCOMPATCPU0) #error "Can't have SMPCOMPATMODE and SMPCOMPATCPU0 at once!" #endif #ifdef SMPCOMPATMODE SMPUNSAFECOMPAT(on) #endif #ifdef SMPCOMPATCPU0 SMPUNSAFECPU0(on) #endif #endif //SMP
Now that the build system has been set up to work with non-SMP safe code, the use of the SMPSAFE can be described.
The SMPSAFE keyword is used to tell the system that the project can work correctly in an SMP environment.
It is indicated by placing the word SMPSAFE on a single line of the project's mmp file.
An example of the use of the SMPSAFE keyword is given below:
capability all VENDORID 0x70000001 SMPSAFE
The effect of this keyword is as follows:
Is the SMPSAFE keyword present? |
State of ROM Compatibility Mode |
Resulting Behavior |
---|---|---|
Yes |
N/A |
The code is assumed to be SMP safe and will be executed accordingly. |
No |
Disabled |
The code will be executed, but SMP related problems can occur. |
No |
Enabled |
The code will be executed. How it is executed, depends on which ROM compatibility mode has been enabled. |
The build process for an SMP platform will be described.
The build process for an SMP platform is exactly the same as the build process for a non-SMP platform.
For the description of this process, follow the Build Tool Guide link below.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.