Programming in Assembler under Linux

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
I'm currently developing a program in assembly language, using a Linux
platform to host the development. The development environment is very
simple. My notes on this are now on my academic web page at

http://www.ee.ryerson.ca/~phiscock/

in the 'papers' subdirectory.

Peter

Syscomp Electronic Design Limited, Toronto
http://www.syscompdesign.com

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

8.1 has a typo. It is CSEG not CSEC.
.
You also suggest a choice of 2 assemblers on Linux. Surely the most widely used one in Linux is avr-as that you don't appear to mention at all? Very odd.

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

Thanks for the comments. I'll make that correction.

 

I was not aware of avr-as. From a brief look at it, it seems to require more steps to generate a .hex file

than, say, gavrasm. But good to know about.

 

Peter

Syscomp Electronic Design Limited, Toronto
http://www.syscompdesign.com

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

An instance of mixing AVR GCC and avr-as :

XMega cranks out NTSC color and digital stereo sound! by AtomicZombie

http://www.avrfreaks.net/forum/xmega-cranks-out-ntsc-color-and-digital-stereo-sound

...

Thanks to much help from this great community, I have redone the entire AV engine in GCC so that games and demos can be written in C, while the bare-metal heavy lifting is done by my assembly routines in the background.

...

 

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

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

Hello Peter, and welcome to AVRfreaks!

 

(-:

 

 


On an Atmel processor, the stack pointer, stack, status register and other machine registers are memory mapped into the random-access memory file

Nitpicking: That should read "On an Atmel AVR processor...". Atmel makes many different microcontroller families, of which (8-bit) AVRs is only one. (And, IIRC, Atmel has actually dropped the mapping of the register file into the RAM address space on some recently  released "tiny AVRs".)

 


 

In Chapter 6:

It is also possible to set up the GCC tool chain to generate machine code for Atmel processors [17]. Then GDB may be used as a debugger.

The (AVR-)GCC tool chain and GDB will not be enough. You also need something that interfaces between the executing code and GDB. E.g. either a monitor in firmware that "speaks to GDB" or a hardware debug "dongle" like the Atmel-ICE. I've yet to hear about a firmware-based monitor that "talks to GDB".

 

This leaves the hardware dongle as the viable option. In that case you need a low-level driver for it. In the case of AVR development on GNU/Linux I know of only one such driver: AVaRICE.

 

The residents here at AVRfreaks knows that getting an ICE to work on GNU/Linux is not trivial. Indeed, if you look around you will find a looong thread where I has been struggling, and still am (but now very close, I believe), to get this working.

 


 

Regarding setting up an avr-gcc tool chain hosted on Linux I would recommend picking the tarball supplied by Atmel/Microchip, rather than using a distro repository and installing with e.g. "apt" (or Synaptics, or...). My experience is that the Atmel built tarball has the highest likelihood to have the latest device support and bugfixes for the avr-gcc tool chain. You can find the Atmel-built tool chain here: http://www.atmel.com/tools/ATMEL...

 


 

PeterDH wrote:
From a brief look at it, it seems to require more steps to generate a .hex file than, say, gavrasm

Given a reasonable makefile, that should be a non-issue.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Sep 23, 2017 - 09:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PeterDH wrote:

Thanks for the comments. I'll make that correction.

 

I was not aware of avr-as. From a brief look at it, it seems to require more steps to generate a .hex file

than, say, gavrasm. But good to know about.

 

Peter

the only additional step is an invocation of avr-obcopy to extract .text from the ELF as ihex. Not exactly rocket science.

 

avr-as is a linking assembler.