Gavrasm

From Fab Lab Wiki - by NMÍ Kvikan
Revision as of 12:59, 14 August 2014 by LinWan (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Gerds AVR ASseMbler is a program for the commandline. It takes a text file with assembly source code, and encodes it to hexadecimal code, which is the microcontrolers mother thongue. The program is available for Linux, DOS and windows.


Installing

Download it from http://www.avr-asm-tutorial.net/gavrasm/index_en.html

Extract it, and navigate through your shell to the folder containing it. If the gavrasm file sits on your Desktop, you type something like this:

cd Desktop

change permissions so that the file is executable using the chmod command:

chmod 777 gavrasm

(you could also chmod 751 or 755, or whatever, as long as you set the executable bit for your level of access. See this page http://www.ss64.com/bash/chmod.html for more on chmod'ing)

Put it in /usr/bin/

mv gavrasm /usr/bin/

If any of the above steps fail due to insufficient rights, put "sudo" in front of the command when you issue it from the shell.

Now you should be able to start using the gavrasm assembler.


Using

The syntax for gavrasm is straight forward. Using your shell, navigate to your source code file.ASM. Then you send it to gavrasm like this:

gavrasm file.ASM

That should give you a file.HEX which you can go ahead and upload.


Sophisticated use

You can control gavrasms operation with parameters if you want/like/need to. Like this:

Call: gavrasm [-abelmqsw] SourceFile[.asm]

Parameters:
  a: Switch output of ANSI-chars on/off
     default is on (Linux) resp. off (Dos, Win)
  b: Extended error comments for beginners
     default is off
  e: Longer error messages
     default is off (short error messages)
  l: Suppress output of the LIST-file
     default is LIST-file output on
  m: Suppress listing of expanded macros
     default is listing on
  q: No output of messages on the command line (quiet)
     (except: headers and forced messages!)
     default is output on
  s: Output a list of symbols in the LIST-file
     default is no symbol list
  w: Enable wrap-around
     default is wrap-around off
  x: Disable using internal def.inc information
     default is internal information


More on this can be found in the readme accompanying gavrasm, or on Gerds webpage.