Monday, 1 September 2014

How create an assembler listing of your LPC810 project with LPCXpresso

I discovered this little gem today, often it is required to see what the actual code the C compiler is creating  looks like in assembler, you may  for instance want to find out how many clock cycles a particular routine takes or try to optimize the resulting assembly. You can do this automatically if you place a line like the one below in the Post Build Steps section.

arm-none-eabi-objdump  -d   src/<file1.o> src/<file2.o> "${BuildArtifactFileBaseName}.asm" 

The Post Build Steps can be found at

My Project -> Properties -> C/C++ Build -> Settings -> Build Steps

The objdump command will generate an assembly with C source listing file, just include the object files you require to be dissembled in the file list.

For example you could use this line to generate a disassembly listing of both main.c and cr_startup_lpc8xx.c 

arm-none-eabi-objdump  -d   src/main.o src/cr_startup_lpc8xx.o  > "${BuildArtifactFileBaseName}.asm"