Hi
I am trying to use acados with the MABX III DS1403 dSPACE Release Version 2022-A and MATLAB Version 2021b. I used the getting started example (pendulum) and tried to implement it onto the MABX III. The Simulink simulation works fine. After code generation, I use the created .sic file as a model in ConfigurationDesk. I also added the libraries from the (buildDS1403\install\lib) path as well as the (buildDS1403\install\include) paths to the custom code (CustomLibraries/SearchPaths) in ConfigurationDesk for the build configuration. I need to build the model in ConfigurationDesk since my application is using all four cores of the MABX III, and therefore, I have four different models. During the build process (compiling the .c function), I get lots of errors. Most of them are:
acados_mex_create_pendulum.c: In function 'mexFunction':
acados_mex_create_pendulum.c:102:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
102 | l_ptr[0] = (long long) nlp_plan;
main_mex_pendulum.c: In function 'mexFunction':
main_mex_pendulum.c:77:14: error: too few arguments to function 'pendulum_acados_create'
77 | status = pendulum_acados_create();
In file included from main_mex_pendulum.c:39:
acados_solver_pendulum.h:160:38: note: declared here
160 | ACADOS_SYMBOL_EXPORT ocp_nlp_config *pendulum_acados_get_nlp_config(pendulum_solver_capsule * capsule);
main_pendulum.c: In function 'main':
main_pendulum.c:135:5: error: implicit declaration of function 'd_print_exp_tran_mat' [-Werror=implicit-function-declaration]
135 | d_print_exp_tran_mat( NX, N+1, xtraj, NX);
I have tried different toolchains, but all lead to the same issue. What I found out from dSPACE Support is that in 2022-A, a new compiler is being used (64-bit Linux-Compiler (GNU C/C++ Compiler Ver. 10.3)) compared to, for example, 2020-B (32-bit). Can this lead to the mentioned errors?
Also as mentioned on a different Topic ( Compiling Acados for Microautobox 3) the new compiler doesnt accept -J as a Flag therefore I used as mentioned in the topic -I.
The toolchain that I am using right now is:
SET(CMAKE_SYSTEM_NAME "dSpaceDS1403")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
SET(CMAKE_SYSTEM_PROCESSOR "ppc")
file(TO_CMAKE_PATH "C:/dSPACE_RCPHIL_2022A" DSPACE_TOOLS)
set(DSPACE_RTLIB "${DSPACE_TOOLS}/DS1403/Lib")
set(DSPACE_COMPILER "${DSPACE_TOOLS}/Compiler/Linux_4_14_GCC_10_3/target/arm-linux-gnueabihf")
# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-gcc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-g++.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_AR NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-ar.exe)
find_program(CMAKE_OBJCOPY NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-objcopy.exe)
set(CMAKE_RANLIB ":")
find_program(CMAKE_MAKE_PROGRAM NAMES "${DSPACE_TOOLS}/Exe/DSMAKE.exe")
SET(CMAKE_FIND_ROOT_PATH ${DSPACE_COMPILER})
# Compiler flags
##set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -I{DSPACE_RTLIB}")
##set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -I{DSPACE_RTLIB}")
##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_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# 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__)
The different Toolchains that i have tried so far aswell are:
SET(CMAKE_SYSTEM_NAME "dSpaceDS1403")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
SET(CMAKE_SYSTEM_PROCESSOR "ppc")
file(TO_CMAKE_PATH "C:/dSPACE_RCPHIL_2022A" DSPACE_TOOLS)
set(DSPACE_RTLIB "${DSPACE_TOOLS}/DS1401/RTLib")
set(DSPACE_COMPILER "${DSPACE_TOOLS}/Compiler/Linux_4_14_GCC_10_3/target/arm-linux-gnueabihf")
# C Compiler
find_program(CMAKE_C_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-gcc.exe)
# C++ Compiler -- not used
find_program(CMAKE_CXX_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-g++.exe)
# Assembler
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
find_program(CMAKE_ASM_COMPILER NAMES ${DSPACE_COMPILER}/bin/arm-linux-gnueabihf-as.exe)
set(CMAKE_RANLIB ":")
find_program(CMAKE_MAKE_PROGRAM NAMES "${DSPACE_TOOLS}/Exe/DSMAKE.exe")
SET(CMAKE_FIND_ROOT_PATH ${DSPACE_COMPILER})
# Compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -H -I{DSPACE_RTLIB}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -H -I{DSPACE_RTLIB}")
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_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# 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__)
Thanks in advance for any support and Greetings
Sören