Categories

{{ selectedCategory.name }}

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!

daqIDEA: Issues with unaligned data

08-Jan-2024

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. 


Possible solutions

The root cause of this problem lies in the alignment of the data and how this data is accessed by the debug system.


Atomic access

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.


Memory alignment

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.

Was this answer helpful?

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.

Similar topics

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No similar topics found!

Other topics in the same category

{{ topic.Title }} {{ topic.Ddate | formatDate }}

{{ topic.Content }}

No topics found!