How do you convert a c file to assembly in avr-gcc?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In my final question to this site, how would I go about getting the assembly code for a c file inclunding the following includes?

 

#include <avr/io.h>
#include <util/delay.h>

This topic has a solution.

Last Edited: Sun. Aug 2, 2015 - 11:33 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Appears to have worked with 

 

avr-gcc -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -S led.s led.c

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I find that sometimes, the output from "avr-objdump -S led.elf" is more useful.  It's got less debugging noise, and shows fully resolved addresses for symbols that aren't resolved until link-time.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to note about your first post - the .h don't (shouldn't anyway) generate ANY code so you wouldn't see Asm output from those anyway. #include is just a documentation exercise so the C compiler knows how to interface to functions and variables it encounter as it is compiling the C in the file where the #include's are used.