Is there a manual for GCC ASM?

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It seems there are two assemblers for AVR's - an older one and perhaps a newer one that is gcc based?  Is this correct?

 

Also, the .def statement doesn't work in AS7 - it is using #define and #include.

 

Is there a manual that covers this gcc ASM?

 

Is there a comparison between old and new commands?

Last Edited: Mon. Mar 8, 2021 - 01:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Atmel assembler was made by Atmel themselves, it got some improvements thank to naggings from people like me and ASM2 was born. devil

 

The GAS (GCC assembler) is part of the C package I guess, manual here https://sourceware.org/binutils/...

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The document here:

 

https://sourceware.org/binutils/...

 

Does not talk about #include, but does talk about .DEF.  I created a .S file to assemble in AS7 and .inc/.def will not work, but #include does work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  Also, the .def statement doesn't work in AS7 

You better try again....have used .def  many times in studio7 asm2 ...are you ONLY trying to use GCC?  asm2 works fine for small projects

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have to decide which assembler you want to use, the 2 are not very compatible.

 

The help file for the Atmel assembler in included into Studio, you may need to install it I think.

 

EDIT and I think GAS is case sensitive so .DEF is not the same as .def

 

EDIT #2 A GAS project needs to be treated as a C project not as an ASM project directly assemble-able by Studio as if it were an Atmel ASM2 project.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Mon. Mar 8, 2021 - 03:52 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR Assembler (Microchip)

...

The AVR Assembler is the assembler formerly known as AVR Assembler 2 (AVRASM2)

...

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You have to decide which assembler you want to use, the 2 are not very compatible.

 The GNU Assembler (GAS) is a sort of generic assembler aimed at working with MANY CPU architectures.  The "peripheral" parts of the assembler (directives, macros, etc) remain the same going from x86 to 68k to ARM to AVR, and you get "some" customization of the actual instruction parsing.   That's somewhat nice, but it also means that an assembly language program written per the Vendor-specified assembly language is seldom compatible with using GAS instead :-(

 

 

I created a .S file to assemble in AS7 and .inc/.def will not work, but #include does work.

 It's usual for a .S file, assembled with the "gcc" command, to invoke the C Preprocessor (CPP) before passing the program on to the actual assembler.  CPP processes #include, and all the other usual #xxx directives, so you get both CPP Macro processing AND the assembler macro processing and directives.   GAS has a ".include" directive.

Convention has it that .s files (lowercase) do not get CPP pre-processing.

 

GAS has a ".def" directive, but it doesn't do what .def in the Atmel assembler does. :-(

See .set, .equ, .eqv, and =

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks guys; this explains it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

alank2 wrote:
Does not talk about #include,
That is not done by the assembler. The difference in GCC between .s and .S files is that the former are passed straight to the assembler (so #include/#define does not work). The latter are first passed to the preprocessor (the same thing used for C and C++) and then the result of that is passed to the assembler. So if you want to know about #include etc. then you need to read the manual for the GCC preprocessor:

 

https://gcc.gnu.org/onlinedocs/cpp/

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

+1   learned something

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that on some filesystems, a .s file can also be read with a .S suffix and vice-versa.

In such cases, what matters is the name given to the assembler.

Moderation in all things. -- ancient proverb