Calling External C Functions in Simulink With XMC Library For Embedded Coder

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User14335
Level 1
Level 1
Hi all,


I would like to call an external C function during initialisation of the C code generated by Simulink.

The code is generated successfully and I can see that the function is added in the generated C code. However, there are errors when I tried to build it.
I found that my .c file which contains the function I would like to call have not been compiled during the build process.
It seems that the XMC Library Toolbox does not handle the settings I added in the Model Configuration Parameters.

To do this, I added the function in the location below in my Simulink model:
Model Configuration Parameters > Code Generation > Custom Code > "Insert custom C code in generated:" > Initialize function

I also added the include directories in:
Model Configuration Parameters > Code Generation > Custom Code > "Additional Build Information:" > Include directories

And also my .c source file in:
Model Configuration Parameters > Code Generation > Custom Code > "Additional Build Information:" > Source Files

Does anyone know how a external C function can be added in the Simulink model? Or if XMC Library for Embedded Coder supports calling external C function?


Thanks,
Marco


MCU used: XMC4800
MATLAB Version: R2016a
XMC Library for Embedded Coder version: 2.0
Other toolbox installed:
- MATLAB Coder
- Simulink Coder
- Embedded Coder
- Embedded Coder Support Package for ARM Cortex-M Processors
0 Likes
0 Replies