What linker to use with AVRA?

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

Avra doesn't seem to be capable of producing binaries as far as I can tell. What program can I use for linux that will turn the object file into a binary?

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

OK, I'll bite, what would be the point of an assembler that does not produce binary?

I just downloaded it, went to the Example subdirectory and used the command:

N:\avra.1.2.2-win32\Example>..\bin\avra throttle.asm

which produced:

06/08/2007  16:50                   13 throttle.eep.hex
06/08/2007  16:50                2,596 throttle.hex

What more can you hope for from an assembler?

(BTW another assembler available for use on Linux/Unix (and Win32) is, of course, avr-as in the GCC package for AVR).

Cliff

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

What are these files and what do I do with them? Can avrdude load any of these directly into the AVR?

I already have avr-as, and it's giving me trouble with loading labels into registers. I've started a thread on this in the AVR-GCC forum and haven't been able to get it working. That's why I'm looking at avra.

Last Edited: Mon. Aug 6, 2007 - 04:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

subsonix wrote:
What are these files and what do I do with them? Can avrdude load any of these directly into the AVR?

They are binaries. Transfer them to the AVR and the program runs. I am pretty sure avrdude supports .hex files, I can't think of any programmer that does not.

- Jani

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

Yup those files are in Intel hex format which like the output from almost every AVR development tool are an ASCII, human readable version of the acutal binary and avrdude, like Avr Studio will happily program them for you.

While you can specify :i as the input format to avrdude it will actually auto-detect the input file type anyway. So either:

-U flash:w:throttle.hex

or

-U flash:w:throttle.hex:i

should work equally well.

Cliff

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

So a .hex file is just something like "0x4C, 0xAF..." ?

If this actually works, it would be sweet! Then I can stop messing around with avr-as and its weird syntax. Thanks a lot!

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

subsonix wrote:
What are these files and what do I do with them? Can avrdude load any of these directly into the AVR?

.hex files contain ASCII hexadecimal representations of the binary content of an AVR's Flash program memory, along with control information to make sure that the correct bytes of data end up in the correct memory address, and a crude mechanism to detect data corruption inside the hex file itself.

The ".eep.hex" files contain images of the initial contents of the AVR's EEPROM data memory.

avrdude can deal with .hex files. In fact, .hex files are the most common "binary" format for AVR microcontrollers no matter what toolset you're working with.

I take it you're not running Windows. Otherwise, I'd suggest that the assembler built in to Atmel's AVR Studio would probably give you the most integrated, convenient environment for assembly development, programming, and debugging. (Except if you actually want to split up your source code into multiple modules which are individually assembled to produce linkable, relocatable object files! In that case, I think avr-as is the only option.)

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

subsonix ,

Needless to say, as always, Wikipedia has the full story:

http://en.wikipedia.org/wiki/Int...

And for the record, the first few lines of that throttle.hex that Avra assmbled for me earlier are:

:020000020000FC
:0203FE00FFFFFF
:1000000008C024C018951895189518951895189536
:100010001895F8947BE177BB70E078BB70E878B90D
:1000200072E475BFEFEFF3E0C89501BE7AE071BDF1
:100030008FEF8DBD83E680BF04E0CC24BB24222457

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

Thanks for the link!

Yes, I am running Linux. It's a shame Atmel doesn't make their compiler or assembler available for Linux. For all things to need Windows for, development? It's ridiculous!

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

Quote:

It's a shame Atmel doesn't make their compiler or assembler available for Linux. For all things to need Windows for, development? It's ridiculous!

[surly curmudgeon] Like, it was published or implied or "common knowledge" or such that there were Atmel AVR tools on anything but Windows when you started with them?

There aren't any VAX/VMS tools either--darn Atmel.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Quote:

[surly curmudgeon] Like, it was published or implied or "common knowledge" or such that there were Atmel AVR tools on anything but Windows when you started with them?

There aren't any VAX/VMS tools either--darn Atmel.

Lee

Well, obviously there are non-windows tools, no thanks to Atmel though.

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

You could run Windows under Linux in a virtual machine, like VMWare, Qemu, Bochs or whatever. If you want to, and have a Windows licence :) So sometimes there is no way. But I hope Reactos is usable soon, or has anyone tried to run AVR Studio etc under Wine?

- Jani

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

Yup there's been previous reports of folks getting Studio to work under Wine. I'm sure a thread search would turn something up.

EDIT: for example this:
https://www.avrfreaks.net/index.p...

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

