Problem with cross-compiling of acados for DS1401

Hi Bjorn,
I have a question for you: what version of Matlab & dSPACE are you using?
I really don’t understand from where the problem can came from.
Thanks in advance for the patience :slight_smile: :pray:
Giulio

Hi Giulio,

I use the following program versions:
MATLAB R2017b
dSpace 2018b
CMake 3.19.4

Best regards
Björn

Hi @gibor

were you able to solve this? I managed to compile it yesterday with some help of @FreyJo , feel free to bug me about this. I am happy to help.

Cheers,
Alex

I Alex !
Yesterday I finally managed to cross compile acados and then compile my s function for DS1401! :smiley: Soon I will start doing some banchmarking of its performance on the dspace!
Thanks for your time and we keep in touch! :slight_smile:

1 Like

Awesome, happy to hear!
Feel free to share results. :slight_smile:

Alex

Hi,@gibor @AlexWin @bmasterk

In the first step, I finished cross compiling and compile my s function for DS1401:
image

but when I download into the dspace by control desk,it cannot run in hardware:

image

I don’t know how to find the problem.

Thanks in advance for the patience.

Best regards
Gaofei

Hi Gaofei,
I still couldn’t upload the code into dspace/control desk. I will let you know if I have the same problem.
Giulio

Thanks. I hope you can run smoothly.

Hi gibor. It’s happy to hear your success. I meet the similar problem when cross-compile acados for dspace 1401. The versions are Matlab 2016b, dspace 2017 A, and cmake 3.23.1 respectively.
When I run the command " D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “MinGW Makefiles” -S …/ -B ./" in the powershell of windows, I get the similar error:
The C compiler identification is unknown
– The CXX compiler identification is unknown …(and so on)
When I run the command “D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the powershell of windows, I get the following error:
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
– Configuring incomplete, errors occurred!
Do you have any idea about this error? Thanks you in advance

Hi AlexWin. It’s happy to hear your success. I meet the some problem when cross-compile acados for dspace 1401. The versions are Matlab 2016b, dspace 2017 A, and cmake 3.23.1 respectively.
When I run the command " D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “MinGW Makefiles” -S …/ -B ./" in the powershell of windows, I get the similar error:
The C compiler identification is unknown
– The CXX compiler identification is unknown …(and so on)
When I run the command “D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the powershell of windows, I get the following error:
CMake Error: CMake was unable to find a build program corresponding to “Unix Makefiles”. CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
– Configuring incomplete, errors occurred!
Do you have any idea about this error? Thanks you in advance

Hi hanyu,

Did you adjust the compilers in the Toolchain file, like it is stated in the embedded workflow on the acados webpage?
You have to point to the right MABX power pc compilers. Please check all paths in the Toolchain file.
Let me know if you have made any progress!
There might be an actual problem with some kernel code of blasfeo with the latest acados release. But you definitely should be able to compile and buuikd the model.
If you encounter any errors when uploading to MABX, reset acados to a former release (September 2021) with "git reset --hard “commit sha” " commit sha is from the commit on the acados GitHub page. Then do a “git submodule Update” and redo the cross compilation.

Cheers, Alex

Thanks for your patience. I have checked the compiler in the Toolchain file as the stated in acados webpage. Then run the command:“D:\acados_root_folder\buildDS1401> cmake -D CMAKE_TOOLCHAIN_FILE=…/cmake/Toolchain-dSPACEDS1401.cmake -G “Unix Makefiles” -S …/ -B ./” in the windows powershell, I get the following message:


– The C compiler identification is unknown
– The CXX compiler identification is unknown
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/mccppc.exe - skipped
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/mccppc.exe - skipped
– Build type is Release
– ACADOS_WITH_OPENMP: OFF
– The ASM compiler identification is unknown
– Found assembler: C:/Program Files/dSPACE RCPHIL 2017-A/Compiler/PPCTools/bin/asmppc.exe
– Warning: Did not find file Compiler/-ASM
– Using linear algebra: HIGH_PERFORMANCE
– Using matrix format: PANELMAJ
– Using external BLAS: 0
– Testing target GENERIC: assembly compilation [success]
– Testing target GENERIC: intrinsic compilation [success]
– Compiling for target: GENERIC
– Using BLASFEO path:
– Installation directory: install

– Target: BLASFEO is GENERIC, HPIPM is GENERIC
– Linear algebra: HIGH_PERFORMANCE
– Matlab MEX (OFF)
– Octave MEX (OFF)
– Octave Templates (OFF)
– System name:version dSpaceDS1401:
– Build type is Release
– Installation directory is install
– OpenMP parallelization is OFF

– Configuring done
– Generating done
– Build files have been written to: D:/acados_root_folder/buildDS1401


I googled why the cmake shows " The C compiler identification is unknown", and get answers that I need to install Windows 10 SDK in my visual studio 2017. I have tried this solution, but it turns out not to help. And I can compile and build acados model in Matlab.
Thanks in advance for your kindness and patience!

Hey everyone,

I have a similar problem while trying to cross-compile acados for DS1401 and i can’t find the fault. The Installation of acados worked without any problems and I was able to solve acados optimization problems in Matlab as well using the S-Function in Simulink.
Can someone please help me? I am almost in dispair…

First, I adapted the Toolchain-dSpaceDS1401 cmake-file as follows:

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

