2020-03-19 01:31 AM
My problem is the following, when I declare new globales variables depending the types, there are some executions as an ADC convertion for example, which make more time to be executed and the result is incorrect (65535).
I wonder if there is limitation on the data embeded into an application, on the stack of execution and how to find out the problem.
I have tried to declare long or unsigned long and the behaviour is different! With the signed long the behaviour is correct and with the unsinged long I am in front of the problem.
I have tried to compare .map file to see if the memory allocation is changing. Of course it is changing but I am not able to understand the difference and how to interprete the issue.
I have not compilation problem at all.
The memory use show me :
So I am a bit confuse why this such behaviour happens!
Should I configure something in my settings in order to avoid such behaviour?
Your comments are welcome. Thank you in advance.
Julien
2020-03-19 03:26 AM
Using DMA requires correct volatile and memory barrier usage. The HAL library does neither, so the results are unpredictable when any compiler optimization is in effect.
Switching all optimizations off (-O0) might help, but severely impact performance.
Check every line of your software for possible buffer overflows, incorrect volatile or pointer usage.
Check all interrupt handlers and callbacks that they do only atomic variable accesses, and call only functions that are explicitly documented as safe to call from interrupt handlers (HAL functions except the handlers are not).