dSPACE - PPCTools Compiler - acados - C-code standard C89/90 / C99 - MABX II

Hi :wave:

I’ve managed to find what is the problem I’m having during a build but it looks that I might be missing something. Doing some research I’ve found that the PPCTools Compiler that we are supposed to used during the integration with dSPACE runs on C89/90 c-code standard. However, during the build I started to have some issues with some operations not contained on math.h (fmax, fmin, trunc) and ‘bool’, which suggests that acados was done according to C99 c-code standard (also on the header files there’s , which, again, corresponds to C99).

Am I missing something? Because the procedure to set acados on dSPACE seems to be quite straightforward and there’s nothing on the acados installation procedure that suggests that the c-code standard is something I could set.

PS:
Matlab 2017b
dSPACE 2018-B
dSPACE MicroAutoBox II

Thanks for your time,
Daniel

Hi Daniel,

as far as I know acados complies with the C99, but not C89.
I do think that the dSPACE MABX II compilers support that.
Thus, I am not sure, why you need C89.

Best,
Jonathan

Hi Jonathan,

Thanks for the reply :slight_smile:

The reason I’m asking is because I’m having Simulink errors with ‘bool’ operations, which suggests that the c-code standard being used by the compiler is C89/90. I used to have some issues with the PPCTool Compiler not being at ProgramData/dSPACE directory as pointed out in:
Embedded Workflow — acados documentation)

And got it solved here:
faq142.pdf (dspace.com)

However, this compiler does not seem to be running in C99 but in C89/90 (otherwise it would have recognized the missing math.h and ‘bool’ operations, right?).

Could you please confirm please that the compiler that is needed to do a dSPACE integration with MicroAutoBox II is PPCTools Compiler? I think the way it’s written in the guidelines could be a bit misleading by pointing out that QN650_520 could be used as a compiler.

Also, the reason I’m asking for confirmation about the PPCTools Compiler is to be sure that there’s nothing I need to do with QN650_520.

Thanks once again for your time,
Daniel

I asked a person who managed to do it on DS1401 recently.
This is their Toolchain file is pasted in the bottom.

It surely works with C99. There must be some wrong configuration on your side.

I think that part in the documentation is rather clear. It says that you will nee dot adapt and states that that sentence is for DS1202.
Feel free to contribute to the documentation though.

SET(CMAKE_SYSTEM_NAME "dSpaceDS1401")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
SET(CMAKE_SYSTEM_PROCESSOR "ppc")

file(TO_CMAKE_PATH "C:/ProgramData/dSPACE/AD52223F-E7EC-4A16-97FB-8ADC3C426EE0" DSPACE_TOOLS)
set(DSPACE_RTLIB "C:/dSpace_RCPHIL_2018B/DS1401/RTLib")
set(DSPACE_PPCTOOLS "${DSPACE_TOOLS}/Compiler/PPCTools")

# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/mccppc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/mccppc.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_PPCTOOLS}/bin/asmppc.exe)
set(CMAKE_RANLIB ":")

find_program(CMAKE_MAKE_PROGRAM NAMES "C:/dSpace_RCPHIL_2018B/Exe/DSMAKE.exe")

SET(CMAKE_FIND_ROOT_PATH ${DSPACE_PPCTOOLS}) 
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

add_definitions(-D__MABX2__ -D__DSPACE__)

# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -J{DSPACE_RTLIB}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -J{DSPACE_RTLIB}")
set(CMAKE_C_FLAGS "-Ot -Oi -Or -Ox -D_INLINE" CACHE STRING "" FORCE)
# set(CMAKE_C_FLAGS "-D_INLINE" CACHE STRING "" FORCE)

# acados flags
set(BLASFEO_TARGET "GENERIC" CACHE STRING "BLASFEO Target architecture")
set(HPIPM_TARGET "GENERIC" CACHE STRING "HPIPM Target architecture")
set(BUILD_SHARED_LIBS OFF CACHE STRING "Build shared libraries")
set(BLASFEO_EXAMPLES OFF CACHE BOOL "Examples disabled")
set(EXT_DEP OFF CACHE BOOL "Compile external dependencies in BLASFEO")
set(ACADOS_INSTALL_DIR "install" CACHE PATH  "Installation path to ACADOS_INSTALL_DIR")


# import from platform folder
set(CMAKE_IMPORT_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_MODULE_PREFIX  "")
set(CMAKE_STATIC_LIBRARY_PREFIX "")

set(CMAKE_EXECUTABLE_SUFFIX     ".exe")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_MODULE_SUFFIX  ".lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")

set(CMAKE_C_FLAGS "\"-J${DSPACE_RTLIB}\"")

set(CMAKE_INCLUDE_FLAG_C "-J")
set(CMAKE_INCLUDE_FLAG_CXX "-J")

# add_definitions(-D__MABX2__)
remove_definitions(-DLINUX)
remove_definitions(-DOS_WINDOWS)
remove_definitions(-D__LINUX__)

Hello Jonathan,

Thanks for your reply and for taking the time to get this information. We’ve found the problem. The Simulink-to-dSPACE environment that I’m using has End-2-End encryption blocks and algorithms that had a header file with a “bool” definition that was in conflict with the regular “bool” definition found on acados - it was overwriting it -. We’ve managed to sort out a couple of minor errors but we’re currently dealing with this one:

LINKING APPLICATION ...
< lnkppc >
(E) #A0368-D Unresolved external:
   nmpc_constr_h_fun_jac_uxt_zt_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_jac_uxt_zt_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_jac_uxt_zt_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_sparsity_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_expl_vde_adj_sparsity_out (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_jac_uxt_zt_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_jac_uxt_zt (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_expl_vde_adj_n_in (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_expl_vde_adj_work (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_constr_h_fun_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_jac_uxt_zt_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_sparsity_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_expl_vde_adj_sparsity_in (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac_hess_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac_hess_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac_hess_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_jac (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_jac (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_expl_vde_adj_n_out (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_n_in (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_work (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun_jac (first referenced in module: acados_solver_nmpc.o03)
   nmpc_expl_vde_adj (first referenced in module: acados_sim_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_e_fun (first referenced in module: acados_solver_nmpc.o03)
   nmpc_constr_h_fun_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_0_fun_n_out (first referenced in module: acados_solver_nmpc.o03)
   nmpc_cost_ext_cost_fun_n_out (first referenced in module: acados_solver_nmpc.o03)
Errors: 1, Warnings: 0
-- call "C:\ProgramData\dSPACE\AD52223F-E7EC-4A16-97FB-8ADC3C426EE0\Compiler\PPCTools\BIN\lnkppc.exe"  -K0 -QmsA0314 -QmsA0407 -QmeA0307 -QmeA0329 -m..\Six_DOF.map -o ..\Six_DOF.ppc -c _tmp_Six_DOF.lk
LINKING FAILED (1)
MAKE PROCESS ABORTED

As far as I’ve researched, this issue is more on dSPACE’s end but I was wondering if you had any clue about how to solve it?

Thanks once again for your time and patience,
Daniel