C function in Simulink not found by MinGW compiler

Hello,
I am currently programming a C2000 (TI Delfino F2833) microcontroller and trying to embed C code in my Simulink model.
Toolchain:
  • Matlab/Simulink R2018b
  • MATLAB Support for MinGW-w64 C/C++ Compiler
  • Embedded Coder Support Package for Texas Instruments C2000 Processors
I followed the instruction from Matlab (here) and as long as I only simulate the programm, everything works. However, when I want to deploy the model on my hardware, it does not work anymore. The diagnostic output is pretty long, so I won't post it full size, but the critical points are these:
"foo.c", line 34: warning: function "bar" declared implicitly
and later:
<Linking>
undefined first referenced
symbol in file
--------- ----------------
_bar foo.obj
error: unresolved symbols remain
error: errors encountered during linking; "../foo.out" not built
Note, that foo.c/foo.h are my class and header files while bar is the function I want to call.
I see that the compiler has problems with finding the right files respectively he does not know my C function in first hand. But how do I resolve this problem?

5 commentaires

Have you extended the same settings to your code generation target ?
if you do not specify the "custom code" options there, the simulation will work, but the deployed app won't get built.
I think so, at least it looks like that:
I have nothing written in the other tabs, but this is how it is in the Simulink tutorial, or do I have to make some custom settings to use it with Embedded Coder fo TI boards?
riccardo
riccardo le 9 Déc 2020
Modifié(e) : riccardo le 9 Déc 2020
That is the "Simulation Target".
You should try and replicate the same in the corresponding "custom code" panes under "Code Generation" settings, I think. May be you could add the location folder(s) as well/instead.
Otherwise source code for your TI target will not consider your custom code files.
There may be other ways to achive the same (e.g. customising the embedded coder target TLC file), but hopefully that should be enough.
You could check if it does the job by editing the build batch file and makefile - to see if the custom code files have been picked up.
Thank you, that was the key!
Since you wrote the answer in a comment, I cannot mark this as accepted answer, but regard the question as resolved ;)
You are right: I'll copy that to the "answer" window: might be helpful to someone else as well.

Connectez-vous pour commenter.

 Réponse acceptée

riccardo
riccardo le 10 Déc 2020

0 votes

That is the "Simulation Target".
You should try and replicate the same in the corresponding "custom code" panes under "Code Generation" settings, I think. May be you could add the location folder(s) as well/instead.
Otherwise source code for your TI target will not consider your custom code files.
There may be other ways to achive the same (e.g. customising the embedded coder target TLC file), but hopefully that should be enough.
You could check if it does the job by editing the build batch file and makefile - to see if the custom code files have been picked up.

Plus de réponses (0)

Produits

Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by