2022-03-12 11:18 AM
I´m using this:
Keil don´t give any error, and compiles, but, when i check the result, it don´t take the operation.
Will I have to do without the operation?
Thx in advance!!!
2022-03-12 11:55 AM
Likely some issue elsewhere with the variables.
Changed under interrupt?
Perhaps you can review a disassembly of the code generated by the compiler?
2022-03-12 02:24 PM
I use the variables in an interruption, does it have something to do with it?
2022-03-12 05:54 PM
Ok, as you say, @Community member , it´s a bug in keil...
2022-03-12 06:52 PM
>> it´s a bug in keil...
Your case is not compelling.
>>I use the variables in an interruption, does it have something to do with it?
Things that should be volatile?
Optimization settings change behaviour?
Anything the pre-processor could be doing?
#defines ?
Can you look at the pre-processor output?
2022-03-14 02:59 PM
I don´t have a concrete answer, if, i do twice last function, it works, i always use global variables.
I use stm studio to check how the variables evolve, past the time, when i do what i say, it works.
I don´t know, how to made the pre processor output, maybe you say, what i do with stm studio?
2022-03-14 03:16 PM
>> i always use global variables.
Ok, but are they volatile? Should be if they change outside of normal program flow.
Unfamiliar with volatile keyword, https://www.geeksforgeeks.org/understanding-volatile-qualifier-in-c/
The compilation process occurs in several stages, the preprocessor deals with # operators, macros, etc. The output from this stage can be directed to a file in lieu of complete compilation, so you can inspect for actual vs desired behaviour.
https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_chr1383664717444.htm
2022-03-21 10:20 AM
No, it´s not volatile. I don´t know if keil is configured to make my code optimized... I don´t modify anything, i use it as default.
2022-03-21 11:44 AM
It's improbable that the compiler is this broken.
You're going to have to debug and diagnose what's really going on, and then fix/address that problem.
Perhaps use fromelf -csd test.axf >test.lst to generate a listing file you can inspect, and review the code generated by the compiler.