TI C2000 code generation generates double data type functions instead of single ones
Mostrar comentarios más antiguos
Hi MATLAB!
I have the following problem which I have not solved yet. Currently I am using a F28379D and F28069M Launchpads, but I think my problem is related with C2000 MCUs.
I am using Embedded Coder and TI C2000 Hardware Support package to generate C code from my models. To test the code generation I made the following model:

Simply I am blinking a led, and calculating the sin cos of 1Hz counter. In the Configuration reference the default settings for these Launchpads are the TI C28x Code replacement library and C89/90(ANSI) setting for Standard math library.

After generating the code from this model I got the following for the sin cos functions. It can be see,and thanks to the ANSI math lib, that these are double argument functions, which I don't think are the best chose for a single precision MCU.

TI C28X with C99 extension also is an option for the code generation, but the functions remain double ones.


After this I have tried to switch to C99 (ISO) math library, but this is not supported with none of the TI C28X code replacement libraries.

The only option to eliminate the double precision functions is to select none of the code replacement libraries, and setting the Standard math library to C99.


My question is that, can I use anyway C99 math library to obtain for example sinf() instead if sin(), with one of the C28X Code Replacement libraries or not? Is it worth to use any of the TI C28X Code replacement libraries?
Respuesta aceptada
Más respuestas (1)
Venkatesh Chilapur
el 5 de Mzo. de 2019
2 votos
Hi,
Please note that the CRL we support are meant to be used for fixed point math. These CRL's don't support float operations.
The reason error pop's up for C99 extension is because the TI compiler is not fully ready to support this extension. Here is a link on the C99 support in TI compilers.
For float, the TI Math libraries support the implementation of the float operations.
However, you may need to have CRL and C99 extension in the same application. For this, we can provide a p-code file that can help overcome the error.
The attached "rtwTargetInfo.p" file from zip can be replaced at path:
'C:\ProgramData\MATLAB\SupportPackages\R20xxy\toolbox\target\supportpackages\tic2000_base\crl' after taking backup of old file.
You also need to add the compiler flag --c99 to enable support for C99 constructs. Please note, there could be implications of enabling the C99 option and could cause compiler issues like error or warning. So please enable this option with care.
Regards,
Venkatesh C
Categorías
Más información sobre Texas Instruments C2000 Processors en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!