[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avr-gcc
From: |
Ricardo Wurmus |
Subject: |
Re: avr-gcc |
Date: |
Tue, 17 Nov 2015 16:59:12 +0100 |
User-agent: |
mu4e 0.9.13; emacs 24.5.1 |
Ricardo Wurmus <address@hidden> writes:
> I’ve been wanting to use microscheme to do fun things with my AVR
> microcontrollers. Sadly, I haven’t been able to make the combination of
> microscheme, avrdude, and avr-gcc work.
[...]
> There are multiple copies of “libm.a” and “libc.a” and there’s a
> “crtm328p.o” as well somewhere below the “avr/lib/” directory in the
> output of the avr-libc package. Even after adding these paths to
> LIBRARY_PATH, however, I cannot seem to fix the linker errors above.
> Then I realised that LIBRARY_PATH only works for native compilers, and
> that I would need to pass flags to the compiler (“-L”, maybe?).
>
> But this all seems very wrong. How can we fix this elegantly? Does
> microscheme’s call to avr-gcc need to be patched to “-L” the avr-libc
> path? Or does avr-gcc need fixing? Or something else entirely?
I first looked at how to fix this inelegantly. “crtm328p.o” cannot be
found no matter what I did, so I copied it from the store to the current
directory:
~~~~~~~~~~~~
address@hidden ~ $ cp
/gnu/store/b8p4kkhcly7k5klnrzxmql35d541xhgq-avr-libc-1.8.1/avr/lib/avr5/crtm328p.o
.
~~~~~~~~~~~~
Then I discovered microscheme’s “-w” flag which lets me paste stuff to
the end of the call to avr-gcc. I abuse it to add the avr-libc lib
directory containing “libc.a” and “libm.a”:
~~~~~~~~~~~~
address@hidden ~ $ microscheme -a -u -m UNO -d /dev/bus/usb/006/004 -w
"-L/gnu/store/b8p4kkhcly7k5klnrzxmql35d541xhgq-avr-libc-1.8.1/avr/lib/avr5/"
microscheme/examples/BLINK.ms
Microscheme 0.9.2, (C) Ryan Suchocki
>> Treeshaker: After 4 rounds: 87 globals purged! 22 bytes will be reserved.
>> 18 lines compiled OK
>> Assembling...
>> Uploading...
avrdude: ser_open(): can't set attributes for device "/dev/bus/usb/006/004":
Inappropriate ioctl for device
avrdude done. Thank you.
>> Warning: Command may have failed. (Exit code 256)
>> Finished.
~~~~~~~~~~~~
Yes! It actually assembled the example!
(Uploading fails, of course, because I shouldn’t try to write to a raw
USB device. For some reason the AVRISPmkII USB programming device
doesn’t appear as a regular serial device, so some more work is needed
here.)
So, back to the original question: how could we fix this in an elegant
manner? This hack will last me for some tests, but it feels really
icky.
~~ Ricardo
- avr-gcc, Ricardo Wurmus, 2015/11/17
- Re: avr-gcc,
Ricardo Wurmus <=
- Re: avr-gcc, Ludovic Courtès, 2015/11/17