S-Function fails Simulink Compile Check

Hey guys,

my ACADOS NMPC is running in a simulink model, giving good outputs.
It fails the Simulink Mex Compile Check with lots of undefined reference errors (acados-create, etc)
Are the S-Functions made by acados not intented to use for compiling on embedded systems?

Do I need to compile a certain library seperately to make it run?

Greets,
Alex

Hi Alex,

what did you change with respect to your post here?

You write there that you “isolated the S function”, but I am not sure what that means.
acados_create is defined in the rendered acados_solver.c file.

Thinking again about your other post:

I think the S-function might need additional declarations of the global data of the solver, i.e. these lines:

// ** global data **
// acados objects
extern ocp_nlp_in * nlp_in;
extern ocp_nlp_out * nlp_out;
extern ocp_nlp_solver * nlp_solver;
extern void * nlp_opts;
extern ocp_nlp_plan * nlp_solver_plan;
extern ocp_nlp_config * nlp_config;
extern ocp_nlp_dims * nlp_dims;

Greets,
Jonathan

Hey @FreyJo,

sorry for the late reply.
I actually had some misunderstandings, I didnt know which source files and libs I had to implement. That was the reason I was creating these errors.

I am now trying to get the three libs compiled for my 32 bit scalexio system so I dont get “undefined references” errors anymore.
Right now I am struggling hard to compile the blasfeo library. Is there any way to create it from the acados folders with those cmake files?

Thanks for your help,
Greets, Alex

Hi @AlexWin,

I dont know your scalexio system.
Does this system actually use a 32 Bit CPU?
Because there are known issues of acados with 32 Bit architectures.
See

and

Best,
Jonathan

Hi @FreyJo,

good one, the scalexio uses 32 Bit C Code compiled by Opus Make, but the CPU itself is 64 bit. I will try it, just need to get the libraries compiled.

Thanks for yours answer,
greets, Alex

That’s great!
I think the compilation of the libraries using CMake should work in the same way as on your Laptop.

Good luck!

Hi @FreyJo and @all,

unfortunately this workaround (https://github.com/acados/acados/pull/109) doesnt work anymore with newer Versions of dSpace Configuration Desk.

The target compiler is QNX 3.0 with OPUS Make and x86_32 (Sclaexio Rt System).
I cant get this done, the dSpace Support doesnt have a proper solution besides rebuilding the makefile by hand in their makefile syntax.

I am stopping this developement now since I dont have the time anymore. I cant get the blasfeo and hpipm libraries working on the dSpace Sclaexio.
Its not a problem of 32 Bit or 64 Bit, only about binary incompatibility of the target language compiler and missing makefile workarounds / toolchain-files.

Greets, Alex

Following a hint from dspace support I successfully cross compiled the libraries (If anyone needs the toolchain file, feel free to contact me).

Now I have problems with the blasfeo c code, since the code has only been optimized for the dspace Autobox - next to “normal” system architectures like windows. I get errors regarding the missing <brtenv.h> of the scalexio, the timing files and at the memory allocating.
@FreyJo, @giaf what would you think, how long would it take to get those things changed to the Scalexio architecture? Are you interested in this topic?

I have to finish my thesis soon, so I would appreciate a recommendation. :slight_smile:

Thanks a lot, greets,
Alex

Hi Alex,

regarding BLASFEO, if you use the generic target, it is almost completely self contained C code so there should be little to no issues in porting to any architecture.

In particular, you can start by turning off the EXT_DEP flag, that is e.g. here



This flag allows the use of some additional routines for printing and memory allocation, which are not strictly necessary and can be safely removed.
This should already fix most of your issues.

If a few are still there, it should be easy for you to go though the source code and replace e.g. missing headers with the ones provided by your embedded toolchain, or comment out print-and-exit for not-yet-implemented routines (which are most likely not used anyway in HPIPM/acados).
Again, the core of BLASFEO with generic target is essentially self contained C code.

Cheers,

Gianluca

1 Like

Thanks alot @giaf, I will try that out as soon as I can.
Greets, Alex

@giaf you are my hero. Its working, I just cant believe it. Two months ago I did not know anything about C Code and Compilation. You guys helped a lot, thanks, especially to @FreyJo, @DennisWeir and ofc @giaf

1 Like