Readable Listings from avr-as (GNU)

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was playing with ralphd's bootloader which uses avr-gcc.


After the irritation of byte-arithmetic for a word-addressed AVR,   I moved to the Atmel Assembler.

Now I have an intuitive location counter with obvious arithmetic but obviously need to calculate byte-addressing for data in Flash.


Anyway,   I am reasonably happy with the project now.    So I thought that I should make it buildable with GCC and Avrasm2.


When it comes to produce a listing,   you can use avr-as -ahls=listing.lst or use avr-objdump -S


Since avr-as is producing relocatable objects,   the location counter is 0x0000 based.

The avr-objdump will show the absolute locations set by the linker.


But the really irritating thing is that the location counter is displayed as high-low and opcodes are displayed as low-high:


 153 0000 54B7      	    in   rCOUNT, MCUSR


    in   rCOUNT, MCUSR
 e00:	54 b7       	in	r21, 0x34	; 52


000700 b754          in   rCOUNT, MCUSR

I can live with the weird location counter.    I really get upset by an opcode 0xb754 being displayed as "54 b7" or "54B7".

I presume that there is an avr-as switch that shows opcodes properly.     After all,    most MCUs in the world are little-endian.