# 10.1. Main Targets¶

Main targets include:

• x86 platforms

• x86_64 platforms

• 32bit ARM-Cortex-A platforms

• 32bit ARM-Cortex-M platforms (no shared libraries)

• 64bit ARM-Cortex-A platforms (AARCH64 toolchain)

• 64bit ARM-Cortex-A platforms (Integrity toolchain)

• NVIDIA platforms with ARM-Cortex-A processors

• PowerPC platforms with GCC compiler

You can check here to find the correct naming option for each platform.

## 10.1.1. High-level interface¶

The steps to deploy and simulate a FORCES Pro controller on most targets are detailed below.

1. In the High-level interface example BasicExample.m set the code generation options:

codeoptions.platform = '<platform_name>'; % to specify the platform
codeoptions.printlevel = 0; % optional, on some platforms printing is not supported
codeoptions.cleanup = 0; % to keep necessary files for target compile


and then generate the code for your solver (henceforth referred to as “FORCESNLPsolver”, placed in the folder “BasicExample”) using the high-level interface.

• FORCESNLPsolver_casadi2forces.c

• FORCESNLPsolver_model_1.c

• FORCESNLPsolver_model_11.c

3. For most target platforms you will receive the following compiled files:

• For Linux/MacOS:

• an object file FORCESNLPsolver.o inside the folder obj_target

• a static library file libFORCESNLPsolver.a inside the folder lib_target

• a shared library file libFORCESNLPsolver.so inside the folder lib_target

• For Windows:

• an object file FORCESNLPsolver.obj inside the folder obj_target

• a static library file FORCESNLPsolver_static.lib inside the folder lib_target

• a dynamic library file FORCESNLPsolver.dll with its definition file for compilation FORCESNLPsolver.lib inside the folder lib_target

You need only one of those to build the solver.

Important

The shared library and the dynamic library if used for building need to be present during runtime as well.

4. Create an interface to call the solver and perform a simulation/test.

You can find a C interface for this example here.

5. Copy in the target platform:

• The FORCESNLPsolver folder

• The source files from step 2

• The interface from step 4

6. Compile the solver. The compilation command would be (supposing you are in the directory which contains the FORCESNLPsolver folder):

<Compiler_exec> HighLevel_BasicExample.c <compiled_solver> FORCESNLPsolver_casadi2forces.c FORCESNLPsolver_model_1.c FORCESNLPsolver_model_11.c <additional_libs>


Where:

• <Compiler_exec> would be the compiler used in the target

• <compiled_solver> would be one of the compiled files of step 3

• <additional_libs> would be possible libraries that need to be linked to resolve existing dependencies.

• For Linux/MacOS it’s usually necessary to link the math library (-lm)

• For Windows you usually need to link the iphlpapi.lib library (it’s distributed with the Intel Compiler, MinGW as well as Matlab) and sometimes some additional intel libraries (those are included in the FORCES Pro client under the folder libs_Intel – if missing they are downloaded after code generation)

## 10.1.2. Y2F interface¶

The steps to deploy and simulate a FORCES Pro controller on most targets are detailed below.

1. In the Y2F interface example mpc_basic_example.m set the code generation options:

codeoptions.platform = '<platform_name>'; % to specify the platform
codeoptions.printlevel = 0; % optional, on some platforms printing is not supported


and then generate the code for your solver (henceforth referred to as “simpleMPC_solver”, placed in the folder “Y2F”) using the Y2F interface.

2. The Y2F solver is composed of a main solver which calls multiple internal solvers. The file describing the main solver is:

• simpleMPC_solver.c inside the folder interface

3. The internal solvers are provided as compiled files. For most target platforms you will receive the following compiled files:

• For Linux/MacOS:

• an object file internal_simpleMPC_solver_1.o inside the folder obj_target

• a static library file libinternal_simpleMPC_solver_1.a inside the folder lib_target

• a shared library file libinternal_simpleMPC_solver_1.so inside the folder lib_target

• For Windows:

• an object file internal_simpleMPC_solver_1.obj inside the folder obj_target

• a static library file internal_simpleMPC_solver_1_static.lib inside the folder lib_target

• a dynamic library file internal_simpleMPC_solver_1.dll with its definition file for compilation internal_simpleMPC_solver_1.lib inside the folder lib_target

You need only one of those to build the solver.

Important

The shared library and the dynamic library if used for building need to be present during runtime as well.

4. Create an interface to call the solver and perform a simulation/test.

You can find a C interface for this example here.

5. Copy in the target platform:

• The simpleMPC_solver folder

• The interface from step 4

6. Compile the solver. The compilation command would be (supposing you are in the directory which contains the simpleMPC_solver folder):

<Compiler_exec> Y2F_mpc_basic_example.c simpleMPC_solver/interface/simpleMPC_solver.c <compiled_solver> <additional_libs>


Where:

• <Compiler_exec> would be the compiler used in the target

• <compiled_solver> would be one of the compiled files of step 3

• <additional_libs> would be possible libraries that need to be linked to resolve existing dependencies.

• For Linux/MacOS it’s usually necessary to link the math library (-lm)

• For Windows you usually need to link the iphlpapi.lib library (it’s distributed with the Intel Compiler, MinGW as well as Matlab) and sometimes some additional intel libraries (those are included in the FORCES Pro client under libs_Intel – if missing they are downloaded after code generation)