How to build C code with simulink including redis methods without compiling ?

3 vues (au cours des 30 derniers jours)
Florian Bosson
Florian Bosson le 26 Juil 2021
Hi everyone,
I have a lot of troubles to code properly a call to a redis function. I have a Beaglebone Blue and I would like to program a part of the firmware with Simulink (graphic interface, complex calculation...).
A program running on the board collect and save datas on a redis server. And I want to write a C code that read thoses data, import them as variables in matlab/simulink, process them and edit them on the redis server. Then Simulink will compile the C code and I will include the C code on the board and compile it.
For this, I downloaded the redis C library and wrote small code with custom C functions. There are a function 'get' to get the value of a variable and a function 'set' to set a value (and a function to initialise the connexion and another to stop it).
____________
I used two (non working) methods :
1 - Use a C function block with my custom functions in Simulink.
But I get an error because Simulink is compiling all instead of just building a C code. So redis miss some headers like Openssl.h that will be compiled at the end on the board, but don't need to be compiled on Simulink. And those files are on the debian distribution on the board. That's why I want to compile the program on the board.
2 - Use the legacy code tool on Matlab.
But it seems that all the structs are unsupported by Simulink. According to forums, it's a limitation of this Simulink's function.
I think that the best way to do is to write a matlab function that updates the inputs values at the start of each step and the outputs values at the end. But I really don't know how to do this at this point.
3 - I tried to use some redis libraries written in matlab, but I need to purchase other addons to run them.
____________
Concerning mathworks, I use Matlab, Simulink, Matlab Coder, Simulink Coder, The BeagleBone blue support addon and the MinGW C/C++ compiler.
(I include all the redis library and matlab function in the attached zip file).
____________
Thank you so much for your help and the time spend to read my problem. I am open to each answer or even a start of solution ?

Réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by