Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avr-*: split avr-gcc-libc into separate packages #29007

Merged
merged 5 commits into from Sep 12, 2017
Merged

Conversation

mguentner
Copy link
Contributor

@mguentner mguentner commented Sep 5, 2017

Motivation for this change

the avr toolchain was broken on master

Issue: #28220

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
    Compiled a small AVR binary.
    CC @danielfullmer Could you please test against your project?
  • Fits CONTRIBUTING.md.

- avr-gcc 5.3.0 -> 5.4.0

closes NixOS#28220

Since the packages do not share a common prefix anymore, you need
to define the current store paths in your project's Makefile.

Example for an atmega644 build:

CFLAGS += -I /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/include
CFLAGS += -B /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/lib/avr5
CFLAGS += -L /nix/store/9rffxzds5crcpm76g3nr03jx0aa657cf-avr-libc-2.0.0/avr/lib/avr5
CFLAGS += -L /nix/store/8409dj9js4i5901i63275wxdm783l0p6-avr-gcc-5.4.0/lib/gcc/avr/5.4.0/avr5
@mguentner
Copy link
Contributor Author

Don't pull yet. There are still some dependencies that need to be fixed

@mguentner mguentner changed the title avr-*: split avr-gcc-libc into separate packages WIP: avr-*: split avr-gcc-libc into separate packages Sep 5, 2017
@mguentner
Copy link
Contributor Author

The binaries work / compile. I am unsure whether the library path needs to be fixed for avr-gcc / avr-libc or not.

avr-gcc needs specific includes for the microcontroller used. If a atmega644 is used, the libraries reside in {AVR}/avr/lib/avr5 and for a atmega8 in {AVR}/avr/lib/avr4.
On traditional distributions, all the avr includes / libraries share a common prefix (like /usr/avr/...).
Since the packages are now separate, this means that one needs to supply these paths for the build
process (as laid out in 6a458c1).
The question now is whether there is a way to tell avr-gcc/avr-ld: "Take this path as your relative path and add the correct path for the respective mcu"

@mguentner mguentner changed the title WIP: avr-*: split avr-gcc-libc into separate packages avr-*: split avr-gcc-libc into separate packages Sep 5, 2017
@danielfullmer
Copy link
Contributor

I can confirm that my own project at danielfullmer/tmk_keyboard builds with this PR---with the addition of the mcu-specific CFLAGS as described in 6a458c1. I agree, it would be much more convenient if avr-gcc can just figure out the correct includes as it seemed to do previously.

Also, is this going to change again when @Ericson2314 's cross-compilation PRs are all merged? It would be nice if whatever interface we expose can remain constant for downstream derivations. For instance, would it be valuable to keep avrgcclibc as a convenience wrapper around the individual packages? My cross-compilation knowledge is severely lacking, so I'd be interested in comments on the proper direction for this stuff.

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope that once I'm done, we can get rid of this and just use normal gcc + avr libc. Until then, though, this is definitely an improvement. Thanks!

@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Sep 6, 2017
@Ericson2314 Ericson2314 added this to the 17.09 milestone Sep 6, 2017
@mguentner
Copy link
Contributor Author

@danielfullmer Thanks for testing!

Let's see whether we can figure out how to get this avr4, avr5 etc. stuff right.

@Mic92 Mic92 merged commit 2d77958 into NixOS:master Sep 12, 2017
@mguentner mguentner deleted the avrclean branch September 15, 2017 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants