Search code examples
assemblymicrocontrolleravr

avra assembler -- pragma?


I would like to use a simple assembler compiler for AVR MCU under Linux. I generally don't prefer the full complete development environment for MCUs (like AtmelStudio under win). E.g.: I wrote a small C program under Linux to send bytes via parallel port to flash and eeprom memory of AVR chip in ISP mode. Now I would like to find a simple assembler under Linux and at the moment I wouldn't prefer any workaround as like C compiler or Atmelstudio under win or virtual machine in Linux. Now I tried avra under my fresh lubuntu.

apt-get install avra
avra -l test.lst -o test.hex test.asm
AVRA: advanced AVR macro assembler Version 1.3.0 Build 1 (8 May 2010)
Copyright (C) 1998-2010. Check out README file for more info

Pass 1...
/usr/share/avra/tn45def.inc(44) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(48) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(53) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(54) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(646) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(647) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(648) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(649) : PRAGMA directives currently ignored
Pass 2...
/usr/share/avra/tn45def.inc(44) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(48) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(53) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(54) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(646) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(647) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(648) : PRAGMA directives currently ignored
/usr/share/avra/tn45def.inc(649) : PRAGMA directives currently ignored
done

Used memory blocks:
   Data      :  Start = 0x0060, End = 0x007F, Length = 0x0020
   Code      :  Start = 0x0000, End = 0x0000, Length = 0x0001
   Code      :  Start = 0x0020, End = 0x0045, Length = 0x0026

Assembly complete with no errors.
Segment usage:
   Code      :        39 words (78 bytes)
   Data      :        32 bytes
   EEPROM    :         0 bytes

ls -ltr test.*
-rw-rw-r-- 1 laci laci  875 okt   21 22:14 test.asm
-rw-rw-r-- 1 laci laci    0 okt   21 22:15 test.cof
-rw-rw-r-- 1 laci laci  415 okt   21 22:15 test.obj
-rw-rw-r-- 1 laci laci 2005 okt   21 22:15 test.lst
-rw-rw-r-- 1 laci laci  264 okt   21 22:15 test.hex
-rw-rw-r-- 1 laci laci   13 okt   21 22:15 test.eep.hex

cat test.hex
:020000020000FC
:020000001FC01F
:100040000FE50DBF01E00EBFF0E0E6E709D0B0E03C
:10005000A0E6A10F85918C93AA951A95DCF70895D7
:10006000FF93EF9310E08591803011F01395FBCF53
:10007000EF91FF910895537472696E6720746F2039
:0C0080006265207265766572736564002D
:00000001FF

So it looks like that Intel Hex output was generated without any error. I don't know that was only a warning related to PRAGMA directives and I can use this compiler for any more complicated source or I have to find other assembler for AVR mcu under Linux ? Here is some problematic line from device def file : "/usr/share/avra/tn45def.inc".:

#pragma partinc 0
#pragma AVRPART ADMIN PART_NAME ATtiny45
#pragma AVRPART CORE CORE_VERSION V2
#pragma AVRPART CORE NEW_INSTRUCTIONS lpm rd,z+
#pragma AVRPART MEMORY PROG_FLASH 4096
#pragma AVRPART MEMORY EEPROM 256
#pragma AVRPART MEMORY INT_SRAM SIZE 256
#pragma AVRPART MEMORY INT_SRAM START_ADDR 0x60

I tried to understand something from the AVRFREAKS link: http://www.avrfreaks.net/forum/problems-attiny261-v2-or-avra-130-osx-update it looks like that Atmel's include file is maybe newer one that the compiler could understand. What could be a simple AVR assembler under Linux?


Solution

  • The solution is gavrasm (up to date and open source and works fine).

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