2017-11-02 02:28 PM
I am having some debugging issues with Keil uVision5 eval (free) version. Now the STM32F030F4P6 has 16K bytes, and when I compile my program, it is approaching the memory limits. Below is the code size:
Program Size: Code=15524 RO-data=300 RW-data=540 ZI-data=2460
Here is my specific problem. I have two functions:
double GetSingleCellVolt(int cell);
void GetCellVoltArray(double *pa_volt)
{
call GetSingleCellVolt(int cell);
}
Now when I call GetCellVoltArray() by itself, then it always returns 0 regardless.
But if I call GetCellVoltArray() which calls GetSingleCellVolt(), then it works fine.
Now when I step inside the function GetSingleCellVolt(), to debug, the codes seem
to be executed in wrong order. For example, line 4 gets executed before line 3 ....
And there are variables inside GetSingleCellVolt() cannot be viewed because the
debugger complains that the variable is 'not in scope' but clearly the variables are
inside the function.
I don't know if this problem is specific to my case since my guess is my memory
limit is right up to the uC limit or it's something else.
Thanks.
Note: this post was migrated and contained many threaded conversations, some content may be missing.2017-11-03 11:44 AM
Ha Ha: that recently turned up on another manufacturer's forum - with a user shocked at the amount of code his UART initialisation (using their 'HAL') took!!
:(
2017-11-03 11:47 AM
Is it OK to use a 'long int' type variable in my interrupt routine. Basically the 'long int' will get increment everytime a timer expires for time keeping purpose.
2017-11-03 11:50 AM
>>
These variables are not saved in the stack automatically...
On the CM4/CM7 this depends on what you've told the compiler to do, it is certainly possible for interrupts to push the FPU register context although it can be rather expensive.
2017-11-03 11:51 AM
True, people needs to be aware it might be compiler dependent.
2017-11-03 04:17 PM
Everything is most efficiently held as 32-bit values, ie uint32_t, int, long
I would avoid using indexing variables as char or short, they will not save space and will likely be slower.
2017-11-04 11:21 AM
Your one post with the code example was put into moderation at the request of another community member. I have released it. I know the spam filter can be frustrating, however, we had a lot of problems with spam earlier this year so we have to keep some protections in place.
Be well,
Brian