Tool/software:
Hi,
We are facing challenges to fit our control code into the time frame of the interrupt routine.
Some background information:
1. We only use one Interrupt Routine in our firmware.
2. Everything in the interrupt routine is put in 'Ramfunc' to speed things up.
3. The firmware is written in C.
4. The compiler we use is TI V22.6.1.LTS.
5. The optimization level is configured at '3 - Interprocedure Optimizations'.
6. The Speed vs size trade-offs is set at '2'.
7. The Floating point mode is configured as 'relaxed'.
8. Allow reassociation of FP arithmetic is set to be ' ON'.
9. MCU we use is TMS320F28P550.
Here is something we don't understand and doesn't seem to be logical to us.
We have some calculations among constants that are performed during run time.
for example:
#define CONSTANT_ONE 10.0f
#define CONSTANT_TWO 20.0f
float variable = 5.0f;
In ISR routine, we have code like this:
......
float result = variable * CONSTANT_ONE * CONSTANT_TWO;
We know that the compiler nowadays is intelligent enough to optimize constant multiplying constant during compiling time. But we still chose to change our code to the following anyway:
#CONSTANT_THREE 200.0f
......
float result = variable * CONSTANT_THREE;
What made us confused was, by doing this kind of cleanup, the ISR time consumption actually went up, instead of remaining the same or going down.
It just doesn't make sense logically to us.
We must miss something here or mis-understood how the C compiler work here.
Please help us understand what may be going on.
Thank you,
Frank