# TODO: cmake_path instead?
# cmake_path(CONVERT "C:\\ProgramData\\dSPACE\\AD52223F-E7EC-4A16-97FB-8ADC3C426EE0\\Compiler\\PPCTools" TO_CMAKE_PATH_LIST DSPACE_DS1401_COMPILER_DIR NORMALIZE)
# 
file(TO_CMAKE_PATH "C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310" DSPACE_TOOLS)
set(DSPACE_RTLIB "C:/Program Files/dSPACE RCPHIL 2021-A/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:/Program Files/dSPACE RCPHIL 2021-A/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)

# 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__)

After running the cmake command

cmake -D CMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-dSpaceDS1401.cmake -G "Unix Makefiles" -S ../ -B ./

I get the following output - I think it’s the same which hy_lyy got :

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/mccppc.exe - skipped
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/mccppc.exe - skipped
-- Build type is Release
-- ACADOS_WITH_OPENMP: OFF
CMake Deprecation Warning at external/blasfeo/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The ASM compiler identification is unknown
-- Found assembler: C:/ProgramData/dSPACE/7290F786-B6F7-4BA3-9178-C21B0382F310/Compiler/PPCTools/bin/asmppc.exe
-- Warning: Did not find file Compiler/-ASM
-- Using linear algebra: HIGH_PERFORMANCE
-- Using matrix format: PANELMAJ
-- Using external BLAS: 0
-- Testing target GENERIC: assembly compilation [success]
-- Testing target GENERIC: intrinsic compilation [success]
-- Compiling for target: GENERIC
CMake Deprecation Warning at external/hpipm/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using BLASFEO path:
-- Installation directory: install
--
-- Target: BLASFEO is GENERIC, HPIPM is GENERIC
-- Linear algebra: HIGH_PERFORMANCE
-- Matlab MEX (OFF)
-- Octave MEX (OFF)
-- Octave Templates (OFF)
-- System name:version dSpaceDS1401:
-- Build type is Release
-- Installation directory is install
-- OpenMP parallelization is OFF
--
-- Configuring done
-- Generating done
-- Build files have been written to: .../acados/buildDS1401

I don’t know if this is really an error, as I don’t know how this output should look like. But for me it seems like the compiler cannot be found or is incompatible. But the path to the PPCTools compiler is definitely correct.
However, when I run the next command from the Embedded Workflow instructions, I receive the following error:

PS ...\acados\buildDS1401> cmake --build ./
Scanning dependencies of target blasfeo
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_processor_features.c.obj
[  1%] Building C object external/blasfeo/CMakeFiles/blasfeo.dir/auxiliary/blasfeo_stdlib.c.obj
(E) C0513; "...\acados\external\blasfeo\auxiliary\blasfeo_stdlib.c", line 59 pos 7; a value of type "int" cannot be assigned to an entity of type "void *"
        *ptr = _aligned_malloc( size, CACHE_LINE_SIZE );
             ^

1 Error     2 Informationals (2 suppressed)

OPUS MAKE: Shell line exit status 1. Stop.

OPUS MAKE: Shell line exit status 3. Stop.

OPUS MAKE: Shell line exit status 3. Stop.

So if any of you did have the same errors and solved them or can tell me more about the errors, please help me. I would be very thankful!

Thanks in advance,
Jasper

Hi @jasper_fr and @hy_lyy ,

@FreyJo and me were thoroughly testing the dSPACE Toolchain with the newest acados release and were fixing some memory alignment and cmake errors, whose fixes have been now pushed to the main. Can you pull the latest acados and retry?

@hy_lyy this message is totally normal. Just continue with the build then and try that one! It actually looks good.

FYI: The MABX2 is like 20 times slower than my i7 laptop CPU.

let me now if you have any problem,
Alex

1 Like

Short update:

There is one issue with BLASFEO, which I addressed here: use CMAKE_SYSTEM_NAME instead of CMAKE_HOST_SYSTEM_NAME to set OS specific flags by FreyJo · Pull Request #160 · giaf/blasfeo · GitHub
All other fixes are already on the acados master branch.
The current acados/master with this BLASFEO version was tested successfully on the MABX2 by @AlexWin

Once this is merged, I will also make a new acados release and post here again.

2 Likes

Hey @AlexWin and @FreyJo,

thank you for your answers and help!

With the BLASFEO pull request #160 the cross-compile process worked fine for me and I was now able to build my acados MPC model from simulink.

I’m excited how this will work on the MABX :blush:

Thanks again,
Jasper

1 Like

Hi @jasper_fr,

just curious, is it working?

Alex

Hey Alex,

the compiling is working, but another problem came up when i tried to load my application on the MABX. There is an undefined Error ID 0x2712 (see screenshot below) and thus i have no real time data in ControlDesk.

I am already in contact with dSPACE Support. At first glance they could not help me but they did have a similar support request a few weeks ago. After sending them my application files, i hope the problem can be solved…

Kind regards,
Jasper

Hi jasper,

that error codel looks a bit different than the one we had (might actually be the one request dspace is talking about). You are on the latest acados release?
Looks more like a dSPACE Bug though…

Good luck! Please let us know if that has anything to do with acados.
Alex

Yes, I’m on the latest acados release and on blasfeo PR #160. I hope that dSPACE can help me quickly with the error message…
Do you know if there is any log file created by ControlDesk? It would make the troubleshooting much easier to know from which function or in which step the error is thrown.

Cheers, Jasper