We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Recently I ran into a problem with printf(). Right away I noticed that the firmware was caught in a function named os_error(). In the function the comments state to look at RTL.h to for error codes. However, the error code that I have 0x48=72 is not listed.
What is the best way to find out what error 72 is?
I am using MDK-ARM 4.11 for my toolchain.
Optimization = Level 0 (-O0). The local variable or the parameter is used.
It seem that maybe the debugger is assume that the local variable is placed in register but this register is used for other things also. (Maybe it fixed in newer versions).
It is common for optimizing compilers to place parameters and local variables in registers, and then reuse the registers as soon as the original value is not needed anymore.
That means that a debugger may correctly display the parameter or local variable for some of the source code lines, but then suddenly start to display completely different values for other lines of the source code.
In short - never expect the debugger to be able to display correct values for parameters and local variables when debugging an application compiled with optimization. Your best bet is to look at the variable contents when the current execution is on a source line that makes use of the variable - except of course that the execution order can have been changed, making the debugger jump up and down in the source file.