unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ricardo Wurmus <rekado@elephly.net>
To: "guix-devel@gnu.org" <guix-devel@gnu.org>
Subject: avr-gcc
Date: Tue, 17 Nov 2015 16:25:54 +0100	[thread overview]
Message-ID: <87wptgmyv1.fsf@elephly.net> (raw)

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

             reply	other threads:[~2015-11-17 15:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 15:25 Ricardo Wurmus [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wptgmyv1.fsf@elephly.net \
    --to=rekado@elephly.net \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).