cancel
Showing results for 
Search instead for 
Did you mean: 

KEIL debug issues with STM32F030F4P6

Vu.Andy
Associate III
Posted on November 02, 2017 at 22:28

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.
25 REPLIES 25
Posted on November 03, 2017 at 18:44

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!!

:(

Posted on November 03, 2017 at 18:47

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.

Posted on November 03, 2017 at 18:50

>>

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 03, 2017 at 18:51

True, people needs to be aware it might be compiler dependent.

Posted on November 03, 2017 at 23:17

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on November 04, 2017 at 18:21

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