daqIDEA displays strange values, despite appearing correct in the winIDEA
Watch window. Attempts to force data types by using watch expressions fail
to resolve the problem.
The root cause of this problem lies in the alignment of the data and how this data is accessed by the debug system.
Unaligned memory can not be accessed atomically and requires two separate memory accesses. If a value would change between the first and second access —which is likely to happen when using daqIDEA, where the core(s) are running while the data is sampled— the displayed value will be invalid.
To ensure correct data access, all data elements should be naturally aligned. The use of any #pack pragma should be omitted. If the compiler by itself places data on unaligned addresses, you can pad your data structures with unused bytes to achieve correct alignment of the real data (e.g. insert a dummy halfword into the structure).
Only aligned memory placement will ensure atomic access and avoid spurious values.
Sorry this article didn't answer your question, we'd love to hear how we can improve it.
Note: This form won't submit a case. We'll just use it to make this article better.