Punting when faced with a problem won't get you too far, I'm afraid.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hi. I'm trying to program my AVR with Cobol on my Commodore 64. I'm so mad that Atmel doesn't seem to support this. Has anyone talked to them about it?

Go electric!
Happy electric car owner / builder

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

sgomes wrote:
Hi. I'm trying to program my AVR with Cobol on my Commodore 64. I'm so mad that Atmel doesn't seem to support this. Has anyone talked to them about it?
:P :P :lol: :lol: :lol:

Resistance is futile…… You will be compiled!

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

> Hi. I'm trying to program my AVR with Cobol on my Commodore 64.

Hey guys, there's no need to get sarcastic. Support for common Unix
systems (at the very least, Linux) is certainly way beyond supporting
prehistoric architectures. Believe it or not, there's a not too small
community of people who are simply sick of Redmond's products (and
even more sick about their money-making machine), and thus would not
touch a Windows system volunteerily -- yet they do want to work with
AVRs anyway.

An assembler is nothing that would require any much beyond of what is
specified in the C standard, so it's not like demanding an entire GUI
to be ported, but a simple command-line utility that reads a file,
chews on it, and writes another file.

The other question, of course, is whether someone would really
volunteerily use such an overly simplified assembler as the Atmel
one. The last absolute code assembler I've been using was in the
mid 1980s, in order to bootstrap some basic utilities on my
homemade Z80 computer, until the day it could eventually run CP/M
at which I did have a relocatable and modular assembler even for
that machine.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
The other question, of course, is whether someone would really
volunteerily use such an overly simplified assembler as the Atmel
one. The last absolute code assembler I've been using was in the
mid 1980s, in order to bootstrap some basic utilities on my
homemade Z80 computer, until the day it could eventually run CP/M
at which I did have a relocatable and modular assembler even for
that machine.

By a strange quirk of fate my first transition from an absolute assembler to a relocating assembler for the 8080/Z80 was actually a Microsoft product (and a very good one in fact) in about 1984. Who remembers "Macro-80" which was the fore-runner to all the various MASM's for x86:

http://www.emsps.com/oldtools/ms...

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

> By a strange quirk of fate my first transition from an absolute
> assembler to a relocating assembler for the 8080/Z80 was actually a
> Microsoft product (and a very good one in fact) in about 1984. Who
> remembers "Macro-80" which was the fore-runner to all the various
> MASM's for x86:

Yes, that's exactly been my tool as well. It's probably the last
Microsoft software I've been using which I would rate between "very
good" and "excellent". It surpassed its ancestor Macro-11 on almost
any account, and left DR's original assembler be rather pale.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Errm, subsonix, I've got another idea regarding your original
problem. Have a look into the avr-gcc forum.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Avra seems to work great with avrdude. I can also load addresses of symbols without problems. There's way more documentation with Atmel's syntax than the GNU way, so I'll stick with this for now.

Very funny sgomes. Linux is a great development platform and it accommodates more hardware than windows ever could. It's also way more popular than you seem to think. I didn't ask for an IDE, but source code for an assembler would have been nice.

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

Quote:

The other question, of course, is whether someone would really volunteerily use such an overly simplified assembler as the Atmel one.

[ouch--cover your eyes to hide the segue in to Compiler Wars...] That probably applies to professionals like you. But those of us poor souls that use the according-to-brberie-not-for-professional-use brand of AVR C compiler use the Atmel assembler during each build. Someday us heathens will see the Light.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

> But those of us poor souls that use the according-to-brberie-
> not-for-professional-use brand of AVR C compiler use the Atmel
> assembler during each build.

That at least explains why your compiler has to compile everything
as a whole blurb of C code, rather than each source file separately:
the Atmel assembler simply cannot produce relocatable output suitable
for a linker. I wonder how they manage file scope per translation
unit when you compile multiple files...

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Quote:

I wonder how they manage file scope per translation
unit when you compile multiple files...

It [my post] was a bit of a tongue-in-cheek poke. ;) When I started at my workplace, they were already using CodeVision. That build model was puzzling to me, and I was skeptical at first. What is amazing is how well it has held up from the AVR models of yore to the newer, more sophisticated models (bootloader, relatively huge memory spaces, non-"reachable" I/O space, etc.). Compiler Wars can go on indefinitely (can you say "Afghanistan"?), but as a whole it is certainly competitive and a good value. Just "unique" in some (many?) respects.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

subsonix wrote:
funny sgomes. Linux is a great development platform and it accommodates more hardware than windows ever could. It's also way more popular than you seem to think. I didn't ask for an IDE, but source code for an assembler would have been nice.

