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.
Just a small tip to test code generated for ARM Cortex-M3 using QEmu:
$ arm-none-eabi-gcc main.c -ggdb -mcpu=cortex-m3 -mthumb -T generic-m-hosted.ld
$ qemu-arm -cpu cortex-m3 ./a.out
You can download Code Sourcery toolchain here and QEmu here (also available from package management system of your favorite Linux distribution). Just unpack the toolchain associating the arm-201XqX/bin with your $PATH and run qemu.
O blog do Jê foi um dos canais brasileiros que anunciou o concurso promovido pela Texas Instruments e a revista Circuit Cellar. Como sempre tive curiosidade nos microcontroladores de 32bits da ARM resolvi me inscrever no concurso para receber o KIT. Com uma proposta semelhante (mas sem o concurso) a NXP, a um tempo atrás, [...]
After drawing a sketch for BeagleBoard this week I coud try something real. The board fit perfectly inside the box.
The whole for DVI-D would be a little bigger, the way it is the user need stick the connector well to don’t loose image quality.
The entries for USB and MMC fits together in the same whole. I put [...]
In the book about Linux Kernel Programming the author Robert Love demonstrated a trick to check your hardware endianness.
int x = 1;
if (*(char *)&x == 1)
/* little endian */
else
/* big endian */
Using GCC you can use -mbig-endian or -mlittle-endian to generate appropriate endianess. Remember to check man pages section on your architecture (i.e: i386 and [...]