Adafruit is open and shipping! Let's build back better, together!
0

Learning AVR assembly: tools and resources?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Learning AVR assembly: tools and resources?

by A. Square on Thu Mar 20, 2008 5:26 pm

I'm interested in taking the plunge and starting to learn assembly for my AVRs. For now, I'm more interested in reading through compiled code (both from the Arduino environment and C code compiled using avrgcc) to understand what's going on, and to optimize speed; I figure that will be a nice introduction to eventually programming routines in assembly, if I ever need to.

Can anyone suggest resources for learning, and what tools I might want to use to do it? Things that can run on OS X are especially appreciated! (ladyada, I know you're an OS X user; any recommendations?)

Are there any disassemblers/decompilers that will be useful, or do I have to go through the hex line-by-line?

Thanks!

Jonathan
A. Square
 
Posts: 41
Joined: Mon Dec 17, 2007 12:51 pm

by cell on Thu Mar 20, 2008 5:41 pm

the avr manual (and some of the app-notes) feature code snippets in both C and assembly.

cell
 
Posts: 44
Joined: Fri Nov 02, 2007 9:24 am

by cell on Thu Mar 20, 2008 5:44 pm

actually, you will probably never need to write an entire project in assembly.

what you probably want is to be able in insert inline chunks of assembly into your c code.

http://www.nongnu.org/avr-libc/user-man ... e_asm.html

cell
 
Posts: 44
Joined: Fri Nov 02, 2007 9:24 am

by darus67 on Thu Mar 20, 2008 5:47 pm

Given the right set of command line options, you can get GCC to just generate assembly code files from the C source.

That seems easier than decompiling the object or hex files.
"He's just this guy. You know?"
darus67
 
Posts: 246
Joined: Wed Sep 26, 2007 10:25 pm
Location: Minnesota, USA

by A. Square on Thu Mar 20, 2008 6:35 pm

cell wrote:the avr manual (and some of the app-notes) feature code snippets in both C and assembly.


I've seen the code snippets, but I guess I'm looking for more of a command and language reference.

darus67 wrote:Given the right set of command line options, you can get GCC to just generate assembly code files from the C source.

That seems easier than decompiling the object or hex files.


I didn't realize GCC would do that, and that is great for projects written in straight C. However, for looking at Arduino code a disassembler might be the easiest way. This disassembler, which even has a precompiled OS X binary, looks like it might be just the ticket.

Thanks for the suggestions, and, of course, more references and tools are always appreciated.
A. Square
 
Posts: 41
Joined: Mon Dec 17, 2007 12:51 pm

Please be positive and constructive with your questions and comments.