I don't want to start a platform war but I think I need to speak out when something I hear is quite misleading.

Please give a list of hardware that cannot be accomadated in windows. I've been a hardware engineer for over 12 years now. Not once have I come close to needing linux for anything.

Second, linux may be "more popular than I think" but it is not "popular" by any measure I know of. Give citations please when you use 'facts' like this.

Go electric!
Happy electric car owner / builder

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

> Please give a list of hardware that cannot be accomadated in windows.

Well, it starts with a simple parallel-port bit-bang ISP dongle. No
driver available. The application has to take over complete IO
permissions, and poke directly on the IO ports with IN/OUT.

Compare that to all the major Unix platforms (not just Linux, also
Solaris and FreeBSD), they all have a parallel-port driver that
supports bit-banging out of the box, *including* the arbitration
between that kind of application and a standard printspooler access.
(MacOS X omitted deliberately from that list, simply because they
don't have any parallel ports at all on their machines.)

Next: USB. The standard Unix systems ship with a generic USB driver
you can use together with a userland application, in order to run
specific USB applications. Windows doesn't. Windows ships just a
generic HID device driver, and so all the wonderful USB world suddenly
looks like a "human interface" to the computer...

Oh, how about a SCSI tape drive? Unix: drivers are parts of the
respective distribution, similar to the disk drivers -- the devices
are pretty well standardized. Windows? Vendor-drivers without any
form of standardized upper-layer tools.

> but it is not "popular" by any measure I know of.

Curious, how many million Unix users does your measure need for
popularity status?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

This is too easy:

I put in a quick call to our IT guys. Not a single SCSI tape drive out among the populous. Only used by the IT guys. Strike One.
parallel port bit bang: Been there done that. No problems here. In fact we are shipping product running Windows 98 that does it no problem. Strike two.
USB: I don't confess to know much about HID device drivers so I'll have to defer to someone else on that.
Unix: the topic was Linux. Strike three.

You're out.

Also, let's look at this the other way around. Let's assume you are correct and the superior platform for hardware development is Linux. Why then are so many companies so successful with windows as their development platform? Not once..never ever.. have I hit a road block with my windows system that it even slowed down my development. Not once. None..repeat...NONE of my development software is even ported to Linux: Altium Designer 6, Solid Works, Mathcad, etc...

Go electric!
Happy electric car owner / builder

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

> I put in a quick call to our IT guys. Not a single SCSI tape drive
> out among the populous. Only used by the IT guys. Strike One.

You've got an IT department at home?

> parallel port bit bang: Been there done that. No problems here. In
> fact we are shipping product running Windows 98 that does it no
> problem.

Oh, sure. Using MS-DOS with a GUI on top, you didn't even have to
request IO privileges because any application alway ran with IO
privs... Any application can DoS the entire system.

> Unix: the topic was Linux. Strike three.

Huh? Linux *is* a Unix-like operating system, or "Unix", as they are
commonly called alltogether. It's a rewrite of a Unix, but that still
makes it belong to that family. All Unix-like systems are probably
closer together to each other than your quoted MS-DOS derivative to
any of the current Windows systems. Most of their differences are at
the system administrator level rather than at the user level. That's
only from the user's perspective, the internal kernel organization
between all the major Unix-like systems is, of course, completely
different -- but that's nothing the user has to care for.

> You're out.

You're funny.

> Also, let's look at this the other way around. Let's assume you are
> correct and the superior platform for hardware development is Linux.

Nobody said anything about being `superior', but you were/are simply
*completely* denying any other system being a usable platform at all.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

sgomes wrote:
Please give a list of hardware that cannot be accomadated in windows.

Well just wait until your hardware is based on ARM, MIPS, PowerPC, or pretty much anything but an AMD or an Intel x86 in this list:

http://home.hccnet.nl/p.van.deur...

The point about Linux is that (usually assuming the CPU has an MMU) it can be ported to just about any CPU and once it's running you'll then find it very difficult to distiguish operation (apart from speed of execution maybe) from one CPU to the next. Windows does not offer this!

Cliff

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

wait wait wait wait...I think I was confused. You guys seem to be talking about running Linux (NOT the same as UNIX) ON the hardware you are designing. I was talking about the hardware I'm using TO design hardware.

I apologize. Linux is a fine OS but I took offense when people have the audacity to compare it to anything used in your average EE department.

Go electric!
Happy electric car owner / builder

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

> You guys seem to be talking about running Linux (NOT the same as UNIX)

It's not the same as UNIX (in particular not as the "branded" UNIX),
but nobody cares. It's a Unix-like operating system, very much like
FreeBSD or NetBSD or MacOS X is a Unix-like operating system. OTOH,
Solaris is a UNIX(branded) system, yet it still feels much the same
(from a user's point of view) as a Linux or FreeBSD or NetBSD. I
daily switch between Linux (at work) and FreeBSD (at home), and if you
were looking at my desktop, you'd probably not notice the differences
at all. Both look very much the same, but very much different than
any Windows desktop, and very much different from any other desktop
GUI you might have seen in your life.

> ON the hardware you are designing.

Not necessarily. Target portability is one feature of Linux though,
and I think the top Unix system for that is still NetBSD, which has
been ported to about any CPU on earth that has a MMU in it.

> Linux is a fine OS but I took offense when people have the audacity
> to compare it to anything used in your average EE department.

Still, you are either incompetent or ignorant.

There are a lot of areas where Unix has been very dominant in the
past, and mainly due to the good performance/price ratio of even a
brand-name PC, many of these have been migrated to Linux systems
within the past few year. This is *not only* servers, but also
workstations.

Btw., personally I never ever (regularly) sat in front of a Windows PC
within my entire career so far. It's been a MS-DOS PC in the early
1990s, which was only used as a terminal to the Unix workstation, and
with the advent of PC-based opensource Unix system, it has been a
Unix-like system since.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
> Still, you are either incompetent or ignorant.

That is mean and hateful. I feel sad for you.

Go electric!
Happy electric car owner / builder

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

Wow, did this ever get off-track!

The statement that sparked the bad feelings seems to have been, "I'm surprised Atmel doesn't directly support development in Linux" or something to that effect.

And sgomes seems to have been surprised by that sentiment.

Back in the early days of Linux, you actually had to compile your own kernel to make use of all but the most trivial portions of your system's hardware. So one of the very first programs a new Linux user used to encounter while first setting up the system was actually the compiler. (That's all changed now with friendlier installers, more generic kernels and loadable modules. But I digress.) From that heritage, and the whole open-source nature of the beast, Linux is inherently software development-centric. Hence subsonix's sentiment.

Despite that, Atmel focused on Windows when it released the AVR. Makes sense, since it provides a means of reaching the majority of their potential clients with just one tool.

They don't seem to have been directly involved in creating any of the 8-bit AVR development tools that are available for Linux. Coincidentally, the makeup of those Unix-like software development tools make them very easy to port to just about any modern operating system under the sun, including Windows. So, if Atmel had focused on that sort of development platform right from the beginning, it is very likely that they could have reached even more potential customers than they did with their Windows-only release.

Fast forward to today, and you'll discover that the very first officially Atmel-supported development kit for AVR32 software development was actually created with the GNU toolchain to run on UNIX-like operating systems. The Windows version of the toolchain runs with the help of either MinGW/MSYS or Cygwin. (I don't remember which; both are tools that actually transform Windows to make it behave more like Linux!) So it appears that Atmel is coming round to subsonix's position.

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

> That is mean and hateful.

No hate, no anger. Just an opinion, similar to you stating your opinions.

I simply get the impression that you're closing your eyes, and you not want
to notice people working successfully with non-Windows systems -- even
working with these systems in the same field as you are doing. I never
implied it would be a majority (that would for sure be foolish), but
claiming there *could* be noone working that way at all is either ignoring
reality ("ignorant"), or you just don't know it better despite of a number
of voices telling you (which I think is described as "incompetent", with
respect to the topic being discussed, of course).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Luke,

From:

http://www.atmel.com/dyn/product...

you'll note:

Quote:
AVR32 Studio is Built On Eclipse™ and supports Microsoft® Windows® 2000 and XP, and Linux®.

I have a sneaking suspicion that one day there's going to be an AVR8 Studio built on Eclipse too which would then keep everyone happy.

In fact, while Freaks was off the air yesterday, I started reading around about ARM dev boards and dev tools and after looking at several options I (perhaps not surprisingly?) came back to Atmel SAM7 so I've pretty much decided to get one of these:

http://www.olimex.com/dev/sam7-e...

and one of these:

http://www.amontec.com/jtagkey-t...

so I downloaded this:

http://www.atmel.com/dyn/resourc...

and worked through the PDF which mainly involves files from this:

http://www.yagarto.de/

and so have now ended up with a working arm-gcc development system on my PC all fronted by Eclipse! Small world.

Cliff