AVR Assembly 2 compiling differences.

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

I have a simple program using two timers generating a few PWM signals which compiles to 116 words using AVR Studio 4

The same code compiled using the AVR Assembly beta results in a hex file that is 172 words.

Is there any reason I would be gettign this much of a discrepancy. I'm not even coming close to running out of space but 60bytes disappearing for no reason makes me wonder what it's doing.

-Curiosity may have killed the cat
-But that's why they have nine lives

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

Are you compiling or assembling? An assembler should almost always give the same result, (except in the case of an assembler that fixes out of range short branches).

A compiler, on the other hand, can have vast differences depending on the optimization settings and library quality.

But Studio4 isn't a compiler... :twisted:

What compiler are you using?

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

Compiler, assembler same difference to me I never understood the terminology difference considering the process is identical a compiler is just more complex in it's interpretation. Especially with the conditional execution and macro functions, AVR Assembler is aproaching the complexity of a compiler in the first place.

Like I said I'm using AVR Studio 4.0 and it's assembler.

-Curiosity may have killed the cat
-But that's why they have nine lives

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

Sceadwian wrote:
Compiler, assembler same difference to me I never understood the terminology difference considering the process is identical a compiler is just more complex in it's interpretation. Especially with the conditional execution and macro functions, AVR Assembler is aproaching the complexity of a compiler in the first place.

Actually there is a HUGE difference. For a compiler compiler a single statement, might generate 100's of machine instructions. The compiler will also look at the resultant machine code and and optimize it based on the context it's used in. The compiler can also perform other optimizations for speed or size, depending on your compiler options.

An assembler on the other hand, does none of the above. There is a direct one to one relationship between the assembly code you write, and the machine code that is output. Each statement you write, will either control the assembler, or output a single machine instruction. The only time this differs is that if the assembler offers some auto substitution features, like AVRASM2 does for relative jumps.

Perhaps posting the code, will help us explain why there might be a difference.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Sceadwian wrote:
I have a simple program using two timers generating a few PWM signals which compiles to 116 words using AVR Studio 4

The same code compiled using the AVR Assembly beta results in a hex file that is 172 words..


Now that's VERY interesting, because we do test new assembler versions against older ones for output file differences (one of our major regression tests, actually).

First, I would like to know how you arrived at this conclusion (keeping in mind that AVRASM2 reports the output segments in bytes and AVRASM1 reports the code segment in words, and that the presentation formats differ, particularly if there are "holes" in the program or data in the code segment). I also need to know exactly which version of BOTH assemblers you are using (this will follow if you post the assembler output as directed below).

I will appreciate if you post the full output from both assembler runs here (copy it from the Studio output pane), or mail it to avrbeta at atmel dot com. Even better, if you are willing to post your program here or mail it to the same address, I will investigate it immediately.

If you want to investigate it further yourself, I suggest you produce list and map files from both assemblers and compare (note that the list format of avrasm2 differers from avrasm1. Compare addresses, not text).

Please don't report bugs in private forum messages.
--
Roland Kruse
Atmel AVR Tools

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

Please disregard this post, AVRStudio 4.10.356 standard assembler vs assembler 2 for some reason the standard assembler reports 19 bytes as unused while the assembler 2 doesn't. Assembler disregards these 'unused' words for it's total count. I believe this is unused interupt vector space, which is just being reported differently between the two versions.

-Curiosity may have killed the cat
-But that's why they have nine lives

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

I would however like to note as I just noticed it. That it's giving me a warning with the standard m16def.inc file using the AVR assembler 2.

...Snippet
C:\Program Files\Atmel\AVR Tools\AvrAssembler\Appnotes\m16def.inc(414): warning: Invalid attempt to use of keyword 'or' as user symbol name, ignored

-Curiosity may have killed the cat
-But that's why they have nine lives

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

Sceadwian wrote:
I would however like to note as I just noticed it. That it's giving me a warning with the standard m16def.inc file using the AVR assembler 2.

...Snippet
C:\Program Files\Atmel\AVR Tools\AvrAssembler\Appnotes\m16def.inc(414): warning: Invalid attempt to use of keyword 'or' as user symbol name, ignored

Yes. We know about that. It will be history soon.

Please don't report bugs in private forum messages.
--
Roland Kruse
Atmel AVR Tools