Problem making AVR assembler work in the Arduino IDE

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

 

I am a beginner! I have the latest Arduino IDE (1.8.3 I believe ) installed on my other computer. I am learning to do AVR assembler out of a bunch of books. 

 

All is well and I am writing functions, geting values, twiddling ports and pins to my heart's delight... Except some things just won't compile.

 

MyArray:     .DB   1,2,3,4,5,6   

will not compile.

 

.DEF statements will not either 

 

LPM will not put the value found at the address (specified in the Z register) into R0

 

I can work around all these but I still would like it all to work "right" and as it should.  I will not be supprised if I come across more things that should work but don't.

Aside from these and a few other glitches I seem to be able to write small, elementary code and verify the returned values are correct.

 

My question is there a list of know issues  trying to do AVR assembler in the Arduino IDE and any workarounds? 

 

Thanks in advance.

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

AVR_Beginner wrote:
MyArray:     .DB   1,2,3,4,5,6   

will not compile.

What do you mean, "will not compile"?

Are you getting error message(s)? If so, what are they?

 

Note that "Compile" is what you do to High-Level Languages; the term for Assembler is "Assemble".

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil:

 

 

Thank you.  Assemble  :-)

 

Here is the error with .DB  Please note the .BYTE works fine though. I don't know why.

 

sketch\limit1.S: Assembler messages:

sketch\limit1.S:117: Error: unknown pseudo-op: `.db'

exit status 1
Error compiling for board Arduino/Genuino Uno.

 

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

Yet this code snippet directly above the "MyArray" I am trying to make work assembles fine and I can access it fine.

 

Table2:   
//   index        0     1       2       3       4       5      6      7  
           .BYTE  10,   21,     32,     43,     54,     65,    76,    87  
//                8     9       10      11      12      13     14     15
           .BYTE  98,   109,    110,    121,    132,    143,   154,   165
//                16    17      18      19      20      21     22     23           
           .BYTE  176,  187,    198,    209,    210,    221,   232,   243
           .BALIGN 2 

 

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

So what assembler does the Arduino IDE actually use?

 

There is no standard Assembler syntax - they are all different.

 

Have you RTFM for the particular Assembler to check if it is supposed to accept ".DB" ?  and, if it is supposed to accept ".DB", what the correct syntax is ...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know the exact assembler Arduino uses under the hood.

 

I would RTFM if there was a FM to read. So far I have not found any FM for the assembler version Arduino uses and I have not found any FM that would point me to differences / changes / etc from AVR assembler... Thus my asking the questions here.

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

AVR_Beginner wrote:
I don't know the exact assembler Arduino uses under the hood.

It matters - you need to know that!

 

I would RTFM if there was a FM to read.

Knowing which assembler it is is key to finding the FM for it!

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK... so being this is an Arduino forum on a web page with assembler experts... can some one please tell me exactly which assembler I have and where any manual / compatablity matrix exists if any. 

 

I frankly don't know how to dive into Arduino and Java and find it out.

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

There's an Arduino forum here only because most Arduinos are AVRs.

 

The place to find the experts with specific knowledge of the Arduino IDE, etc, is the actual Arduino forums: https://forum.arduino.cc/

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just posted the question there.

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)

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

When cross-posting the same question to multiple forums always give links between them - so that people can see what's going on.

 

Otherwise someone may waste their time giving an answer in one which has already been given in the other.

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

can some one please tell me exactly which assembler I have

D:\Users\mutha>"C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\bin\as.exe" -v
GNU assembler version 2.26 (avr) using BFD version (GNU Binutils) 2.26.20160125

 

Greg Muth

Portland, OR, US

Xplained/Pro/Mini Boards mostly

 

Make Xmega Great Again!

 

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

Arduino uses the gnu assembler, called "as", more specifically "avr-as" in this case. Directive ".db" is from Atmel assembler.

 

You need to replace ".db" by ".byte". A list of available directives: https://sourceware.org/binutils/...

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

So the required manual is: https://sourceware.org/binutils/docs/as/

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil, greg, El and everyone else: Thank you!  I am gonna download and start one it after Thanksgiving dinner... provided the triptophan doesn't nuke me first LOL

I am a new AVR programmer. I am learning alone out of books, the Internet (and any help I get here), etc. Please excuse me if I ask simple questions. I am not learning AVR ASM for school or for work: just for fun. Thanks. I have no prior formal IT training except for what i got on my own. If you want to ask me how to get rid of the beavers or stop the wasps and black bears from ruining your summer hit me up LOL. An ASM beginner, but an enthusiastic one :-)