define custom target, use with cargo-xbuild
requires nixpkgs master now
This commit is contained in:
parent
2db35d063f
commit
f0f9603657
@ -1,11 +1,11 @@
|
||||
[target.armv7-unknown-linux-gnueabihf]
|
||||
[target.armv7-none-eabihf]
|
||||
runner = "./runner.sh"
|
||||
linker = "arm-none-eabihf-gcc"
|
||||
rustflags = [
|
||||
"-C", "link-arg=-Wl,-Tlink.x,-N",
|
||||
"-C", "link-arg=-Tlink.x",
|
||||
"-C", "target-feature=a9,armv7-a,neon",
|
||||
"-C", "target-cpu=cortex-a9",
|
||||
]
|
||||
|
||||
[build]
|
||||
target = "armv7-unknown-linux-gnueabihf"
|
||||
target = "armv7-none-eabihf.json"
|
||||
|
28
armv7-none-eabihf.json
Normal file
28
armv7-none-eabihf.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"abi-blacklist": [
|
||||
"stdcall",
|
||||
"fastcall",
|
||||
"vectorcall",
|
||||
"thiscall",
|
||||
"win64",
|
||||
"sysv64"
|
||||
],
|
||||
"arch": "arm",
|
||||
"data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
|
||||
"emit-debug-gdb-scripts": false,
|
||||
"env": "",
|
||||
"executables": true,
|
||||
"features": "+v7,+vfp3,-d32,+thumb2,-neon",
|
||||
"is-builtin": false,
|
||||
"linker": "rust-lld",
|
||||
"linker-flavor": "ld.lld",
|
||||
"llvm-target": "armv7-unknown-none-eabihf",
|
||||
"max-atomic-width": 32,
|
||||
"os": "none",
|
||||
"panic-strategy": "abort",
|
||||
"relocation-model": "static",
|
||||
"target-c-int-width": "32",
|
||||
"target-endian": "little",
|
||||
"target-pointer-width": "32",
|
||||
"vendor": ""
|
||||
}
|
13
default.nix
13
default.nix
@ -1,6 +1,5 @@
|
||||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
rustSrc ? https://github.com/rustlang/rust/archive/master.tar.gz,
|
||||
}:
|
||||
|
||||
let
|
||||
@ -8,15 +7,21 @@ let
|
||||
in
|
||||
with pkgs;
|
||||
let
|
||||
rustcSrc = fetchgit {
|
||||
url = https://github.com/rust-lang/rust.git;
|
||||
# master of 2019-08-06
|
||||
rev = "8996328ebf34aa73e83a1db326767c11041f811d";
|
||||
sha256 = "1daz0y97dm35nfy7ip0wqvyax0g36szm25n77rcg20k6wab4fqi7";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
targets = [
|
||||
"armv7-unknown-linux-gnueabihf"
|
||||
];
|
||||
rust =
|
||||
rustChannelOfTargets "nightly" null targets;
|
||||
rustPlatform = recurseIntoAttrs (makeRustPlatform {
|
||||
rustc = rust // { src = rustSrc; };
|
||||
rustc = rust // { src = rustcSrc; };
|
||||
cargo = rust;
|
||||
});
|
||||
in {
|
||||
inherit pkgs rustPlatform;
|
||||
inherit pkgs rustPlatform rustcSrc;
|
||||
}
|
||||
|
34
link.x
34
link.x
@ -20,36 +20,45 @@ MEMORY
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.exceptions (0x0) :
|
||||
.exceptions ORIGIN(OCM) :
|
||||
{
|
||||
KEEP(*(.text.exceptions));
|
||||
} > OCM
|
||||
.text (0x8000) :
|
||||
{
|
||||
KEEP(*(.text.boot))
|
||||
*(.text .text.*)
|
||||
|
||||
.__fill (NOLOAD) : {
|
||||
. = ORIGIN(OCM) + 0x8000;
|
||||
} > OCM
|
||||
|
||||
.rodata ALIGN(0x1000) :
|
||||
.text (ORIGIN(OCM) + 0x8000) :
|
||||
{
|
||||
*(.rodata)
|
||||
*(.text.boot);
|
||||
*(.text .text.*);
|
||||
. = ALIGN(4);
|
||||
} > OCM
|
||||
|
||||
.data ALIGN(0x1000) :
|
||||
.rodata : ALIGN(4)
|
||||
{
|
||||
*(.data)
|
||||
*(.rodata .rodata.*);
|
||||
. = ALIGN(4);
|
||||
} > OCM
|
||||
|
||||
.bss ALIGN(0x4000) (NOLOAD) :
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
*(.data .data.*);
|
||||
. = ALIGN(4);
|
||||
} > OCM
|
||||
|
||||
.bss (NOLOAD) : ALIGN(0x4000)
|
||||
{
|
||||
/* Aligned to 16 kB */
|
||||
KEEP(*(.bss.l1_table));
|
||||
*(.bss)
|
||||
*(.bss .bss.*);
|
||||
. = ALIGN(4);
|
||||
} > OCM
|
||||
__bss_start = ADDR(.bss);
|
||||
__bss_end = ADDR(.bss) + SIZEOF(.bss);
|
||||
|
||||
.stack ALIGN(0x1000) (NOLOAD) : {
|
||||
.stack (NOLOAD) : ALIGN(0x1000) {
|
||||
. += STACK_SIZE;
|
||||
} > OCM
|
||||
__stack_end = ADDR(.stack);
|
||||
@ -58,6 +67,7 @@ SECTIONS
|
||||
/DISCARD/ :
|
||||
{
|
||||
/* Unused exception related info that only wastes space */
|
||||
*(.ARM.exidx);
|
||||
*(.ARM.exidx.*);
|
||||
*(.ARM.extab.*);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ stdenv.mkDerivation {
|
||||
name = "adc2tcp-env";
|
||||
buildInputs = with rustPlatform.rust; [
|
||||
rustc cargo
|
||||
cargo-xbuild rustcSrc
|
||||
pkgsCross.armhf-embedded.buildPackages.gcc
|
||||
#pkgsCross.armv7l-hf-multiplatform.buildPackages.gcc
|
||||
#pkgsCross.armhf-embedded.buildPackages.binutils
|
||||
@ -18,7 +19,9 @@ stdenv.mkDerivation {
|
||||
|
||||
# Set Environment Variables
|
||||
RUST_BACKTRACE = 1;
|
||||
XARGO_RUST_SRC = "${rustcSrc}/src";
|
||||
|
||||
shellHook = ''
|
||||
echo "Run 'cargo xbuild --release' to build."
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user