From e7d0485ca2fece06e66e22162805b0e388bcc449 Mon Sep 17 00:00:00 2001 From: Dimitar Dimitrov Date: Fri, 15 Jan 2021 20:23:10 +0200 Subject: Add package with PRU linker scripts and headers Include the gnuprumcu package in PRU cross toolchain. Toolchain is somewhat useless without device specs and linker scripts for the various SoCs. Signed-off-by: Dimitar Dimitrov diff --git a/config/comp_libs/gnuprumcu.in b/config/comp_libs/gnuprumcu.in new file mode 100644 index 0000000..1ee9cfa --- /dev/null +++ b/config/comp_libs/gnuprumcu.in @@ -0,0 +1,2 @@ +# gnuprumcu config file +## depends on ARCH_PRU diff --git a/packages/gnuprumcu/0.5.0/0001-HACK-Fix-paths-for-crosstool-ng.patch b/packages/gnuprumcu/0.5.0/0001-HACK-Fix-paths-for-crosstool-ng.patch new file mode 100644 index 0000000..e251180 --- /dev/null +++ b/packages/gnuprumcu/0.5.0/0001-HACK-Fix-paths-for-crosstool-ng.patch @@ -0,0 +1,41 @@ +From b045b2c65e26153813abadc2d065afdd52612fb0 Mon Sep 17 00:00:00 2001 +From: Dimitar Dimitrov +Date: Fri, 15 Jan 2021 18:52:09 +0200 +Subject: [PATCH] HACK: Fix paths for crosstool-ng + +For some reason crosstool-ng modifies the default +binutils/ld path for ldscripts. Align our respective +path. + +Signed-off-by: Dimitar Dimitrov +--- + ldscripts/Makefile.am | 2 +- + ldscripts/Makefile.in | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ldscripts/Makefile.am b/ldscripts/Makefile.am +index 23c5903..b6984d5 100644 +--- a/ldscripts/Makefile.am ++++ b/ldscripts/Makefile.am +@@ -47,4 +47,4 @@ dist_pru_DATA = \ + pruelf-tda4vm.icssg1.tx_pru1.x + + +-prudir = $(exec_prefix)/$(target_alias)/lib ++prudir = $(libdir) +diff --git a/ldscripts/Makefile.in b/ldscripts/Makefile.in +index b58975f..b7aecd2 100644 +--- a/ldscripts/Makefile.in ++++ b/ldscripts/Makefile.in +@@ -300,7 +300,7 @@ dist_pru_DATA = \ + pruelf-tda4vm.icssg1.tx_pru0.x \ + pruelf-tda4vm.icssg1.tx_pru1.x + +-prudir = $(exec_prefix)/$(target_alias)/lib ++prudir = $(libdir) + all: all-am + + .SUFFIXES: +-- +2.20.1 + diff --git a/packages/gnuprumcu/0.5.0/chksum b/packages/gnuprumcu/0.5.0/chksum new file mode 100644 index 0000000..8087033 --- /dev/null +++ b/packages/gnuprumcu/0.5.0/chksum @@ -0,0 +1,4 @@ +md5 gnuprumcu-0.5.0.tar.gz ee6110995491dac1a834ca7045931391 +sha1 gnuprumcu-0.5.0.tar.gz 94eb2aeb88f5654fa041bed07c2fb7860af95047 +sha256 gnuprumcu-0.5.0.tar.gz 917043152188ad4626f888dbb620e816a523c0599f9a758230a7d687daf915af +sha512 gnuprumcu-0.5.0.tar.gz cc3071913db9c364c2e3966ab580b703700c85a3d292e230b5536df45b54e0137dc1e83a2fae80947e3c1ad178e5b6b6d8319a3d576653b423178c443386bd17 diff --git a/packages/gnuprumcu/0.5.0/version.desc b/packages/gnuprumcu/0.5.0/version.desc new file mode 100644 index 0000000..e69de29 diff --git a/packages/gnuprumcu/package.desc b/packages/gnuprumcu/package.desc new file mode 100644 index 0000000..8956bda --- /dev/null +++ b/packages/gnuprumcu/package.desc @@ -0,0 +1,6 @@ +origin='dinux.eu' +repository='git https://github.com/dinuxbg/gnuprumcu.git' +bootstrap='autoreconf -vfi' +relevantpattern='*.*.*' +archive_formats='.tar.gz' +mirrors='https://github.com/dinuxbg/gnuprumcu/releases/download/v${CT_GNUPRUMCU_VERSION}' diff --git a/samples/pru/crosstool.config b/samples/pru/crosstool.config index 5072dd6..529ebd9 100644 --- a/samples/pru/crosstool.config +++ b/samples/pru/crosstool.config @@ -12,4 +12,5 @@ CT_LIBC_NEWLIB_EXTRA_SECTIONS=y CT_LIBC_NEWLIB_NANO_MALLOC=y CT_LIBC_NEWLIB_NANO_FORMATTED_IO=y CT_CC_LANG_CXX=y +CT_COMP_LIBS_GNUPRUMCU=y CT_COMP_TOOLS_MAKE=y diff --git a/scripts/build/companion_libs/400-gnuprumcu.sh b/scripts/build/companion_libs/400-gnuprumcu.sh new file mode 100644 index 0000000..14546f3 --- /dev/null +++ b/scripts/build/companion_libs/400-gnuprumcu.sh @@ -0,0 +1,89 @@ +# Build script for gnuprumcu + +do_gnuprumcu_get() { :; } +do_gnuprumcu_extract() { :; } +do_gnuprumcu_for_build() { :; } +do_gnuprumcu_for_host() { :; } +do_gnuprumcu_for_target() { :; } + +if [ "${CT_COMP_LIBS_GNUPRUMCU}" = "y" ]; then + +do_gnuprumcu_get() { + CT_Fetch GNUPRUMCU +} + +do_gnuprumcu_extract() { + CT_ExtractPatch GNUPRUMCU +} + + +do_gnuprumcu_for_target() { + local -a gnuprumcu_opts + + CT_DoStep INFO "Installing gnuprumcu for the target" + CT_mkdir_pushd "${CT_BUILD_DIR}/build-gnuprumcu-target-${CT_TARGET}" + + gnuprumcu_opts+=( "destdir=${CT_SYSROOT_DIR}" ) + gnuprumcu_opts+=( "host=${CT_HOST}" ) + + gnuprumcu_opts+=( "cflags=${CT_ALL_TARGET_CFLAGS}" ) + gnuprumcu_opts+=( "prefix=${CT_PREFIX_DIR}" ) + do_gnuprumcu_backend "${gnuprumcu_opts[@]}" + + CT_Popd + CT_EndStep +} + + +# Build gnuprumcu +# Parameter : description : type : default +# destdir : out-of-tree install dir : string : / +# host : machine to run on : tuple : (none) +# prefix : prefix to install into : dir : (none) +# cflags : cflags to use : string : (empty) +# ldflags : ldflags to use : string : (empty) +# shared : also buils shared lib : bool : n +do_gnuprumcu_backend() { + local destdir="/" + local host + local prefix + local cflags + local ldflags + local shared + local -a extra_config + local arg + + for arg in "$@"; do + eval "${arg// /\\ }" + done + + CT_DoLog EXTRA "Configuring gnuprumcu" + + CT_DoExecLog CFG \ + CC="${host}-gcc" \ + RANLIB="${host}-ranlib" \ + CFLAGS="${cflags}" \ + LDFLAGS="${ldflags}" \ + ${CONFIG_SHELL} \ + "${CT_SRC_DIR}/gnuprumcu/configure" \ + --build=${CT_BUILD} \ + --host=${host} \ + --target=${CT_TARGET} \ + --prefix="${prefix}" \ + "${extra_config[@]}" + + CT_DoLog EXTRA "Building gnuprumcu" + CT_DoExecLog ALL make + + CT_DoLog EXTRA "Installing gnuprumcu" + + # Guard against $destdir$prefix == // + # which is a UNC path on Cygwin/MSYS2 + if [[ ${destdir} == / ]] && [[ ${prefix} == /* ]]; then + destdir= + fi + + CT_DoExecLog ALL make instroot="${destdir}" install +} + +fi # CT_COMP_LIBS_GNUPRUMCU -- cgit v0.10.2-6-g49f6