unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* avr-gcc
@ 2015-11-17 15:25 Ricardo Wurmus
  2015-11-17 15:59 ` avr-gcc Ricardo Wurmus
  2015-11-17 21:32 ` avr-gcc Ludovic Courtès
  0 siblings, 2 replies; 19+ messages in thread
From: Ricardo Wurmus @ 2015-11-17 15:25 UTC (permalink / raw)
  To: guix-devel@gnu.org

Hi Guix,

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.

Here’s what I did first:

    guix package -i microscheme avrdude gcc-cross-sans-libc-avr avr-libc

The microscheme package includes some examples, so I tried to compile
and upload the BLINK example:

~~~~~~~~~~~~~~~
rekado@banana ~ $ microscheme -a -u -m UNO -d /dev/bus/usb/006/004 microscheme-0.9.2/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...
avr-ld: cannot open linker script file ldscripts/avr5.xn: No such file or directory
collect2: error: ld returned 1 exit status
>> Warning: Command may have failed. (Exit code 256)
sh: avr-objcopy: command not found
>> Warning: Command may have failed. (Exit code 32512)
...
~~~~~~~~~~~~~~~

So, a problem with a linker script that cannot be found and a missing
avr-objcopy.  I found them in the binutils-cross-avr output in the
store, but since there’s no separate package for this I installed it
like this:

    guix package -i /gnu/store/5f7pp8r9wpwzsf61cf406xb1hkad2cdi-binutils-cross-avr-2.25.1

Now running microscheme again produces this:

~~~~~~~~~~~~~~~
Microscheme 0.9.2, (C) Ryan Suchocki
>> Treeshaker: After 4 rounds: 87 globals purged! 22 bytes will be reserved.
>> 18 lines compiled OK
>> Assembling...
avr-ld: cannot find crtm328p.o: No such file or directory
avr-ld: cannot find -lm
avr-ld: cannot find -lc
collect2: error: ld returned 1 exit status
>> Warning: Command may have failed. (Exit code 256)
avr-objcopy: 'BLINK.elf': No such file
>> Warning: Command may have failed. (Exit code 256)
>> 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.
~~~~~~~~~~~~~~~

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?

~~ Ricardo

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-04-16 19:56 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 15:25 avr-gcc Ricardo Wurmus
2015-11-17 15:59 ` avr-gcc Ricardo Wurmus
2015-11-17 21:32 ` avr-gcc Ludovic Courtès
2015-11-18  3:53   ` avr-gcc Thompson, David
2015-11-18 11:03     ` avr-gcc Ludovic Courtès
2015-11-19  1:54       ` avr-gcc Thompson, David
2015-11-20 14:20         ` avr-gcc Ludovic Courtès
2016-04-12 18:21           ` avr-gcc Thompson, David
2016-04-12 20:14             ` avr-gcc Thompson, David
2016-04-13 20:42             ` avr-gcc Ludovic Courtès
2016-04-14  5:47               ` avr-gcc Jan Nieuwenhuizen
2016-04-14 16:47                 ` avr-gcc Ludovic Courtès
2016-04-15  8:09                   ` avr-gcc Jan Nieuwenhuizen
2016-04-15  9:01                     ` avr-gcc Andy Wingo
2016-04-15 12:44                       ` avr-gcc Jan Nieuwenhuizen
2016-04-15 13:13                         ` avr-gcc Andy Wingo
2016-04-15 21:06                           ` avr-gcc Ludovic Courtès
2016-04-15 21:10                     ` avr-gcc Ludovic Courtès
2016-04-16 19:55                       ` avr-gcc Jan Nieuwenhuizen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).