Embedded Coder code optimization toggle output pin TI DSP
Afficher commentaires plus anciens
Hi, I am using Embedded Coder to generate source code for a Texas Instruments DSP out of a Simulink model. As a test, I used Simulink's Constant block (set to '1') and connected this to an output pin block of the target DSP.
The generated C-code which makes the GPIO pin high ('1') is given below:
GpioDataRegs.GPBSET.bit.GPIO32 = (1.0 != 0);
GpioDataRegs.GPBCLEAR.bit.GPIO32 = !(1.0 != 0);
Why not just
GpioDataRegs.GPBSET.bit.GPIO32 = 1;
GpioDataRegs.GPBCLEAR.bit.GPIO32 = 0;
?
Or even better, only:
GpioDataRegs.GPBSET.bit.GPIO32 = 1;
I remember (unable to find it now) that somewhere in the TI documentation it is noted that "writing a '0' to a GPBCLEAR address is completely useless".
I already tried to turn on the code optimization (for fast runs). Is it possible to optimize the code even further? Or do I have to create my own (efficient) blocks to produce fast code?
Joost
Réponses (0)
Catégories
En savoir plus sur Texas Instruments C2000 Processors dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!