🎉 We're happy to announce new public releases 🎉

  • SmartCode v10.4r1 - Take advantage of all the benefits our tools have to offer and build your applications with the latest version
  • TriCore v6.3r1 Inspector v1.0r8 - Save time and detect known issues before they get into your application
Contact us to get access

daqIDEA: Issues with unaligned data

28-Aug-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 changes 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. 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?