August 12, 2010 8:21 PM
Very Basic Beginner Assembly Tutorial II: How to Use Gavrasm to compile an .asm flie
by Anna Kaziunas FranceThis tutorial instructs you on how to compile an assembly language file (.asm) into a .hex flie using Gavrasm (Gerd’s AVR Assembler). the .hex file can then be uploaded to a AVR microntroller using Avrdude (or another program.)
Open your command line interface and type:
gavrasm
If Gavrasm is installed you will see (your version number may vary):
+------------------------------------------------------------+ | gavrasm gerd's AVR assembler Version 2.5 (C)2010 by DG4FAC | +------------------------------------------------------------+
You can download and install Gavrasm from here: http://www.avr-asm-tutorial.net/gavrasm/index_en.html.
*Note: if you are running a Mac OS (especially a pre-intel / PPC - Power PC Mac see my tutorial on where to get the compiled Gavrasm for PPC Macs or how to compile it yourself. *
A. navigate to the directory where the file that you want to compile is located.
- if you are unfamilar with unix commands: s To list the files in your current directory type:
ls
To change directory / navigate into a specific listed directory type (where directory name is the name of the directory you want to move to):
cd directoryname
To move upwards in the directory tree structure type”
cd ..
If you know the pathname of the directory that you want - type in the pathname of the directory preceded by “cd”
ex:
cd /Desktop/mydirectory/mydirectory2
you can find more about general unix commands b doing a general internet search.
B. After navigating the correct directory - type:
gavrasm filename.asm
where “filename.asm” is the name of the assembly file you want to compile.
Gavrasm will inform you if there are warnings. For the most part you can ignore the warnings. Ask your Fab Academy instructor if they are something you should be concerned about.
If there are errors in compiling your file - Gavrasm will refuse to create a .hex file and will throw a bunch of error messages at you. Use these error messages to fix the problem.
If you don’t understand them - google the error or look at the datasheet for the microcontroller that you are using. See my tutorial on “Datasheet Tips”. Ask your instructor if you are confused - odds are they have encountered this many times. You must fix the errors in the program before it will compile.
Puppet Master Final Project Page Updated
Shopbot Project - Modular Shelving
Diploma Completion Checklist Update - 08.14.2010
Unsuccessful Modela Troubleshooting - Partially Successful Switch to Roland Vinyl Cutter
Very Basic Beginner Assembly Tutorial III: How to Use Avrdude
Very Basic Beginner Assembly Tutorial II: How to Use Gavrasm to compile an .asm flie
Very Basic Assembly Tutorial I: Where to Get Gavrasm for the Mac OS
Complete and Working --> Modified Hello Echo + Button + FTDI v.2
Modified Hello Echo + Button + FTDI v.2 ---> In Progress
Modified Hello Echo + Button + FTDI v.1
Mantis Hardware / Software Trial Run
First 3D Scans - Modela Scan of Laughing Die and Shell
Interlocking Rings - 3D Printing
MakerBot Cupcake CNC- Assembling the Plastruder mk4 Spindle
Capacitive Sensing - PuppetMaster v.1-v.2
[Revised] Fab Academy Final Project Proposal: PuppetMaster
FabISB Round 2: Stuffing and Programming the Board
Making Programming, Connector and Serial Cables
Final Project Licencing and Distribution
Internet 0 / Zero - Milling, Stuffing & Setting Up the Boards
Spindle Assembly - Mantis Milling Machine
PuppetMaster Final Project Page
Encoded Building Materials with Computer Numerical Control Assembly
Final Project Plan: PuppetMaster Universal Remote
Final project: pinball machine themed on an unfinished opera by Dylan Thomas and Stravinsky
Electronics design and production
The Fabian: an Arduino-compatible, student-friendly board for Fab Labs
Super simple bootstrap 3-axis controller
Breadboard-friendly Attiny45 board
Using a GUI to Control Processing Output with ControlIP5, Firmata via Serial
My favorite python/GTK reference
Fab ISB - Round 1: Milling Out The Board
Completed TARDIS Cast | Working Light