Compiling for the Orangutan?

I’m running on Fedora, and its Extras repository includes Avrdude and AVR-GCC, but not, oddly enough, AVR-Libc. I compiled and installed that myself, but I still can’t compile any Orangutan examples from the orangutan-lib project.

I keep getting this error:
/usr/lib/gcc/avr/4.1.2/…/…/…/…/avr/bin/ld: crtm48.o: No such file: No such file or directory

Apparently, avr-gcc is trying to link with crtm48.o but can’t find it. I tried adding -L/usr/local/avr/lib/avr5 to CFLAGS in the example’s makefile, since that’s the library path where that file exists, but I still get the error.

Can anyone give me any pointers? Has anyone been able to compile anything from orangutan-examples on Linux?

Thanks,
Chris

Hello,
I’d guess that in the orangutan-lib examples, CFLAGS is not being included in the linking step. Take a look at the user guide for the USB programmer, which also has an example program for use under linux. You can try it with your Orangutan, even if you’re not using the USB programmer, then re-use the simple Makefile given there, with a few modifications, for the orangutan-lib examples.

https://www.pololu.com/products/pololu/0740/userguide/

Let me know if this helps you out. If you need more help, I can find the specific Makefile I used when last experimenting with the orangutan-lib examples.

-Paul

I think it’s a bug in the recent release of avr-libc. I tried using an old 1.4.4 rpm I had lying around, and that fixed the problem.

Whoa! This bears testing out. I’m running with avr-libc 1.4.6. It’s been a while since I’ve gone through and tested stuff on Linux, but I’d be more than happy to run through everything.

Paul, you’re correct. The Makefile (which was generated by AVR Studio) uses $(LDFLAGS) rather than $(CFLAGS) for the linking step. Here’s what they’re defined as:

## Options common to compile, link and assembly rules
COMMON = -mmcu=$(MCU)

## Compile options common for all C compilation units.
CFLAGS = $(COMMON)
CFLAGS += -Wall -gdwarf-2 -I"../../" -Os -fsigned-char
CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d 

## Assembly specific flags
ASMFLAGS = $(COMMON)
ASMFLAGS += $(CFLAGS)
ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2

## Linker flags
LDFLAGS = $(COMMON)
LDFLAGS += 

So they’re both getting the target device type, but that’s about it. If you’re adding -L, my guess is the LDFLAGS += line would be the one to add it to.

I’m skimming this, so bear with me if you already said it, but Cerin, what version of avr-libc was giving you this problem?

Thanks for catching this.

Tom

I had this problem after compiling 1.4.6. I tried building RPMs from 1.4.6 and 1.4.5, but received a strange rpmbuild error, which I reported to the avr-libc-dev mailing list.

Shoot. I’m getting a different error. It’s not finding avr5.x on mine.

avr-gcc 4.1.2
avr-glibc 1.4.6
binutils/avr 2.16.1

Here’s my link line:

avr-gcc -mmcu=atmega168  analog-test.o analog.o lcd.o     -o analog-test.elf /usr/libexec/gcc/avr/ld: cannot open linker script file ldscripts/avr5.x: No such file or directory

Ok, I’ll mess with this and get back with you.

Tom