avra汇编程序 - pragma?

时间:2017-10-22 16:21:08

标签: assembly microcontroller avr

我想在Linux下为AVR MCU使用一个简单的汇编程序编译器。 我通常不喜欢MCU的完整开发环境 (比如AtmelStudio胜利)。例如:我在Linux下编写了一个小型C程序 通过并行端口将字节发送到AVR芯片的闪存和eeprom存储器 在ISP模式下。 现在我想在Linux下找到一个简单的汇编程序 我不会像C编译器或Atmelstudio那样喜欢任何解决方法 在Linux下的win或虚拟机下。 现在我在新鲜的lubuntu下尝试了avra

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

所以看起来Intel Hex输出是在没有任何错误的情况下生成的。 我不知道这只是与PRAGMA指令有关的警告,我可以使用 这个编译器适用于任何更复杂的源码,或者我必须找到其他的 Linux下的AVR mcu汇编程序? 以下是设备def文件中的一些有问题的行:" /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

我尝试了解AVRFREAKS链接中的内容: http://www.avrfreaks.net/forum/problems-attiny261-v2-or-avra-130-osx-update 看起来Atmel的包含文件可能是编译器可以理解的更新版本。 什么可以是Linux下的简单AVR汇编程序?

1 个答案:

答案 0 :(得分:0)

解决方案是gavrasm(最新和开源,工作正常)。

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