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

Initial implementation of vc4 cross-compile #72657

Merged
merged 1 commit into from Nov 24, 2019
Merged

Conversation

cleverca22
Copy link
Contributor

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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 nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@cleverca22
Copy link
Contributor Author

cleverca22 commented Nov 3, 2019

https://gist.github.com/c9e89ceaadba96f1969bc8eeab8ba532
and nix-build -I nixpkgs=../../nixpkgs-vc4/ --argstr linker sram -A helloworld will create a result/hello.bin
if you copy that to bootcode.bin on an SD card, and pop it into a raspberry pi, it will print Hello world! out the serial port at 115200 baud

nix-build -I nixpkgs=../../nixpkgs-vc4/ -A testit will also build a simulator, and run the code inside it

name = "newlib";
src = fetchFromGitHub {
owner = "itszor";
repo = "newlib-vc4";
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should merge the "mainline", "msp430", and "vc4" newlib's into a shared derivation to make this a little easier to maintain (presumably you only want one "newlib" at a time). I hadn't realized how many forks of newlib existed! Not necessary for this PR though.

src = fetchurl {
src = if stdenv.targetPlatform.isVc4 then fetchFromGitHub {
owner = "itszor";
repo = "gcc-vc4";
Copy link
Member

Choose a reason for hiding this comment

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

GCC forks are hard to maintain. Not sure how to handle this though

Copy link
Member

Choose a reason for hiding this comment

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

This also looks like it's actually GCC6, not GCC8. This would be a good opportunity figure out if we can make it possible to select Compilers when cross compiling. Right now we just do this:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/cross/default.nix#L54-L62

Adding some option for what GCC version you need would be useful.

/cc @Ericson2314

Copy link
Member

Choose a reason for hiding this comment

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

Yeah let's the diff to be gcc 6 too. We can figure out compiler selection and stuff later. The source replacement isn't fun, but it's the least invasive option. We can bring this stuff up for the platform support RFCs.

@cleverca22
Copy link
Contributor Author

i can confirm that building with the gcc6 exprs still works, and the generated bootcode.bin works on all 4 of my rpi's (models 1, 1, 2 and 3)

@Ericson2314 Ericson2314 changed the title initial implementation of vc4 cross-compile Initial implementation of vc4 cross-compile Nov 24, 2019
@Ericson2314 Ericson2314 merged commit 814f910 into NixOS:master Nov 24, 2019
@Ericson2314
Copy link
Member

Awesome!

@cleverca22 cleverca22 deleted the vc4 branch November 27, 2019 23:38
@siraben siraben mentioned this pull request Jun 16, 2021
11 tasks
Ericson2314 added a commit to Ericson2314/gnu-config that referenced this pull request Oct 28, 2023
This is supported in this GCC fork. [1] It has been packaged in Nixpkgs
since 2019. [2]

Their change to `config.sub` [3] is similar, but also includes a `vc4`
-> `vc4-unknown-elf` shorthand; I don't see any reasons to add any new
legacy 1-component short-hands, so I just skipped that part.

[1]: https://github.com/itszor/vc4-toolchain

[2]: NixOS/nixpkgs#72657

[3]: itszor/gcc-vc4@91278af

* config.sub (vc4-*): Recognize.
* testsuite/config-sub.data (vc4-unknown-none-elf): New entries.
Ericson2314 pushed a commit to Ericson2314/gnu-config that referenced this pull request Oct 28, 2023
This is supported in this GCC fork. [1] It has been packaged in Nixpkgs
since 2019. [2]

Their change to `config.sub` [3] is similar, but also includes a `vc4`
-> `vc4-unknown-elf` shorthand; I don't see any reasons to add any new
legacy 1-component short-hands, so I just skipped that part.

[1]: https://github.com/itszor/vc4-toolchain

[2]: NixOS/nixpkgs#72657

[3]: itszor/gcc-vc4@91278af

* config.sub (vc4-*): Recognize.
* testsuite/config-sub.data (vc4-unknown-none-elf): New entries.
Ericson2314 pushed a commit to Ericson2314/gnu-config that referenced this pull request Oct 28, 2023
This is supported in this GCC fork. [1] It has been packaged in Nixpkgs
since 2019. [2]

Their change to `config.sub` [3] is similar, but also includes a `vc4`
-> `vc4-unknown-elf` shorthand; I don't see any reasons to add any new
legacy 1-component short-hands, so I just skipped that part.

[1]: https://github.com/itszor/vc4-toolchain

[2]: NixOS/nixpkgs#72657

[3]: itszor/gcc-vc4@91278af

* config.sub (vc4-*): Recognize.
* testsuite/config-sub.data (vc4-unknown-none-elf): New entries.
Ericson2314 pushed a commit to Ericson2314/gnu-config that referenced this pull request Oct 28, 2023
This is supported in this GCC fork. [1] It has been packaged in Nixpkgs
since 2019. [2]

Their change to `config.sub` [3] is similar, but also includes a `vc4`
-> `vc4-unknown-elf` shorthand; I don't see any reasons to add any new
legacy 1-component short-hands, so I just skipped that part.

[1]: https://github.com/itszor/vc4-toolchain

[2]: NixOS/nixpkgs#72657

[3]: itszor/gcc-vc4@91278af

* config.sub (vc4-*): Recognize.
* testsuite/config-sub.data (vc4-unknown-none-elf): New entries.
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 8.has: package (new) 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants