I was trying some GCC options and decided see how they affect assembly code generated. I’ve created a simple Python script that parses .s output and put in a human readable way. Suppose the classical Hello World program. The output will be something like:
$ python stats_opcodes.py file
For Cortex-m3 (check previous post):
At my laptop (x86):
Download the script here.
I’ve made some code snippets about assembly inline with GCC. A quick search points to a lot of good documentation.
IBM DeveloperWorks about Inline asssembly for x86 in Linux
Linux Documentation Project HOWTO describing GCC Inline Assembly
The syntax may be confusing, if you don’t understand read the documentation available. Each example are an C function with [...]