views:

91

answers:

3

Hello,

Our team has managed a code base on an embedded big endian CPU for many years (10+). We have generally not bothered to consider endian issues during this development and maintenance of this embedded code.

Soon, we will be moving this code base from a big endian CPU to a little endian CPU.

We are curious if anyone has experience with any particular static analysis or other tools to help with this transition. We did find this useful whitepaper from Intel to help us get started:

http://www.intel.com/design/intarch/papers/endian.pdf

Thanks!

+3  A: 

A colleague at Code Integrity Solutions, Carl Ek, recently wrote an article “Detecting Endian Issues with Static Analysis Tools” for Dr Dobbs: http://www.drdobbs.com/windows/226000073.

Flash Sheridan
@Flash: In Carl's article, I saw discussion of endianess checks, but I didn't see any specific static analysis tool that was configured to run those checks. Did Carl use a specific tool? Can it be named? (Say hello to Carl from Ira, I know him from EA).
Ira Baxter
Yes and I’m not sure; I’ve asked Carl privately.
Flash Sheridan
+2  A: 

Hello Ira! Indeed I didn't mention any specific tools in my article. It was meant to give the reader some thoughts about how to approach the problem. The general rules in the Intel paper are good, however, they are very generic, and thus can miss a lot of specific things that could be enforced in custom-checks for an individual customer's codebase and coding standard rules. Those checks in the Intel paper can be (mostly) implemented in Coverity's Static Analysis SDK and Klocwork's Checker Studio. I'm sure that Semantic Designs' DMS would be extremely effective in this detection as well :). Having extensibility to a static analysis tool is very important: the coding issues can be very subtle and any canned out-of-the-box detection could potentially be very noisy. Having a flow/path-sensitive analysis is also desirable, as endian processing can/is often protected with guards/conditionals based on (possibly) statically analyzable/detectable conditions. --carl

carl ek
thanks. We have some access to Coverity SQS through our corporate parent, I'll have to see what they can do for us... thank you!
M. Esh.
Does the Coverity tool provide flow sensitive analysis? Intraprocedural? Interprocedural?
Ira Baxter
+1  A: 

Klocwork has introduced Endian analysis in its latest release (disclosure: I work there). Full inter-procedural analysis to ensure transformation points exist when sending/receiving from/to network or host. Technical whitepaper here that explains it in some more detail.

http://www.klocwork.com/resources/endian-deadlock-multicore-challenges/

Good luck! -Brendan

Brendan Harrison
good to know, thank you!
M. Esh.