import meta-zephyr-sdk into sdk-ng

Pull commit 02e1ec6d512fbb2bfea10f56e83a7ac83753560d of
meta-zephyr-sdk into sdk-ng so there is only one repo to deal with for
sdk-ng.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2019-01-14 08:03:47 -06:00 committed by Anas Nashif
parent 789f532500
commit bb085e6d6a
100 changed files with 5967 additions and 1 deletions

View File

@ -34,7 +34,6 @@ build:
- unset CC
- >
if [ "${TARGET}" == 'tools' ]; then
git clone https://github.com/zephyrproject-rtos/meta-zephyr-sdk.git;
./meta-zephyr-sdk/scripts/meta-zephyr-sdk-clone.sh;
./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh tools || ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh tools || ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh tools;
mv ./meta-zephyr-sdk/scripts/toolchains/zephyr-sdk-x86_64-hosttools-standalone-0.9.sh .

View File

@ -0,0 +1,17 @@
version: 2
requirements:
signed_off_by:
required: false
groups:
code-review:
approve_by_comment:
approve_regex: ^Approved
enabled: true
reject_regex: ^Rejected
required: 1
reset_on_push:
enabled: false
users:
- nashif

View File

@ -0,0 +1,46 @@
language: c
compiler: gcc
env:
matrix:
- SDK_TARGET=tools
- SDK_TARGET=xtensa
- SDK_TARGET=x86
- SDK_TARGET=arm
- SDK_TARGET=iamcu
- SDK_TARGET=arc
- SDK_TARGET=mips
- SDK_TARGET=nios2
- SDK_TARGET=riscv32
build:
cache: false
pre_ci_boot:
image_name: zephyrprojectrtos/ci
image_tag: v0.4-rc7
pull: true
options: "-e HOME=/home/buildslave --privileged=true --tty --net=bridge --user buildslave"
ci:
- cd ..
- ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-clone.sh
- ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh ${SDK_TARGET} || ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh ${SDK_TARGET} || ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build-split.sh ${SDK_TARGET}
- >
if [ "$IS_PULL_REQUEST" = "false" ]; then
sudo -E sh -c 'echo "IS_GIT_TAG=${IS_GIT_TAG}" >> $JOB_STATE/sdk.env';
sudo -E sh -c 'echo "IS_RELEASE=${IS_RELEASE}" >> $JOB_STATE/sdk.env';
sudo -E sh -c 'echo "IS_PRERELEASE=${IS_PRERELEASE}" >> $JOB_STATE/sdk.env';
sudo -E sh -c 'echo "GIT_TAG_NAME=${GIT_TAG_NAME}" >> $JOB_STATE/sdk.env';
cat $JOB_STATE/sdk.env;
export S3_PATH="s3://incoming.zephyrproject.org/sdk/${METAZEPHYRSDK_CIREPO_VERSIONNUMBER}";
mkdir -p ./meta-zephyr-sdk/scripts/toolchains/;
cp ./meta-zephyr-sdk/scripts/make_zephyr_sdk.sh ./meta-zephyr-sdk/scripts/toolchains/;
cp ./meta-zephyr-sdk/scripts/template_dir ./meta-zephyr-sdk/scripts/toolchains/;
aws s3 sync ./meta-zephyr-sdk/scripts/toolchains/ ${S3_PATH}/toolchains/;
fi
integrations:
generic:
- integrationName: aws_s3_simple

22
meta-zephyr-sdk/LICENSE Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 otcshare
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

27
meta-zephyr-sdk/README.md Normal file
View File

@ -0,0 +1,27 @@
[![Run Status](https://api.shippable.com/projects/58ffb2b82ddacd0900464db0/badge?branch=master)](https://app.shippable.com/github/zephyrproject-rtos/meta-zephyr-sdk)
# Build Zephyr SDK
Build the SDK in Docker using poky-zephyr-sdk container, follow the instructions below:
```
$ cd $HOME
$ mkdir -p zephyr-sdk
$ git clone git@github.com:zephyrproject-rtos/meta-zephyr-sdk.git zephyr-sdk/meta-zephyr-sdk
$ docker run --privileged --rm -it -v $HOME/zephyr-sdk:/workdir crops/poky-zephyr-sdk --workdir=/workdir
```
Once in the container, clone the repos and build the SDK:
```
workdir$ ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-clone.sh
workdir$ ./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build.sh
```
When finished, the resulting SDK binary can be found under
workdir/poky/meta-zephyr-sdk/scripts
For more info about container, please see: https://github.com/crops/poky-container

View File

@ -0,0 +1,16 @@
SANITY_TESTED_DISTROS = " \
Ubuntu-14.04 \n \
Ubuntu-15.04 \n \
Ubuntu-16.04 \n \
Fedora-23 \n \
"
DISTRO = "zephyr-sdk"
DISTRO_CODENAME = "zephyr-sdk"
DISTRO_NAME = "Zephyr Yocto Toolchain"
MAINTAINER = "Intel Yocto team"
SSTATE_DIR ?= "${TOPDIR}/../zephyr-cache/sstate-cache"
CACHE_forcevariable = "${TOPDIR}/../zephyr-cache/cache"
PERSISTENT_DIR = "${TOPDIR}/../zephyr-cache/persistent"
DL_DIR ?= "${TOPDIR}/../zephyr-downloads"

View File

@ -0,0 +1,6 @@
require conf/distro/poky.conf
require include/zephyr-sdk.inc
DISTRO_VERSION = "0.9"
PACKAGE_CLASSES = "package_ipk"
TARGET_VENDOR = "-zephyr"

View File

@ -0,0 +1,12 @@
# We have a conf and classes directory, add to BBPATH
BBPATH := "${BBPATH}:${LAYERDIR}"
# We have a packages directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"
LICENSE_PATH += "${LAYERDIR}/files/additional-licenses"
BBFILE_COLLECTIONS += "zephyr-sdk"
BBFILE_PATTERN_zephyr-sdk := "^${LAYERDIR}/"
BBFILE_PRIORITY_zephyr-sdk = "8"

View File

@ -0,0 +1,12 @@
require conf/machine/arch-arc.inc
PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "6.x.arc"
PREFERRED_VERSION_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "6.x.arc"
PREFERRED_VERSION_libgcc ?= "6.x.arc"
PREFERRED_VERSION_binutils-cross-${TARGET_ARCH} ?= "2.26+gitarc"
PREFERRED_VERSION_binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "2.26+gitarc"
PREFERRED_VERSION_gdb-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "7.12+gitarc"
TARGET_LINK_HASH_STYLE = ""

View File

@ -0,0 +1,24 @@
DEFAULTTUNE ?= "arc"
TUNE_ARCH = "arc"
TUNE_PKGARCH = "arc"
TUNE_FEATURES_tune-arc = "littleendian"
TUNE_CCARGS = ""
TUNEVALID[littleendian] = "Little endian mode"
def arc_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
archinfo['arc'] = "endian-little bit-32 "
osinfo['linux'] = "common-linux common-glibc"
targetinfo['arc-linux'] = "arc-linux"
return archinfo, osinfo, targetinfo
SITEINFO_EXTRA_DATAFUNCS = "arc_siteinfo_setfunc"
def arc_machdata_setfunc(machdata, d):
machdata["elf"] = { "arc" : (195, 0, 0, True, 32), }
return machdata
PACKAGEQA_EXTRA_MACHDEFFUNCS = "arc_machdata_setfunc"

View File

@ -0,0 +1,18 @@
DEFAULTTUNE ?= "iamcu"
TARGET_OS_iamcu = "elfiamcu"
TARGET_ARCH = "i586"
TUNE_PKGARCH = "iamcu"
TUNE_FEATURES_tune-iamcu = "iamcu"
TUNE_CCARGS = "-miamcu -m32"
TUNE_ARCH = "i586"
TUNEVALID[iamcu] = "Intel MCU"
def iamcu_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
archinfo['iamcu'] = "endian-little bit-32 "
osinfo['linux'] = "common-linux common-glibc"
targetinfo['iamcu-linux'] = "iamcu-linux"
return archinfo, osinfo, targetinfo
SITEINFO_EXTRA_DATAFUNCS = "iamcu_siteinfo_setfunc"

View File

@ -0,0 +1,24 @@
# Nios2 Architecture Definition
DEFAULTTUNE ?= "nios2"
TUNE_ARCH = "nios2"
TUNE_PKGARCH = "nios2"
TUNE_FEATURES_tune-nios2 = "nios2"
TUNEVALID[bigendian] = "Enable big-endian mode"
TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'bigendian', ' -meb', '', d)}"
TUNEVALID[hw-mul] = "Enable Nios2 Hardware Multiply"
TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'hw-mul', ' -mhw-mul', '', d)}"
TUNEVALID[no-hw-mul] = "Disable Nios2 Hardware Multiply"
TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'no-hw-mul', ' -mno-hw-mul', '', d)}"
TUNEVALID[nios2] = "Altera Nios2"
def nios2_machdata_setfunc(machdata, d):
machdata["elf"] = {"nios2": (113, 0, 0, True, 32), }
return machdata
PACKAGEQA_EXTRA_MACHDEFFUNCS = "nios2_machdata_setfunc"

View File

@ -0,0 +1,23 @@
DEFAULTTUNE ?= "riscv32"
TUNE_ARCH = "riscv32"
TUNE_PKGARCH = "riscv32"
TUNE_FEATURES_tune-riscv32 = "littleendian"
TUNE_CCARGS = " -nostdlib "
TUNEVALID[littleendian] = "Little endian mode"
def riscv32_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
archinfo['riscv32'] = "endian-little bit-32 "
osinfo['linux'] = "common-linux common-glibc"
targetinfo['riscv32-linux'] = "riscv32-linux"
return archinfo, osinfo, targetinfo
SITEINFO_EXTRA_DATAFUNCS = "riscv32_siteinfo_setfunc"
def riscv32_machdata_setfunc(machdata, d):
machdata["elf"] = { "riscv32" : (243, 0, 0, True, 32), }
return machdata
PACKAGEQA_EXTRA_MACHDEFFUNCS = "riscv32_machdata_setfunc"

View File

@ -0,0 +1,34 @@
# Xtensa Architecture Definition
DEFAULTTUNE ?= "xtensa"
TUNEVALID[xtensa] = "Enable Xtensa"
AVAILTUNES += "xtensa"
TUNEVALID[longcalls] = "Enable long calls: emit 32-bit call sequences"
TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'longcalls', ' -mlongcalls', '', d)}"
AVAILTUNES += "longcalls"
TUNEVALID[target-align] = "Try to align branch targets"
TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'target-align', ' -mtarget-align', '', d)}"
AVAILTUNES += "target-align"
TUNE_ARCH = "xtensa"
TUNE_PKGARCH = "xtensa"
TUNE_FEATURES_tune-xtensa = "xtensa"
def xtensa_machdata_setfunc(machdata, d):
machdata["elf"] = {"xtensa": (94, 0, 0, True, 32), }
return machdata
PACKAGEQA_EXTRA_MACHDEFFUNCS = "xtensa_machdata_setfunc"
def xtensa_siteinfo_setfunc(archinfo, osinfo, targetinfo, d):
archinfo['xtensa'] = "endian-little bit-32 "
osinfo['linux'] = "common-linux common-glibc"
targetinfo['xtensa-linux'] = "xtensa-linux"
return archinfo, osinfo, targetinfo
SITEINFO_EXTRA_DATAFUNCS = "xtensa_siteinfo_setfunc"

View File

@ -0,0 +1,3 @@
require conf/machine/arch-iamcu.inc
TARGET_LINK_HASH_STYLE = ""

View File

@ -0,0 +1,3 @@
require conf/machine/arch-nios2.inc
TARGET_LINK_HASH_STYLE = ""

View File

@ -0,0 +1,12 @@
require conf/machine/arch-riscv32.inc
PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "6.x.riscv32"
PREFERRED_VERSION_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "6.x.riscv32"
PREFERRED_VERSION_libgcc ?= "6.x.riscv32"
PREFERRED_VERSION_binutils-cross-${TARGET_ARCH} ?= "2.27+gitriscv32"
PREFERRED_VERSION_binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "2.27+gitriscv32"
PREFERRED_VERSION_gdb-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "7.x.riscv32"
TARGET_LINK_HASH_STYLE = ""

View File

@ -0,0 +1,3 @@
require conf/machine/arch-xtensa.inc
TARGET_LINK_HASH_STYLE = ""

View File

@ -0,0 +1,28 @@
Copyright (C) 2001-2015,
David M. Beazley (Dabeaz LLC)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the David Beazley or Dabeaz LLC may be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,24 @@
Copyright (c) 2011-2012, ShumaTech
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,26 @@
From 972acaccf9764b610aef2a02018b9772133f678d Mon Sep 17 00:00:00 2001
From: Anas Nashif <anas.nashif@intel.com>
Date: Wed, 19 Sep 2018 22:21:32 -0500
Subject: [PATCH] fix git parameter --set-upstream -> --set-upstream-to
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
---
bitbake/lib/bb/fetch2/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 1bec60ab71..792c183763 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -327,7 +327,7 @@ class Git(FetchMethod):
branchname = ud.branches[ud.names[0]]
runfetchcmd("%s checkout -B %s %s" % (ud.basecmd, branchname, \
ud.revisions[ud.names[0]]), d, workdir=destdir)
- runfetchcmd("%s branch --set-upstream %s origin/%s" % (ud.basecmd, branchname, \
+ runfetchcmd("%s branch %s --set-upstream-to origin/%s" % (ud.basecmd, branchname, \
branchname), d, workdir=destdir)
else:
runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d, workdir=destdir)
--
2.14.4

View File

@ -0,0 +1,32 @@
diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass
index ea976c6..57e9439 100644
--- a/meta/classes/kernel-arch.bbclass
+++ b/meta/classes/kernel-arch.bbclass
@@ -32,6 +32,7 @@ def map_kernel_arch(a, d):
elif re.match('microblazee[bl]', a): return 'microblaze'
elif a in valid_archs: return a
else:
+ if d.getVar("TCLIBC", True) == "baremetal": return a;
bb.error("cannot map '%s' to a linux kernel architecture" % a)
export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH', True), d)}"
diff --git a/meta/recipes-core/udev/eudev_3.2.bb b/meta/recipes-core/udev/eudev_3.2.bb
index 211252c..672b689 100644
--- a/meta/recipes-core/udev/eudev_3.2.bb
+++ b/meta/recipes-core/udev/eudev_3.2.bb
@@ -99,3 +99,5 @@ pkg_postinst_eudev-hwdb () {
pkg_prerm_eudev-hwdb () {
rm -f $D${sysconfdir}/udev/hwdb.bin
}
+
+BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-kernel/kmod/kmod_git.bb b/meta/recipes-kernel/kmod/kmod_git.bb
index 69185b2..0205a1f 100644
--- a/meta/recipes-kernel/kmod/kmod_git.bb
+++ b/meta/recipes-kernel/kmod/kmod_git.bb
@@ -60,3 +60,5 @@ PACKAGES =+ "libkmod"
FILES_libkmod = "${base_libdir}/libkmod*${SOLIBS} ${libdir}/libkmod*${SOLIBS}"
FILES_${PN} += "${base_libdir}/depmod.d ${base_libdir}/modprobe.d"
+
+BBCLASSEXTEND = "nativesdk"

View File

@ -0,0 +1,23 @@
create_sdk_files_append_zephyr-sdk() {
rm -fv ${SDK_OUTPUT}/${SDKPATH}/site-config-*
# We need to keep environment-setup-* file becuse the SDK relocate info is
# derived from it.
# rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
# We keep the version info file.
# rm -fv ${SDK_OUTPUT}/${SDKPATH}/version-*
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${MULTIMACH_TARGET_SYS}/etc
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${MULTIMACH_TARGET_SYS}/var
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${MULTIMACH_TARGET_SYS}/run
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${MULTIMACH_TARGET_SYS}/lib
#rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/usr/share
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/etc
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/var
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/sbin
}

View File

@ -0,0 +1,23 @@
Fix unresolved external "fiprintf".
When newlib is configured with:
--enable-newlib-nano-formatted-io
"fiprintf" should be an alias of "fprintf". However the alias does
not seem to work properly, as we encounter unresolved external
error if we uses "assert" in code. So we patch the code directly.
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
--- a/newlib/libc/stdlib/assert.c 2016-11-08 08:04:45.669248139 -0800
+++ b/newlib/libc/stdlib/assert.c 2016-11-08 08:05:47.357554034 -0800
@@ -56,7 +56,7 @@
const char *func _AND
const char *failedexpr)
{
- fiprintf(stderr,
+ fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
failedexpr, file, line,
func ? ", function: " : "", func ? func : "");

View File

@ -0,0 +1,20 @@
newlib-2.4.0 regression.
Export the prototype of gettimeofday
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
--- a/newlib/libc/include/sys/time.h 2016-03-29 14:33:42.000000000 -0700
+++ b/newlib/libc/include/sys/time.h 2016-10-12 09:48:03.873642589 -0700
@@ -429,9 +429,10 @@
int _EXFUN(getitimer, (int __which, struct itimerval *__value));
int _EXFUN(setitimer, (int __which, const struct itimerval *__restrict __value,
struct itimerval *__restrict __ovalue));
+#endif
+
int _EXFUN(gettimeofday, (struct timeval *__restrict __p,
void *__restrict __tz));
-#endif
#if __GNU_VISIBLE
int _EXFUN(futimesat, (int, const char *, const struct timeval [2]));

View File

@ -0,0 +1,399 @@
From 5d3ad3b123b7c121d7a6eac27fb13016171e27bc Mon Sep 17 00:00:00 2001
From: Igor Venevtsev <igor.venevtsev@gmail.com>
Date: Thu, 31 Mar 2016 12:12:00 +0300
Subject: Add Intel MCU target
Intel MCU System V ABI are incompartible with i386 System V ABI:
o Minimum instruction set is Intel Pentium ISA minus x87 instructions
o No x87 or vector registers
o First three args are passed in %eax, %edx and %ecx
o Full specification available here:
https://github.com/hjl-tools/x86-psABI/wiki/iamcu-psABI-0.7.pdf
newlib/
* configure.host: Add new ix86-*-elfiamcu target
newlib/libc/include/
* setjmp.h: Change _JBLEN for Intel MCU target
newlib/libc/machine/i386/
* memchr.S: (memchr) Target-specific size-optimized version
* memcmp.S: (memcmp) Likewise
* memcpy.S: (memcpy) Likewise
* memmove.S: (memmove) Likewise
* memset.S: (memset) Likewise
* setjmp.S: (setjmp) Likewise
* strchr.S: (strchr) Likewise
* strlen.S: (strlen) Likewise
newlib/libc/stdlib/
* srtold.c: (__flt_rounds) Disable for Intel MCU
diff --git a/newlib/configure.host b/newlib/configure.host
index 8b0846e..bb163ec 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -696,6 +696,15 @@ case "${host}" in
i[34567]86-*-netware*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
;;
+ i[3-7]86-*-elfiamcu)
+ newlib_cflags="${newlib_cflags} -Os -DPREFER_SIZE_OVER_SPEED -ffunction-sections -fomit-frame-pointer -DREENTRANT_SYSCALL_PROVIDED"
+ if [ "${newlib_multithread}" = "no" ] ; then
+ newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
+ else
+ syscall_dir=syscalls
+ newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
+ fi
+ ;;
iq2000*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index c08e682..2b4dd8b 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -92,6 +92,9 @@ _BEGIN_STD_C
# define _JBLEN (13 * 4)
# elif defined(__unix__) || defined(__rtems__)
# define _JBLEN 9
+# elif defined(__iamcu__)
+/* Intel MCU jmp_buf only covers callee-saved registers. */
+# define _JBLEN 6
# else
# include "setjmp-dj.h"
# endif
diff --git a/newlib/libc/machine/i386/memchr.S b/newlib/libc/machine/i386/memchr.S
index 7639685..d9b0bf2 100644
--- a/newlib/libc/machine/i386/memchr.S
+++ b/newlib/libc/machine/i386/memchr.S
@@ -14,13 +14,33 @@
SOTYPE_FUNCTION(memchr)
SYM (memchr):
+#ifdef __iamcu__
+ pushl edi
+ movl eax,edi
+ movl edx,eax
+ xorl edx,edx
+ testl ecx,ecx
+ jz L20
+
+ repnz
+ scasb
+
+ setnz dl
+ decl edi
+
+ decl edx
+ andl edi,edx
+L20:
+ movl edx,eax
+
+ popl edi
+#else
pushl ebp
movl esp,ebp
pushl edi
movzbl 12(ebp),eax
movl 16(ebp),ecx
movl 8(ebp),edi
-
xorl edx,edx
testl ecx,ecx
jz L20
@@ -111,4 +131,5 @@ L20:
leal -4(ebp),esp
popl edi
leave
+#endif
ret
diff --git a/newlib/libc/machine/i386/memcmp.S b/newlib/libc/machine/i386/memcmp.S
index 26b8ef1..4a01b82 100644
--- a/newlib/libc/machine/i386/memcmp.S
+++ b/newlib/libc/machine/i386/memcmp.S
@@ -15,6 +15,33 @@
SYM (memcmp):
+#ifdef __iamcu__
+ pushl edi
+ pushl esi
+ movl eax,edi
+ movl edx,esi
+ cld
+
+/* check if length is zero in which case just return 0 */
+
+ xorl eax,eax
+ testl ecx,ecx
+ jz L4
+
+/* compare any unaligned bytes or remainder bytes */
+ repz
+ cmpsb
+
+/* set output to be < 0 if less than, 0 if equal, or > 0 if greater than */
+ xorl edx,edx
+ movb -1(esi),dl
+ movb -1(edi),al
+ subl edx,eax
+
+L4:
+ popl esi
+ popl edi
+#else
pushl ebp
movl esp,ebp
subl $16,esp
@@ -73,4 +100,5 @@ L4:
popl edi
popl ebx
leave
+#endif
ret
diff --git a/newlib/libc/machine/i386/memcpy.S b/newlib/libc/machine/i386/memcpy.S
index b53e2a1..a14aa2a 100644
--- a/newlib/libc/machine/i386/memcpy.S
+++ b/newlib/libc/machine/i386/memcpy.S
@@ -15,6 +15,17 @@
SYM (memcpy):
+#ifdef __iamcu__
+ pushl esi
+ pushl edi
+ movl eax,edi
+ movl edx,esi
+
+ rep movsb
+
+ popl edi
+ popl esi
+#else
pushl ebp
movl esp,ebp
pushl esi
@@ -71,4 +82,5 @@ SYM (memcpy):
popl edi
popl esi
leave
+#endif
ret
diff --git a/newlib/libc/machine/i386/memmove.S b/newlib/libc/machine/i386/memmove.S
index 1ea2f6d..1026582 100644
--- a/newlib/libc/machine/i386/memmove.S
+++ b/newlib/libc/machine/i386/memmove.S
@@ -15,6 +15,32 @@
SYM (memmove):
+#ifdef __iamcu__
+ pushl esi
+ pushl edi
+ movl eax,edi
+ movl edx,esi
+ cmp esi,edi
+ ja .Lcopy_backward
+ je .Lbwd_write_0bytes
+
+ rep movsb
+
+ popl edi
+ popl esi
+ ret
+
+.Lcopy_backward:
+ lea -1(edi,ecx),edi
+ lea -1(esi,ecx),esi
+ std
+ rep movsb
+ cld
+
+.Lbwd_write_0bytes:
+ popl edi
+ popl esi
+#else
pushl ebp
movl esp,ebp
pushl esi
@@ -143,4 +169,5 @@ SYM (memmove):
popl edi
popl esi
leave
+#endif
ret
diff --git a/newlib/libc/machine/i386/memset.S b/newlib/libc/machine/i386/memset.S
index 6eb2cd6..83b2556 100644
--- a/newlib/libc/machine/i386/memset.S
+++ b/newlib/libc/machine/i386/memset.S
@@ -15,6 +15,15 @@
SYM (memset):
+#ifdef __iamcu__
+ pushl edi
+ movl eax,edi
+ movzbl dl,eax
+ mov edi,edx
+ rep stosb
+ mov edx,eax
+ popl edi
+#else
pushl ebp
movl esp,ebp
pushl edi
@@ -96,4 +105,5 @@ SYM (memset):
leal -4(ebp),esp
popl edi
leave
+#endif
ret
diff --git a/newlib/libc/machine/i386/setjmp.S b/newlib/libc/machine/i386/setjmp.S
index fd746e4..45c689f 100644
--- a/newlib/libc/machine/i386/setjmp.S
+++ b/newlib/libc/machine/i386/setjmp.S
@@ -20,6 +20,10 @@
** jmp_buf:
** eax ebx ecx edx esi edi ebp esp eip
** 0 4 8 12 16 20 24 28 32
+ **
+ ** Intel MCU jmp_buf:
+ ** ebx esi edi ebp esp eip
+ ** 0 4 8 12 16 20
*/
#include "i386mach.h"
@@ -31,6 +35,23 @@
SYM (setjmp):
+#ifdef __iamcu__
+ /* Store EIP. */
+ movl 0(esp),ecx
+ movl ecx,20(eax)
+
+ movl ebx,0 (eax)
+ movl esi,4 (eax)
+ movl edi,8 (eax)
+ movl ebp,12(eax)
+
+ /* Skip return address, which will be pushed onto stack in
+ longjmp, and store SP. */
+ leal 4(esp),ecx
+ movl ecx,16(eax)
+
+ xorl eax,eax
+#else
pushl ebp
movl esp,ebp
@@ -59,9 +80,28 @@ SYM (setjmp):
popl edi
movl $0,eax
leave
+#endif
ret
SYM (longjmp):
+#ifdef __iamcu__
+ /* Check retval. */
+ testl edx,edx
+ jne 0f
+ incl edx
+0:
+ /* Restore stack first. */
+ movl 16(eax),esp
+
+ /* Put return address on stack. */
+ pushl 20(eax)
+
+ movl 0(eax),ebx
+ movl 4(eax),esi
+ movl 8(eax),edi
+ movl 12(eax),ebp
+ movl edx,eax
+#else
pushl ebp
movl esp,ebp
@@ -87,5 +127,6 @@ SYM (longjmp):
movl 16(edi),esi
movl 20(edi),edi
__STI
+#endif
ret
diff --git a/newlib/libc/machine/i386/strchr.S b/newlib/libc/machine/i386/strchr.S
index 1d98b81..43ee0fb 100644
--- a/newlib/libc/machine/i386/strchr.S
+++ b/newlib/libc/machine/i386/strchr.S
@@ -15,6 +15,29 @@
SYM (strchr):
+#ifdef __iamcu__
+ xorl ecx,ecx
+ movb dl,cl
+
+/* loop while (*s && *s++ != c) */
+ leal -1(eax),eax
+L15:
+ incl eax
+ movb (eax),dl
+ testb dl,dl
+ je L14
+ cmpb cl,dl
+ jne L15
+
+L14:
+/* if (*s == c) return address otherwise return NULL */
+ cmpb cl,(eax)
+ je L19
+ xorl eax,eax
+
+L19:
+ ret
+#else
pushl ebp
movl esp,ebp
pushl edi
@@ -170,3 +193,5 @@ L27:
jmp L9
#endif /* !__OPTIMIZE_SIZE__ */
+
+#endif /* __iamcu__ */
diff --git a/newlib/libc/machine/i386/strlen.S b/newlib/libc/machine/i386/strlen.S
index 0e3cb64..373ea0f 100644
--- a/newlib/libc/machine/i386/strlen.S
+++ b/newlib/libc/machine/i386/strlen.S
@@ -18,9 +18,13 @@ SYM (strlen):
pushl ebp
movl esp,ebp
pushl edi
+#ifdef __iamcu__
+ movl eax,edx
+#else
movl 8(ebp),edx
+#endif
-#ifdef __OPTIMIZE_SIZE__
+#if defined __OPTIMIZE_SIZE__ || defined __iamcu__
cld
movl edx,edi
movl $4294967295,ecx
diff --git a/newlib/libc/stdlib/strtold.c b/newlib/libc/stdlib/strtold.c
index a6d415d..1128b74 100644
--- a/newlib/libc/stdlib/strtold.c
+++ b/newlib/libc/stdlib/strtold.c
@@ -35,7 +35,8 @@ POSSIBILITY OF SUCH DAMAGE.
#ifdef _HAVE_LONG_DOUBLE
-#if defined (__x86_64__) || defined (__i386__)
+/* Intel MCU has no x87 floating point unit */
+#if (defined (__x86_64__) || defined (__i386__)) && !defined (__iamcu__)
static const int map[] = {
1, /* round to nearest */
3, /* round to zero */

View File

@ -0,0 +1,13 @@
diff --git a/config.sub b/config.sub
index 7ffe373..1ec3c1c 100755
--- a/config.sub
+++ b/config.sub
@@ -449,7 +449,7 @@ case $basic_machine in
| z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
- xtensa*)
+ xtensa* | riscv*)
basic_machine=$basic_machine-unknown
;;
# Recognize the various machine names and aliases which stand

View File

@ -0,0 +1,56 @@
--- original-newlib/newlib/configure.host
+++ newlib/newlib/configure.host
@@ -210,6 +210,10 @@ case "${host_cpu}" in
mep)
machine_dir=mep
;;
+ riscv*)
+ machine_dir=riscv
+ newlib_cflags="${newlib_cflags}"
+ ;;
mips*)
machine_dir=mips
;;
--- original-newlib/newlib/libc/include/machine/ieeefp.h
+++ newlib/newlib/libc/include/machine/ieeefp.h
@@ -170,6 +170,14 @@
#define __IEEE_LITTLE_ENDIAN
#endif
+#ifdef __riscv__
+# ifdef __RISCVEL__
+# define __IEEE_LITTLE_ENDIAN
+# else
+# define __IEEE_BIG_ENDIAN
+# endif
+#endif
+
#ifdef __i960__
#define __IEEE_LITTLE_ENDIAN
#endif
--- original-newlib/newlib/libc/include/machine/setjmp.h
+++ newlib/newlib/libc/include/machine/setjmp.h
@@ -338,6 +338,11 @@ _BEGIN_STD_C
#define _JBLEN 0x44
#endif
+#ifdef __riscv__
+#define _JBTYPE long
+#define _JBLEN ((16*sizeof(long) + 12*sizeof(double))/sizeof(long))
+#endif
+
#ifdef _JBLEN
#ifdef _JBTYPE
typedef _JBTYPE jmp_buf[_JBLEN];
--- original-newlib/newlib/libc/machine/configure
+++ newlib/newlib/libc/machine/configure
@@ -11882,6 +11883,8 @@ subdirs="$subdirs a29k"
;;
mips) subdirs="$subdirs mips"
;;
+ riscv) subdirs="$subdirs riscv"
+ ;;
mn10200) subdirs="$subdirs mn10200"
;;
mn10300) subdirs="$subdirs mn10300"

View File

@ -0,0 +1,95 @@
HOMEPAGE = "https://sourceware.org/newlib/"
SUMMARY = "C library for embedded systems"
DESCRIPTION = "Newlib is a conglomeration of several library parts, all under free software licenses that make them easily usable on embedded products."
PV = "2.4.0"
LICENSE = "GPLv2 & LGPLv3 & GPLv3 & LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING.LIBGLOSS;md5=73f5c98779aea7dba4a6c94a74ab0ae2 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.NEWLIB;md5=fced02ba02d66f274d4847d27e80af74 \
file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0"
SRC_URI = "ftp://sourceware.org/pub/newlib/newlib-${PV}.tar.gz"
SRC_URI[md5sum] = "37c07a65c6effdb4822fb6f83067f37e"
SRC_URI[sha256sum] = "545b3d235e350d2c61491df8b9f775b1b972f191380db8f52ec0b1c829c52706"
SRC_URI += "file://gettimeofday-header-fix.patch"
SRC_URI += "file://assert-fiprintf.patch"
SRC_URI += "file://iamcu-commit-5d3ad3b.patch"
S = "${WORKDIR}/newlib-${PV}"
DEPENDS = "flex-native bison-native m4-native"
DEPENDS_remove = "virtual/libc virtual/${TARGET_PREFIX}compilerlibs"
PACKAGES = "${PN}"
# x86 specific settings
TUNE_CCARGS_x86 := " -nostdlib"
# MIPS specific settings
TUNE_CCARGS_mips := "-nostdlib"
# ARM specific settings
TUNE_CCARGS_arm := "-nostdlib"
# NIOS2 specific settings
TUNE_CCARGS_nios2 := " -nostdlib"
# IAMCU specific settings
TUNE_CCARGS_iamcu := " -nostdlib -miamcu -m32"
# This will determine the name of the folder with libc as well.
NEWLIB_HOST = "${TARGET_SYS}"
CFLAGS += " -DMISSING_SYSCALL_NAMES "
# Specify any options you want to pass to the configure script using EXTRA_OECONF:
EXTRA_OECONF = " --enable-languages=c \
--host=${NEWLIB_HOST} \
--with-newlib --with-gnu-as --with-gnu-ld -v \
--disable-newlib-supplied-syscalls \
--disable-newlib-wide-orient \
--disable-newlib-fseek-optimization \
--enable-newlib-nano-formatted-io \
--enable-newlib-nano-malloc \
--disable-newlib-fvwrite-in-streamio \
--disable-newlib-unbuf-stream-opt --enable-lite-exit \
--enable-newlib-global-atexit \
"
do_configure () {
# If we're being rebuilt due to a dependency change, we need to make sure
# everything is clean before we configure and build -- if we haven't previously
# built this will fail and be ignored.
make distclean || :
export CC_FOR_TARGET="${CC}"
${S}/configure ${EXTRA_OECONF}
}
do_install () {
oe_runmake 'DESTDIR=${D}' install
# Delete standards.info, configure.info
rm -rf ${D}/usr/share/
# Place the libraries where gcc can find them
# usr/${NEWLIB_HOST}/lib -> usr/lib
# usr/${NEWLIB_HOST}/include ->usr/include
mv -v ${D}/usr/local/${NEWLIB_HOST}/lib* ${D}/usr/lib
mv -v ${D}/usr/local/${NEWLIB_HOST}/include* ${D}/usr/include
rm -rf ${D}/usr/local/${NEWLIB_HOST}
rm -rf ${D}/usr/local
}
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
FILES_${PN} = "/usr/lib /usr/include"
INSANE_SKIP_${PN} += " staticdev"
INSANE_SKIP_${PN}-dev += " staticdev"

View File

@ -0,0 +1,89 @@
########################################################################
#
# ARC specific
#
########################################################################
LIC_FILES_CHKSUM_arc = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \
file://COPYING.NEWLIB;md5=fced02ba02d66f274d4847d27e80af74 \
file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0"
#Tag arc-2016.03
SRCREV_arc = "e4da0f88abe8dd2a0b947bcf7cb8b3736ab94f33"
SRC_URI_arc = "git://github.com/foss-for-synopsys-dwc-arc-processors/newlib.git;branch=arc-2.3"
SRC_URI_arc += "file://assert-fiprintf.patch"
S_arc = "${WORKDIR}/git"
EXTRA_OECONF_append_arc = " --enable-multilib "
TUNE_CCARGS_arc := " -nostdlib -mno-sdata "
# ERROR: QA Issue: Architecture did not match (195 to 93)
INSANE_SKIP_${PN}_arc += " arch "
INSANE_SKIP_${PN}_arc += " staticdev "
########################################################################
#
# XTENSA specific
#
########################################################################
PV_xtensa = "2.2.0"
FILESEXTRAPATHS_prepend_xtensa := "${THISDIR}/${PN}:"
LIC_FILES_CHKSUM_xtensa = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \
file://COPYING.NEWLIB;md5=3e3652588619359190b26489933b4334 \
file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0"
SRC_URI_xtensa = "git://github.com/jcmvbkbc/newlib-xtensa.git;protocol=https;branch=xtensa"
SRCREV_xtensa = "b06f1b57cdf0c6dbe20caaca2da0f78004d71ec4"
SRC_URI_xtensa += "file://assert-fiprintf.patch"
S_xtensa = "${WORKDIR}/git"
# XTENSA specific settings
TUNE_CCARGS_xtensa := " -nostdlib"
# Copy newlib overlay files into the source tree before applying patches.
# There's no overlay when building for other architectures, so don't do
# anything if there are no files to copy.
python do_patch_prepend_xtensa () {
os.system('tar -xf ' + d.getVar('STAGING_DIR_TARGET', True) +
'/usr/src/xtensa-config/xtensa-overlay.tar.gz --strip-components=1 -C ' +
d.getVar('S', True) + ' newlib')
}
do_patch[depends] += "xtensa-config:do_populate_sysroot"
########################################################################
#
# RISC-V specific
#
########################################################################
PV_riscv32 = "2.2.0"
LIC_FILES_CHKSUM_riscv32 = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \
file://COPYING.NEWLIB;md5=27039641b800547bbcea82a8a5b707ad \
file://newlib/libc/posix/COPYRIGHT;md5=103468ff1982be840fdf4ee9f8b51bbf \
file://newlib/libc/sys/linux/linuxthreads/LICENSE;md5=73640207fbc79b198c7ffd4ad4d97aa0"
SRC_URI_riscv32 = "git://github.com/riscv/riscv-newlib.git;protocol=https;branch=riscv-newlib-2.2.0"
SRC_URI_riscv32 += "file://riscv32-newlib.patch"
SRC_URI_riscv32 += "file://assert-fiprintf.patch"
SRC_URI_riscv32 += "file://riscv32-config.sub.patch"
SRCREV_riscv32 = "77f0072999addb5d5b5c551baec21565aaf3a9e0"
S_riscv32 = "${WORKDIR}/git"
EXTRA_OECONF_append_riscv32 = " --disable-multilib "
# RISC-V specific settings
TUNE_CCARGS_riscv32 := " -nostdlib"

View File

@ -0,0 +1,38 @@
LIC_FILES_CHKSUM="\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
"
def binutils_branch_version(d):
pvsplit = d.getVar('PV', True).split('.')
return pvsplit[0] + "_" + pvsplit[1]
BINUPV = "${@binutils_branch_version(d)}"
PV = "2.29+gitarc"
#SRCREV = "bcbe0bfce780e426f2e3b78013cb49326ee76824"
# arc-2018.03-rc2
SRCREV="595e2800153fa16067c1eaf769758d67046efcfb"
SRC_URI = "\
git://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git;branch=arc-2018.03 \
"
S = "${WORKDIR}/git"
do_configure_prepend () {
rm -rf ${S}/gdb ${S}/libdecnumber ${S}/readline ${S}/sim
}
CONFIG_SHELL = "/bin/bash"
sysroot_stage_all_append() {
sysroot_stage_dir ${D}${exec_prefix}/extlib ${SYSROOT_DESTDIR}${exec_prefix}/extlib
}

View File

@ -0,0 +1,7 @@
require recipes-devtools/binutils/binutils.inc
require recipes-devtools-arc/binutils/binutils-2.29arc.inc
require recipes-devtools/binutils/binutils-cross-canadian.inc
do_install_append () {
rm -f ${D}/${libdir}/../lib/libiberty*
}

View File

@ -0,0 +1,5 @@
require recipes-devtools/binutils/binutils.inc
require binutils-2.29arc.inc
require recipes-devtools/binutils/binutils-cross.inc
COMPATIBLE_MACHINE = "arc"

View File

@ -0,0 +1,83 @@
From cbd8e54244cd02bdcf4f1057be3ce96631f35ac3 Mon Sep 17 00:00:00 2001
From: Claudiu Zissulescu <claziss@gmail.com>
Date: Tue, 3 Jan 2017 12:06:28 -0500
Subject: [PATCH] [ARC] Prevent moving stores to the frame before the stack
adjustment.
If the stack pointer is needed, emit a special barrier that will prevent
the scheduler from moving stores to the frame before the stack adjustment.
2017-01-03 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (arc_expand_prologue): Emit a special barrier
to prevent store reordering.
* config/arc/arc.md (UNSPEC_ARC_STKTIE): Define.
(type): Add block type.
(stack_tie): Define special instruction to be used in
expand_prologue.
---
gcc/config/arc/arc.c | 10 +++++++++-
gcc/config/arc/arc.md | 15 ++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 6f21fc3..110556c 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -3101,7 +3101,15 @@ arc_expand_prologue (void)
frame_size_to_allocate -= first_offset;
/* Allocate the stack frame. */
if (frame_size_to_allocate > 0)
- frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
+ {
+ frame_stack_add ((HOST_WIDE_INT) 0 - frame_size_to_allocate);
+ /* If the frame pointer is needed, emit a special barrier that
+ will prevent the scheduler from moving stores to the frame
+ before the stack adjustment. */
+ if (arc_frame_pointer_needed ())
+ emit_insn (gen_stack_tie (stack_pointer_rtx,
+ hard_frame_pointer_rtx));
+ }
/* Setup the gp register, if needed. */
if (crtl->uses_pic_offset_table)
diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index 16f71b3..448157c 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -135,6 +135,7 @@
UNSPEC_ARC_VMAC2HU
UNSPEC_ARC_VMPY2H
UNSPEC_ARC_VMPY2HU
+ UNSPEC_ARC_STKTIE
])
(define_c_enum "vunspec" [
@@ -204,7 +205,7 @@
simd_vcompare, simd_vpermute, simd_vpack, simd_vpack_with_acc,
simd_valign, simd_valign_with_acc, simd_vcontrol,
simd_vspecial_3cycle, simd_vspecial_4cycle, simd_dma, mul16_em, div_rem,
- fpu"
+ fpu, block"
(cond [(eq_attr "is_sfunc" "yes")
(cond [(match_test "!TARGET_LONG_CALLS_SET && (!TARGET_MEDIUM_CALLS || GET_CODE (PATTERN (insn)) != COND_EXEC)") (const_string "call")
(match_test "flag_pic") (const_string "sfunc")]
@@ -6480,6 +6481,18 @@
(set_attr "predicable" "yes,no,no,yes,no")
(set_attr "cond" "canuse,nocond,nocond,canuse_limm,nocond")])
+(define_insn "stack_tie"
+ [(set (mem:BLK (scratch))
+ (unspec:BLK [(match_operand:SI 0 "register_operand" "rb")
+ (match_operand:SI 1 "register_operand" "rb")]
+ UNSPEC_ARC_STKTIE))]
+ ""
+ ""
+ [(set_attr "length" "0")
+ (set_attr "iscompact" "false")
+ (set_attr "type" "block")]
+ )
+
;; include the arc-FPX instructions
(include "fpx.md")

View File

@ -0,0 +1,88 @@
require recipes-devtools/gcc/gcc-common.inc
# Third digit in PV should be incremented after a minor release
PV = "6.x.arc"
# BINV should be incremented to a revision after a minor gcc release
BINV = "6.2.1"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${COREBASE}/meta/recipes-devtools/gcc/gcc-6.2:"
DEPENDS =+ "mpfr gmp libmpc zlib"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
"
# tag=arc-2016.09-release (no branch)
SRCREV="11f277e211411c21808cbb9f6cf165902edefea3"
SRC_URI = "\
git://github.com/foss-for-synopsys-dwc-arc-processors/gcc.git;protocol=https;nobranch=1 \
file://0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0039-Fix-various-_FOR_BUILD-and-related-variables.patch \
file://cbd8e54244cd02bdcf4f1057be3ce96631f35ac3.patch \
"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
# Language Overrides
FORTRAN = ""
JAVA = ""
LTO = "--enable-lto"
EXTRA_OECONF_BASE = "\
${LTO} \
--enable-libssp \
--disable-bootstrap \
--disable-libmudflap \
--with-system-zlib \
--enable-linker-build-id \
--with-ppl=no \
--with-cloog=no \
--enable-checking=release \
--enable-cheaders=c_global \
"
EXTRA_OECONF_INITIAL = "\
--disable-libmudflap \
--disable-libgomp \
--disable-libssp \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--enable-decimal-float=no \
"
EXTRA_OECONF_INTERMEDIATE = "\
--disable-libmudflap \
--disable-libgomp \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--disable-libssp \
"
EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
EXTRA_OECONF_append_arc = ' --with-pkgversion="ARCompact/ARCv2 ISA elf32 toolchain ${SRCREV}"'
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++/${BINV} \
--with-sysroot=${STAGING_DIR_TARGET} \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"

View File

@ -0,0 +1,8 @@
require recipes-devtools-arc/gcc/gcc-${PV}.inc
require recipes-devtools/gcc/gcc-cross-canadian.inc
EXTRA_OECONF_append_libc-baremetal = " --without-headers"
EXTRA_OECONF_remove_libc-baremetal = "--with-sysroot=/not/exist"
EXTRA_OECONF_remove_libc-baremetal = "--with-build-sysroot=${STAGING_DIR_TARGET}"
EXTRA_OECONF_append_libc-baremetal = " --enable-plugin "

View File

@ -0,0 +1,11 @@
require recipes-devtools-arc/gcc/gcc-6.x.arc.inc
require recipes-devtools/gcc/gcc-cross.inc
DEPENDS_remove_libc-baremetal := "virtual/${TARGET_PREFIX}libc-for-gcc"
EXTRA_OECONF_append_libc-baremetal = " --without-headers"
EXTRA_OECONF_remove_libc-baremetal = "--with-sysroot=/not/exist"
EXTRA_OECONF_remove_libc-baremetal = "--enable-threads=posix"
COMPATIBLE_MACHINE = "arc"
BBCLASSEXTEND = "nativesdk"

View File

@ -0,0 +1,2 @@
require recipes-devtools-arc/gcc/gcc-6.x.arc.inc
require recipes-devtools/gcc/gcc-source.inc

View File

@ -0,0 +1,14 @@
require recipes-devtools-arc/gcc/gcc-6.x.arc.inc
require recipes-devtools/gcc/libgcc.inc
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
COMPATIBLE_MACHINE = "arc"
#EXTRA_OECONF_append_arc = " --disable-multilib"
EXTRA_OECONF_append_arc = " --enable-multilib"
# ERROR: QA Issue: Architecture did not match (195 to 93)
INSANE_SKIP_${PN}-dev += "arch"
# ERROR: QA Issue: non -staticdev package contains static .a library
INSANE_SKIP_${PN}-dev += "staticdev"

View File

@ -0,0 +1,18 @@
LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
SRC_URI[md5sum] = "8f8ced422fe462a00e0135a643544f17"
SRC_URI[sha256sum] = "d282508cb7df0cb8b2cf659032ce1bede7b5725796e3ac90f3cd9d65844a65f2"
PV = "7.12+gitarc"
SRCREV="dc438f4b8706257bdd10846ef98a1b2b9666d8da"
SRC_URI = "git://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git;branch=arc-2016.09-gdb"
S = "${WORKDIR}/git"
EXTRA_OECONF_remove_arc = "--disable-multilib"

View File

@ -0,0 +1,3 @@
require recipes-devtools/gdb/gdb-common.inc
require recipes-devtools/gdb/gdb-cross-canadian.inc
require recipes-devtools-arc/gdb/gdb-7.12arc.inc

View File

@ -0,0 +1,40 @@
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674\
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6\
file://gas/COPYING;md5=d32239bcb673463ab874e80d47fae504\
file://include/COPYING;md5=59530bdf33659b29e73d4adb9f9f6552\
file://include/COPYING3;md5=d32239bcb673463ab874e80d47fae504\
file://libiberty/COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7\
file://bfd/COPYING;md5=d32239bcb673463ab874e80d47fae504\
"
COMPATIBLE_MACHINE = "riscv32"
def binutils_branch_version(d):
pvsplit = d.getVar('PV', True).split('.')
return pvsplit[0] + "_" + pvsplit[1]
BINUPV = "${@binutils_branch_version(d)}"
PV = "2.27+gitriscv32"
SRCREV = "1d307f86616a965df6f3c6a2c4a5ecaae42b9d13"
SRC_URI = "\
git://github.com/riscv/riscv-binutils-gdb.git;protocol=https;branch=__archive__ \
file://add-old-eret-opcode.patch \
"
S = "${WORKDIR}/git"
do_configure_prepend () {
rm -rf ${S}/gdb ${S}/libdecnumber ${S}/readline ${S}/sim
}
CONFIG_SHELL = "/bin/bash"
sysroot_stage_all_append() {
sysroot_stage_dir ${D}${exec_prefix}/extlib ${SYSROOT_DESTDIR}${exec_prefix}/extlib
}

View File

@ -0,0 +1,7 @@
require recipes-devtools/binutils/binutils.inc
require recipes-devtools-riscv32/binutils/binutils-2.27riscv32.inc
require recipes-devtools/binutils/binutils-cross-canadian.inc
do_install_append () {
rm -f ${D}/${libdir}/../lib/libiberty*
}

View File

@ -0,0 +1,5 @@
require recipes-devtools/binutils/binutils.inc
require binutils-2.27riscv32.inc
require recipes-devtools/binutils/binutils-cross.inc

View File

@ -0,0 +1,33 @@
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index d10c7f8..4e398a5 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -225,6 +225,8 @@
#define MASK_MRET 0xffffffff
#define MATCH_DRET 0x7b200073
#define MASK_DRET 0xffffffff
+#define MATCH_ERET 0x10000073
+#define MASK_ERET 0xffffffff
#define MATCH_SFENCE_VM 0x10400073
#define MASK_SFENCE_VM 0xfff07fff
#define MATCH_WFI 0x10500073
@@ -814,6 +816,7 @@ DECLARE_INSN(sret, MATCH_SRET, MASK_SRET)
DECLARE_INSN(hret, MATCH_HRET, MASK_HRET)
DECLARE_INSN(mret, MATCH_MRET, MASK_MRET)
DECLARE_INSN(dret, MATCH_DRET, MASK_DRET)
+DECLARE_INSN(eret, MATCH_ERET, MASK_ERET)
DECLARE_INSN(sfence_vm, MATCH_SFENCE_VM, MASK_SFENCE_VM)
DECLARE_INSN(wfi, MATCH_WFI, MASK_WFI)
DECLARE_INSN(csrrw, MATCH_CSRRW, MASK_CSRRW)
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
index c08f226..03dc690 100644
--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -610,6 +610,7 @@ const struct riscv_opcode riscv_opcodes[] =
{"hret", "I", "", MATCH_HRET, MASK_HRET, match_opcode, 0 },
{"mret", "I", "", MATCH_MRET, MASK_MRET, match_opcode, 0 },
{"dret", "I", "", MATCH_DRET, MASK_DRET, match_opcode, 0 },
+{"eret", "I", "", MATCH_ERET, MASK_ERET, match_opcode, 0 },
{"sfence.vm", "I", "", MATCH_SFENCE_VM, MASK_SFENCE_VM | MASK_RS1, match_opcode, 0 },
{"sfence.vm", "I", "s", MATCH_SFENCE_VM, MASK_SFENCE_VM, match_opcode, 0 },
{"wfi", "I", "", MATCH_WFI, MASK_WFI, match_opcode, 0 },

View File

@ -0,0 +1,17 @@
diff --git a/gcc/config/riscv/t-elf b/gcc/config/riscv/t-elf
index ebb6e92..095c8b15 100644
--- a/gcc/config/riscv/t-elf
+++ b/gcc/config/riscv/t-elf
@@ -1,9 +1,9 @@
# Build the libraries for both hard and soft floating point
-MULTILIB_OPTIONS = m64/m32
-MULTILIB_DIRNAMES = 64 32
+#MULTILIB_OPTIONS = m64/m32
+#MULTILIB_DIRNAMES = 64 32
ifneq ($(with_float), soft)
-MULTILIB_OPTIONS += mno-float
+MULTILIB_OPTIONS += mfloat-abi=soft
MULTILIB_DIRNAMES += soft-float
endif

View File

@ -0,0 +1,88 @@
require recipes-devtools/gcc/gcc-common.inc
# Third digit in PV should be incremented after a minor release
COMPATIBLE_MACHINE = "riscv32"
PV = "6.x.riscv32"
# BINV should be incremented to a revision after a minor gcc release
BINV = "6.1.0"
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${COREBASE}/meta/recipes-devtools/gcc/gcc-6.2:"
DEPENDS =+ "mpfr gmp libmpc zlib"
NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native"
LICENSE = "GPL-3.0-with-GCC-exception & GPLv3"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1 \
file://COPYING.RUNTIME;md5=fe60d87048567d4fe8c8a0ed2448bcc8 \
"
SRCREV="de6438d70df93120ab631ac76106d6ed05fc6c1c"
SRC_URI = "\
git://github.com/riscv/riscv-gcc.git;protocol=https;branch=__archive__ \
file://0036-libcc1-fix-libcc1-s-install-path-and-rpath.patch \
file://0039-Fix-various-_FOR_BUILD-and-related-variables.patch \
file://riscv32-multilib.patch \
"
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/git"
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
# Language Overrides
FORTRAN = ""
JAVA = ""
LTO = "--enable-lto"
EXTRA_OECONF_BASE = "\
${LTO} \
--enable-libssp \
--disable-bootstrap \
--disable-libmudflap \
--with-system-zlib \
--enable-linker-build-id \
--with-ppl=no \
--with-cloog=no \
--enable-checking=release \
--enable-cheaders=c_global \
"
EXTRA_OECONF_INITIAL = "\
--disable-libmudflap \
--disable-libgomp \
--disable-libssp \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--enable-decimal-float=no \
"
EXTRA_OECONF_INTERMEDIATE = "\
--disable-libmudflap \
--disable-libgomp \
--disable-libquadmath \
--with-system-zlib \
--disable-lto \
--disable-plugin \
--disable-libssp \
"
EXTRA_OECONF_append_libc-uclibc = " --disable-decimal-float "
EXTRA_OECONF_append_arc = ' --with-pkgversion="RISC ISA elf32 toolchain ${SRCREV}"'
EXTRA_OECONF_PATHS = "\
--with-gxx-include-dir=${STAGING_DIR_TARGET}${target_includedir}/c++/${BINV} \
--with-sysroot=${STAGING_DIR_TARGET} \
--with-build-sysroot=${STAGING_DIR_TARGET} \
"

View File

@ -0,0 +1,8 @@
require recipes-devtools-riscv32/gcc/gcc-${PV}.inc
require recipes-devtools/gcc/gcc-cross-canadian.inc
EXTRA_OECONF_append_libc-baremetal = " --without-headers"
EXTRA_OECONF_remove_libc-baremetal = "--with-sysroot=/not/exist"
EXTRA_OECONF_remove_libc-baremetal = "--with-build-sysroot=${STAGING_DIR_TARGET}"
EXTRA_OECONF_append_libc-baremetal = " --enable-plugin "

View File

@ -0,0 +1,11 @@
require recipes-devtools-riscv32/gcc/gcc-6.x.riscv32.inc
require recipes-devtools/gcc/gcc-cross.inc
DEPENDS_remove_libc-baremetal := "virtual/${TARGET_PREFIX}libc-for-gcc"
EXTRA_OECONF_append_libc-baremetal = " --without-headers"
EXTRA_OECONF_remove_libc-baremetal = "--with-sysroot=/not/exist"
EXTRA_OECONF_remove_libc-baremetal = "--enable-threads=posix"
COMPATIBLE_MACHINE = "riscv"
BBCLASSEXTEND = "nativesdk"

View File

@ -0,0 +1,2 @@
require recipes-devtools-riscv32/gcc/gcc-6.x.riscv32.inc
require recipes-devtools/gcc/gcc-source.inc

View File

@ -0,0 +1,10 @@
require recipes-devtools-riscv32/gcc/gcc-6.x.riscv32.inc
require recipes-devtools/gcc/libgcc.inc
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
COMPATIBLE_MACHINE = "riscv32"
# Until we support 'elf64-littleriscv' we need to disable multilib
EXTRA_OECONF_remove_riscv32 = "--enable-multilib"
EXTRA_OECONF_append_riscv32 = " --disable-multilib"

View File

@ -0,0 +1,19 @@
LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
SRC_URI[md5sum] = "8f8ced422fe462a00e0135a643544f17"
SRC_URI[sha256sum] = "d282508cb7df0cb8b2cf659032ce1bede7b5725796e3ac90f3cd9d65844a65f2"
COMPATIBLE_MACHINE = "riscv32"
PV = "7.x.riscv32"
SRCREV="b0946801b50b74d7b383b85e71173626d72847da"
SRC_URI = "git://github.com/riscv/riscv-binutils-gdb.git;protocol=https;branch=__archive__"
S = "${WORKDIR}/git"
EXTRA_OECONF_remove_riscv32 = "--disable-multilib"

View File

@ -0,0 +1,3 @@
require recipes-devtools/gdb/gdb-common.inc
require recipes-devtools/gdb/gdb-cross-canadian.inc
require recipes-devtools-riscv32/gdb/gdb-7.x.riscv32.inc

View File

@ -0,0 +1 @@
require binutils_2.27xtensa.inc

View File

@ -0,0 +1 @@
require binutils_2.27xtensa.inc

View File

@ -0,0 +1 @@
require binutils_2.27xtensa.inc

View File

@ -0,0 +1 @@
require binutils_2.27xtensa.inc

View File

@ -0,0 +1,9 @@
# Copy binutils overlay files into the source tree before applying patches.
python do_patch_prepend_xtensa () {
os.system('tar -xf ' + d.getVar('STAGING_DIR_TARGET', True) +
'/usr/src/xtensa-config/xtensa-overlay.tar.gz --strip-components=1 -C ' +
d.getVar('S', True) + ' binutils')
}
do_patch[depends] += "xtensa-config:do_populate_sysroot"

View File

@ -0,0 +1,9 @@
# Copy gcc overlay files into the source tree before applying patches.
python do_patch_prepend_xtensa () {
os.system('tar -xf ' + d.getVar('STAGING_DIR_TARGET', True) +
'/usr/src/xtensa-config/xtensa-overlay.tar.gz --strip-components=1 -C ' +
d.getVar('S', True) + ' gcc')
}
do_patch[depends] += "xtensa-config:do_populate_sysroot"

View File

@ -0,0 +1,9 @@
# Copy gdb overlay files into the source tree before applying patches.
python do_patch_prepend_xtensa () {
os.system('tar -xf ' + d.getVar('STAGING_DIR_TARGET', True) +
'/usr/src/xtensa-config/xtensa-overlay.tar.gz --strip-components=1 -C ' +
d.getVar('S', True) + ' gdb')
}
do_patch[depends] += "xtensa-config:do_populate_sysroot"

View File

@ -0,0 +1,47 @@
LICENSE = "MIT"
PN = "xtensa-config"
S = "${WORKDIR}/git"
LIC_FILES_CHKSUM = "file://LICENSE;md5=947dd7ded6ae6083f19f229781602891"
#
# Avoid circular dependencies when xtensa-config needs gcc and libs, but is
# itself needed for building binutils and gcc.
#
DEPENDS_remove = "virtual/libc virtual/${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}gcc gcc-runtime"
xtensa_core_name ?= "sample_controller"
xtensa_build_url ?= "https://github.com/foss-xtensa/xtensa-config/releases/download/201702/sample_controller_linux.tgz"
xtensa_build_checksum ?= "md5sum=d82ae3939f31f14bc8542c4b741e064a"
SRCREV = "ca2bbcaf57dbef2bcc55a0b6fbf2b0b3cf143533"
SRC_URI = "git://github.com/foss-xtensa/xtensa-config.git \
${xtensa_build_url};${xtensa_build_checksum};unpack=0 \
"
#
# Download xtensa core build. Extract the original configuration overlay
# from it. Use make-overlay.sh script to repackage it for easy application.
# The results are:
# ${S}/xtensa-build.tgz -- xtensa core build
# ${S}/xtensa-overlay.tar.gz -- repackaged xtensa configuration overlay
#
do_configure () {
cp -a "${@bb.fetch2.Fetch([xtensa_build_url], d).localpath(xtensa_build_url)}" "${S}/xtensa-build.tgz"
tar -xf "${S}/xtensa-build.tgz" `tar -tf "${S}/xtensa-build.tgz" | grep xtensa-config-overlay.tar.gz` -O > "${S}/xtensa-config-overlay.tar.gz"
${S}/make-overlay.sh ${xtensa_core_name} "${S}/xtensa-config-overlay.tar.gz" "${S}"
mv "${S}/xtensa_${xtensa_core_name}.tar.gz" "${S}/xtensa-overlay.tar.gz"
}
#
# Install build and overlay into /usr/src/xtensa-config under sysroot.
#
do_install () {
installdir=${D}/usr/src/xtensa-config
install -d "$installdir"
cp ${S}/xtensa-build.tgz "$installdir"
cp ${S}/xtensa-overlay.tar.gz "$installdir"
}
PACKAGES = "${PN}"
FILES_${PN} = "/usr/src/xtensa-config"
SYSROOT_DIRS += "/usr/src/xtensa-config"
BBCLASSEXTEND ="native"

View File

@ -0,0 +1,33 @@
SUMMARY = "Xtensa compile/runtime HAL"
DESCRIPTION = "Xtensa compile/runtime HAL"
LICENSE = "MIT"
SECTION = "libs"
ALLOW_EMPTY_${PN} = "1"
do_patch[depends] += "xtensa-config:do_populate_sysroot"
#
# Drop these dependencies, otherwise xtensa-hal gets built with wrong compiler
# and fails at configuration step.
#
DEPENDS_remove = "virtual/libc virtual/${TARGET_PREFIX}compilerlibs gcc-runtime"
EXTRA_OECONF = "--host=${TARGET_SYS} \
--prefix=${prefix}"
do_configure () {
${S}/configure ${EXTRA_OECONF}
}
do_install () {
oe_runmake 'DESTDIR=${D}' install
}
python do_patch_prepend_xtensa () {
os.system( d.getVar('S', True) + '/import-core.sh ' + d.getVar('STAGING_DIR_TARGET', True) + '/usr/src/xtensa-config/xtensa-build.tgz' )
}
PV = "RF-2015.2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=db7d6b1e19d5108cef2fc957704f261d"
SRC_URI = "https://github.com/foss-xtensa/xtensa-hal/archive/RF-2015.2.tar.gz"
SRC_URI[md5sum] = "2ef7e9e8628c53b2d26eacd6a65e70c8"

View File

@ -0,0 +1,4 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://add-trad-vectors-for-mips-elf.patch \
file://0001-tc-xtensa.c-fixup-xg_reverse_shift_count-typo.patch"

View File

@ -0,0 +1,5 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://add-trad-vectors-for-mips-elf.patch \
file://0001-tc-xtensa.c-fixup-xg_reverse_shift_count-typo.patch"

View File

@ -0,0 +1,5 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://add-trad-vectors-for-mips-elf.patch \
file://0001-tc-xtensa.c-fixup-xg_reverse_shift_count-typo.patch"

View File

@ -0,0 +1,34 @@
From 78fb7e37eb8bb08ae537d6c487996ff17c810332 Mon Sep 17 00:00:00 2001
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Date: Mon, 26 Sep 2016 12:42:11 -0400
Subject: [PATCH] tc-xtensa.c: fixup xg_reverse_shift_count typo
gas/ChangeLog:
2016-09-26 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-xtensa.c (xg_reverse_shift_count): Pass cnt_arg instead of
cnt_argp to concat.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
gas/ChangeLog | 5 +++++
gas/config/tc-xtensa.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index d062044..ca261ae 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -2228,7 +2228,7 @@ xg_reverse_shift_count (char **cnt_argp)
cnt_arg = *cnt_argp;
/* replace the argument with "31-(argument)" */
- new_arg = concat ("31-(", cnt_argp, ")", (char *) NULL);
+ new_arg = concat ("31-(", cnt_arg, ")", (char *) NULL);
free (cnt_arg);
*cnt_argp = new_arg;
--
2.1.4

View File

@ -0,0 +1,18 @@
diff --git a/bfd/config.bfd b/bfd/config.bfd
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -1080,6 +1080,14 @@
targ_defvec=mips_elf32_trad_be_vec
targ_selvecs="mips_elf32_trad_le_vec mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec"
;;
+ mips*el-zephyr-elf*)
+ targ_defvec=mips_elf32_le_vec
+ targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec"
+ ;;
+ mips*-zephyr-elf*)
+ targ_defvec=mips_elf32_be_vec
+ targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec"
+ ;;
mips*el-*-elf* | mips*-*-chorus*)
targ_defvec=mips_elf32_le_vec
targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec"

View File

@ -0,0 +1,77 @@
diff -Nur a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
--- a/gcc/config/arm/t-arm-elf 2015-01-05 12:33:28.000000000 +0000
+++ b/gcc/config/arm/t-arm-elf 2016-06-30 17:57:09.412770309 +0100
@@ -16,10 +16,56 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-MULTILIB_OPTIONS = marm/mthumb
-MULTILIB_DIRNAMES = arm thumb
-MULTILIB_EXCEPTIONS =
-MULTILIB_MATCHES =
+MULTILIB_OPTIONS = mthumb/marm
+MULTILIB_DIRNAMES = thumb arm
+MULTILIB_OPTIONS += march=armv6s-m/march=armv7-m/march=armv7e-m
+MULTILIB_DIRNAMES += armv6-m armv7-m armv7e-m
+MULTILIB_OPTIONS += mfloat-abi=softfp/mfloat-abi=hard
+MULTILIB_DIRNAMES += softfp fpu
+MULTILIB_OPTIONS += mfpu=fpv5-sp-d16/mfpu=fpv5-d16/mfpu=fpv4-sp-d16
+MULTILIB_DIRNAMES += fpv5-sp-d16 fpv5-d16 fpv4-sp-d16
+
+MULTILIB_EXCEPTIONS =
+MULTILIB_MATCHES = march?armv6s-m=mcpu?cortex-m0
+MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0.small-multiply
+MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0plus
+MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m0plus.small-multiply
+MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m1
+MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m1.small-multiply
+MULTILIB_MATCHES += march?armv6s-m=march?armv6-m
+MULTILIB_MATCHES += march?armv7-m=mcpu?cortex-m3
+MULTILIB_MATCHES += march?armv7e-m=mcpu?cortex-m4
+MULTILIB_MATCHES += march?armv7e-m=mcpu?cortex-m7
+
+MULTILIB_REQUIRED = mthumb
+MULTILIB_REQUIRED += marm
+MULTILIB_REQUIRED += mfloat-abi=hard
+
+MULTILIB_OSDIRNAMES = mthumb=!thumb
+MULTILIB_OSDIRNAMES += marm=!arm
+MULTILIB_OSDIRNAMES += mfloat-abi.hard=!fpu
+
+MULTILIB_REQUIRED += mthumb/march=armv6s-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv6s-m=!armv6-m
+
+MULTILIB_REQUIRED += mthumb/march=armv7-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv7-m=!armv7-m
+
+MULTILIB_REQUIRED += mthumb/march=armv7e-m
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv4-sp-d16
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv4-sp-d16
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-d16
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-d16
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=softfp/mfpu=fpv5-sp-d16
+MULTILIB_REQUIRED += mthumb/march=armv7e-m/mfloat-abi=hard/mfpu=fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m=!armv7e-m
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv4-sp-d16=!armv7e-m/fpu
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv4-sp-d16=!armv7e-m/softfp
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-d16=!armv7e-m/fpu/fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-d16=!armv7e-m/softfp/fpv5-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.hard/mfpu.fpv5-sp-d16=!armv7e-m/fpu/fpv5-sp-d16
+MULTILIB_OSDIRNAMES += mthumb/march.armv7e-m/mfloat-abi.softfp/mfpu.fpv5-sp-d16=!armv7e-m/softfp/fpv5-sp-d16
+
#MULTILIB_OPTIONS += mcpu=fa526/mcpu=fa626/mcpu=fa606te/mcpu=fa626te/mcpu=fmp626/mcpu=fa726te
#MULTILIB_DIRNAMES += fa526 fa626 fa606te fa626te fmp626 fa726te
@@ -38,9 +84,9 @@
# Not quite true. We can support hard-vfp calling in Thumb2, but how do we
# express that here? Also, we really need architecture v5e or later
# (mcrr etc).
-MULTILIB_OPTIONS += mfloat-abi=hard
-MULTILIB_DIRNAMES += fpu
-MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
+#MULTILIB_OPTIONS += mfloat-abi=hard
+#MULTILIB_DIRNAMES += fpu
+#MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
#MULTILIB_EXCEPTIONS += *mcpu=fa526/*mfloat-abi=hard*
#MULTILIB_EXCEPTIONS += *mcpu=fa626/*mfloat-abi=hard*

View File

@ -0,0 +1,12 @@
--- a/libgcc/config.host 2016-09-20 12:33:51.334406972 -0700
+++ b/libgcc/config.host 2016-09-20 12:30:57.117543078 -0700
@@ -551,6 +551,9 @@
tm_file="$tm_file i386/darwin-lib.h"
extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
;;
+i586-zephyr-elf)
+ tmake_file="$tmake_file i386/t-crtstuff t-softfp-sfdf i386/32/t-zephyr i386/t-softfp t-softfp t-dfprules"
+ ;;
i[34567]86-*-elf*)
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
;;

View File

@ -0,0 +1,13 @@
--- a/gcc/config.gcc 2016-07-29 12:21:37.971548000 -0700
+++ b/gcc/config.gcc 2016-09-19 10:29:08.788868569 -0700
@@ -1365,6 +1365,10 @@
tmake_file="${tmake_file} ${cpu_type}/t-darwin64 t-slibgcc"
tm_file="${tm_file} ${cpu_type}/darwin64.h"
;;
+i586-zephyr-elf)
+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
+ tmake_file="${tmake_file} i386/t-zephyr"
+ ;;
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h newlib-stdint.h i386/i386elf.h"
;;

View File

@ -0,0 +1,4 @@
--- /dev/null 2016-10-25 11:17:04.944076583 -0700
+++ b/libgcc/config/i386/32/t-zephyr 2015-12-18 06:49:09.000000000 -0800
@@ -0,0 +1 @@
+HOST_LIBGCC2_CFLAGS += -mlong-double-80

View File

@ -0,0 +1,21 @@
Index: gcc-5.2.0/gcc/config/nios2/t-nios2
===================================================================
--- a/gcc/config/nios2/t-nios2
+++ b/gcc/config/nios2/t-nios2
@@ -18,10 +18,10 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# MULTILIB_OPTIONS = mno-hw-mul/mhw-mulx mcustom-fpu-cfg=60-1/mcustom-fpu-cfg=60-2
-# MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
-# MULTILIB_EXCEPTIONS =
+MULTILIB_OPTIONS = mno-hw-mul/mhw-mulx mcustom-fpu-cfg=60-1/mcustom-fpu-cfg=60-2
+MULTILIB_DIRNAMES = nomul mulx fpu-60-1 fpu-60-2
+MULTILIB_EXCEPTIONS =
-# MULTILIB_OPTIONS += EL/EB
-# MULTILIB_DIRNAMES += le be
-# MULTILIB_MATCHES += EL=mel EB=meb
+#MULTILIB_OPTIONS += EL/EB
+#MULTILIB_DIRNAMES += le be
+#MULTILIB_MATCHES += EL=mel EB=meb

View File

@ -0,0 +1,27 @@
--- /dev/null 2016-09-16 18:21:25.208077892 -0700
+++ b/gcc/config/i386/t-zephyr 2015-01-05 04:33:28.000000000 -0800
@@ -0,0 +1,23 @@
+# Copyright (C) 2016 Intel Corporation.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+
+MULTILIB_OPTIONS += msoft-float
+MULTILIB_DIRNAMES += soft-float
+MULTILIB_MATCHES = msoft-float=mno-80387
+MULTILIB_EXCEPTIONS =

View File

@ -0,0 +1,3 @@
EXTRA_OECONF_append = " --with-gnu-as "
EXTRA_OECONF_append_libc-baremetal = " --enable-plugin"

View File

@ -0,0 +1,12 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://0043-arm-multilib.patch"
SRC_URI += "file://nios2-multilib.patch"
# Patches to implement soft-float (multilib) for x86
SRC_URI += "file://x86-multilib.patch"
SRC_URI += "file://config-x86-multi-gcc.patch"
SRC_URI += "file://config-libgcc-softfp.patch"
SRC_URI += "file://libgcc-t-zephyr.patch"
EXTRA_OECONF_append = " --enable-plugin "

View File

@ -0,0 +1,10 @@
EXTRA_OECONF_remove_arm = "--disable_multilib"
EXTRA_OECONF_append_arm = " --enable-multilib"
EXTRA_OECONF_remove_x86 = "--disable_multilib"
EXTRA_OECONF_append_x86 = " --enable-multilib"
EXTRA_OECONF_remove_arc = "--disable_multilib"
EXTRA_OECONF_append_arc = " --enable-multilib"
EXTRA_OECONF_remove_nios2 = "--disable_multilib"
EXTRA_OECONF_append_nios2 = " --enable-multilib"

View File

@ -0,0 +1,71 @@
From ad6b2e6258cc6eb7b5f5d7de282a12b15a0f6590 Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Wed, 25 Apr 2018 11:55:56 -0700
Subject: [PATCH] gdb: xtensa: handle privileged registers
gdb/
2018-04-25 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-linux-tdep.c (xtensa-tdep.h): New include.
(xtensa_linux_init_abi): Limit tdep->num_regs by
tdep->num_nopriv_regs.
* xtensa-tdep.c (xtensa_derive_tdep): Calculate
tdep->num_nopriv_regs and only copy it to tdep->num_regs if it's
not initialized.
---
gdb/xtensa-linux-tdep.c | 6 ++++++
gdb/xtensa-tdep.c | 12 ++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
index a9b30c73f7bf..b62085de2fcb 100644
--- a/gdb/xtensa-linux-tdep.c
+++ b/gdb/xtensa-linux-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "xtensa-tdep.h"
#include "osabi.h"
#include "linux-tdep.h"
#include "solib-svr4.h"
@@ -97,6 +98,11 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
static void
xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (tdep->num_nopriv_regs < tdep->num_regs)
+ tdep->num_regs = tdep->num_nopriv_regs;
+
linux_init_abi (info, gdbarch);
set_solib_svr4_fetch_link_map_offsets
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index a1ecf5f56a42..01f96165dc8d 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3145,16 +3145,12 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
max_size = rmap->byte_size;
if (rmap->mask != 0 && tdep->num_regs == 0)
tdep->num_regs = n;
- /* Find out out how to deal with priveleged registers.
-
- if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
- && tdep->num_nopriv_regs == 0)
- tdep->num_nopriv_regs = n;
- */
if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
- && tdep->num_regs == 0)
- tdep->num_regs = n;
+ && tdep->num_nopriv_regs == 0)
+ tdep->num_nopriv_regs = n;
}
+ if (tdep->num_regs == 0)
+ tdep->num_regs = tdep->num_nopriv_regs;
/* Number of pseudo registers. */
tdep->num_pseudo_regs = n - tdep->num_regs;
--
2.11.0

View File

@ -0,0 +1,39 @@
From 593005d075c50ca0a0d3bd655cfb8d8ad7dbdebf Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Thu, 30 Apr 2015 14:53:37 -0700
Subject: [PATCH] Add Intel MCU support to gdb
---
gdb/i386-linux-tdep.c | 2 ++
gdb/i386-tdep.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 061ad3a..7582541 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -1008,6 +1008,8 @@ _initialize_i386_linux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
i386_linux_init_abi);
+ gdbarch_register_osabi (bfd_arch_iamcu, 0, GDB_OSABI_LINUX,
+ i386_linux_init_abi);
/* Initialize the Linux target description. */
initialize_tdesc_i386_linux ();
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 0c7eb5a..55957ed 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8624,6 +8624,7 @@ void
_initialize_i386_tdep (void)
{
register_gdbarch_init (bfd_arch_i386, i386_gdbarch_init);
+ register_gdbarch_init (bfd_arch_iamcu, i386_gdbarch_init);
/* Add the variable that controls the disassembly flavor. */
add_setshow_enum_cmd ("disassembly-flavor", no_class, valid_flavors,
--
1.9.3

View File

@ -0,0 +1,9 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://Add-Intel-MCU-support-to-gdb.patch"
SRC_URI += "file://0001-gdb-xtensa-handle-privileged-registers.patch"
EXTRA_OECONF_remove = "--disable-tui"
EXTRA_OECONF_append = " --enable-tui"
EXTRA_OECONF_remove = "--disable-gdbmi"
EXTRA_OECONF_append = " --enable-gdbmi"

View File

@ -0,0 +1,197 @@
From 50a5a7b223f7c447a0e1d0f56a2da4a8459a7f2e Mon Sep 17 00:00:00 2001
From: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Date: Fri, 14 Sep 2018 20:35:05 +0530
Subject: [PATCH] qemu/nios2: Add Altera MAX 10 board support for Zephyr OS
Exisitng 10m50_devboard is not supporting qemu-niso2 on Zephyr OS
and the reason might be that the softcpu build may be different
for Linux and Zephyr OS.
So added support for Zephyr qemu-nios2 board.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
---
hw/nios2/Makefile.objs | 2 +-
hw/nios2/altera_10m50_zephyr.c | 163 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 164 insertions(+), 1 deletion(-)
create mode 100644 hw/nios2/altera_10m50_zephyr.c
diff --git a/hw/nios2/Makefile.objs b/hw/nios2/Makefile.objs
index 6b5c421..6723586 100644
--- a/hw/nios2/Makefile.objs
+++ b/hw/nios2/Makefile.objs
@@ -1 +1 @@
-obj-y = boot.o cpu_pic.o 10m50_devboard.o
+obj-y = boot.o cpu_pic.o 10m50_devboard.o altera_10m50_zephyr.o
diff --git a/hw/nios2/altera_10m50_zephyr.c b/hw/nios2/altera_10m50_zephyr.c
new file mode 100644
index 0000000..91ec9d7
--- /dev/null
+++ b/hw/nios2/altera_10m50_zephyr.c
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu-common.h"
+#include "cpu.h"
+#include "hw/sysbus.h"
+#include "hw/hw.h"
+#include "hw/char/serial.h"
+#include "sysemu/sysemu.h"
+#include "hw/boards.h"
+#include "hw/loader.h"
+#include "exec/memory.h"
+#include "exec/address-spaces.h"
+#include "qemu/config-file.h"
+#include "qemu/option.h"
+#include "boot.h"
+
+#define DEBUG
+
+#ifdef DEBUG
+# define DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
+#else
+# define DPRINTF(format, ...) do { } while (0)
+#endif
+
+#define ROM_BASE 0x0
+#define ROM_SIZE 32
+
+#define RAM_BASE 0x400000
+#define RAM_SIZE 262144
+
+#define U16550_0_BASE 0x440000
+#define U16550_0_IRQ_IDX 1
+
+#define TIMER_0_BASE 0x440200
+#define TIMER_0_FREQ 50000000
+#define TIMER_0_IRQ_IDX 2
+
+#define ALT_CPU_EXCEPTION_ADDR 0x00400020
+#define ALT_CPU_RESET_ADDR 0x00000000
+
+#define EM_ALTERA_NIOS2 113
+
+static struct {
+ uint32_t bootstrap_pc;
+} boot_info_zephyr;
+
+static void main_cpu_reset(void *opaque)
+{
+ Nios2CPU *cpu = opaque;
+ CPUNios2State *env = &cpu->env;
+
+ cpu_reset(CPU(cpu));
+ env->regs[R_PC] = boot_info_zephyr.bootstrap_pc;
+}
+
+static void altera_10m50_zephyr_init(MachineState *machine)
+{
+ const char *kernel_filename;
+ MemoryRegion *sysmem = get_system_memory();
+ Nios2CPU *cpu;
+ DeviceState *dev;
+ QemuOpts *machine_opts;
+ qemu_irq *cpu_irq, irq[32];
+ int kernel_size;
+ int i;
+
+ MemoryRegion *rom = g_new(MemoryRegion, 1);
+ MemoryRegion *ram = g_new(MemoryRegion, 1);
+
+ cpu = NIOS2_CPU(object_new(TYPE_NIOS2_CPU));
+ object_property_set_bool(OBJECT(cpu), false, "mmu_present",
+ &error_abort);
+ object_property_set_bool(OBJECT(cpu), true, "realized", &error_abort);
+
+ machine_opts = qemu_get_machine_opts();
+ kernel_filename = qemu_opt_get(machine_opts, "kernel");
+
+ memory_region_init_ram(rom, NULL, "nios2.rom", ROM_SIZE, &error_fatal);
+ memory_region_set_readonly(rom, true);
+ memory_region_add_subregion(sysmem, ROM_BASE, rom);
+
+ memory_region_init_ram(ram, NULL, "nios2.ram", RAM_SIZE, &error_fatal);
+ memory_region_add_subregion(sysmem, RAM_BASE, ram);
+
+ /* Register: CPU interrupt controller (PIC) */
+ cpu_irq = nios2_cpu_pic_init(cpu);
+
+ /* Register: Internal Interrupt Controller (IIC) */
+ dev = qdev_create(NULL, "altera,iic");
+ object_property_add_const_link(OBJECT(dev), "cpu", OBJECT(cpu),
+ &error_abort);
+ qdev_init_nofail(dev);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, cpu_irq[0]);
+ for (i = 0; i < 32; i++) {
+ irq[i] = qdev_get_gpio_in(dev, i);
+ }
+
+ /* Register: Altera 16550 UART */
+ serial_mm_init(sysmem, U16550_0_BASE, 2, irq[U16550_0_IRQ_IDX],
+ 115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
+
+ /* Register: Timer sys_clk_timer */
+ dev = qdev_create(NULL, "ALTR.timer");
+ qdev_prop_set_uint32(dev, "clock-frequency", TIMER_0_FREQ);
+ qdev_init_nofail(dev);
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_0_BASE);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_0_IRQ_IDX]);
+
+ cpu->reset_addr = ALT_CPU_RESET_ADDR;
+ cpu->exception_addr = ALT_CPU_EXCEPTION_ADDR;
+ cpu->fast_tlb_miss_addr = ALT_CPU_RESET_ADDR;
+ DPRINTF("\tcpu->env.reset_addr: \t\t%0x\n", cpu->reset_addr);
+ DPRINTF("\tcpu->env.exception_addr: \t%0x\n", cpu->exception_addr);
+
+ if (kernel_filename) {
+ uint64_t entry;
+
+ /* Boots a kernel elf binary. */
+ kernel_size = load_elf(kernel_filename, NULL, NULL,
+ &entry, NULL, NULL,
+ 0, EM_ALTERA_NIOS2, 0, 0);
+
+ boot_info_zephyr.bootstrap_pc = entry;
+
+ /* Not an ELF image, try a RAW image. */
+ if (kernel_size < 0) {
+ hwaddr uentry, loadaddr;
+
+ kernel_size = load_uimage(kernel_filename, &uentry,
+ &loadaddr, 0, NULL, NULL);
+ boot_info_zephyr.bootstrap_pc = uentry;
+ }
+
+ if (kernel_size < 0) {
+ fprintf(stderr, "qemu: could not load kernel '%s'\n",
+ kernel_filename);
+ exit(1);
+ }
+ }
+ qemu_register_reset(main_cpu_reset, cpu);
+
+}
+
+static void altera_10m50_zephyr_machine_init(MachineClass *mc)
+{
+ mc->desc = "Altera 10m50 for Zephyr.";
+ mc->init = altera_10m50_zephyr_init;
+ mc->is_default = 0;
+}
+
+DEFINE_MACHINE("altera_10m50_zephyr", altera_10m50_zephyr_machine_init)
--
2.9.5

View File

@ -0,0 +1,216 @@
DEPENDS = "glib-2.0 zlib pixman gnutls dtc"
LICENSE = "GPLv2"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
SRCREV = "19b599f7664b2ebfd0f405fb79c14dd241557452"
SRC_URI = "git://github.com/qemu/qemu.git;protocol=https \
file://0001-qemu-nios2-Add-Altera-MAX-10-board-support-for-Zephy.patch \
"
BBCLASSEXTEND = "native nativesdk"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
# Standard options:
# --prefix=PREFIX install in PREFIX [$prefix]
# --interp-prefix=PREFIX where to find shared libraries, etc.
# use %M for cpu name [$interp_prefix]
# --target-list=LIST set target list (default: build everything)
# $(echo Available targets: $default_target_list | \
# fold -s -w 53 | sed -e 's/^/ /')
#
# Advanced options (experts only):
# --source-path=PATH path of source code [$source_path]
# --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
# --cc=CC use C compiler CC [$cc]
# --iasl=IASL use ACPI compiler IASL [$iasl]
# --host-cc=CC use C compiler CC [$host_cc] for code run at
# build time
# --cxx=CXX use C++ compiler CXX [$cxx]
# --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
# --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
# --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
# --make=MAKE use specified make [$make]
# --install=INSTALL use specified install [$install]
# --python=PYTHON use specified python [$python]
# --smbd=SMBD use specified smbd [$smbd]
# --static enable static build [$static]
# --mandir=PATH install man pages in PATH
# --datadir=PATH install firmware in PATH$confsuffix
# --docdir=PATH install documentation in PATH$confsuffix
# --bindir=PATH install binaries in PATH
# --libdir=PATH install libraries in PATH
# --sysconfdir=PATH install config in PATH$confsuffix
# --localstatedir=PATH install local state in PATH (set at runtime on win32)
# --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
# --enable-modules enable modules support
# --enable-debug-tcg enable TCG debugging
# --disable-debug-tcg disable TCG debugging (default)
# --enable-debug-info enable debugging information (default)
# --disable-debug-info disable debugging information
# --enable-debug enable common debug build options
# --enable-sparse enable sparse checker
# --disable-sparse disable sparse checker (default)
# --disable-strip disable stripping binaries
# --disable-werror disable compilation abort on warning
# --disable-stack-protector disable compiler-provided stack protection
# --disable-sdl disable SDL
# --enable-sdl enable SDL
# --with-sdlabi select preferred SDL ABI 1.2 or 2.0
# --disable-gtk disable gtk UI
# --enable-gtk enable gtk UI
# --with-gtkabi select preferred GTK ABI 2.0 or 3.0
# --disable-virtfs disable VirtFS
# --enable-virtfs enable VirtFS
# --disable-vnc disable VNC
# --enable-vnc enable VNC
# --disable-cocoa disable Cocoa (Mac OS X only)
# --enable-cocoa enable Cocoa (default on Mac OS X)
# --audio-drv-list=LIST set audio drivers list:
# Available drivers: $audio_possible_drivers
# --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
# --block-drv-rw-whitelist=L
# set block driver read-write whitelist
# (affects only QEMU, not qemu-img)
# --block-drv-ro-whitelist=L
# set block driver read-only whitelist
# (affects only QEMU, not qemu-img)
# --disable-xen disable xen backend driver support
# --enable-xen enable xen backend driver support
# --disable-xen-pci-passthrough
# --enable-xen-pci-passthrough
# --disable-brlapi disable BrlAPI
# --enable-brlapi enable BrlAPI
# --disable-vnc-tls disable TLS encryption for VNC server
# --enable-vnc-tls enable TLS encryption for VNC server
# --disable-vnc-sasl disable SASL encryption for VNC server
# --enable-vnc-sasl enable SASL encryption for VNC server
# --disable-vnc-jpeg disable JPEG lossy compression for VNC server
# --enable-vnc-jpeg enable JPEG lossy compression for VNC server
# --disable-vnc-png disable PNG compression for VNC server (default)
# --enable-vnc-png enable PNG compression for VNC server
# --disable-vnc-ws disable Websockets support for VNC server
# --enable-vnc-ws enable Websockets support for VNC server
# --disable-curses disable curses output
# --enable-curses enable curses output
# --disable-curl disable curl connectivity
# --enable-curl enable curl connectivity
# --disable-fdt disable fdt device tree
# --enable-fdt enable fdt device tree
# --disable-bluez disable bluez stack connectivity
# --enable-bluez enable bluez stack connectivity
# --disable-slirp disable SLIRP userspace network connectivity
# --disable-kvm disable KVM acceleration support
# --enable-kvm enable KVM acceleration support
# --disable-rdma disable RDMA-based migration support
# --enable-rdma enable RDMA-based migration support
# --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
# --enable-system enable all system emulation targets
# --disable-system disable all system emulation targets
# --enable-user enable supported user emulation targets
# --disable-user disable all user emulation targets
# --enable-linux-user enable all linux usermode emulation targets
# --disable-linux-user disable all linux usermode emulation targets
# --enable-bsd-user enable all BSD usermode emulation targets
# --disable-bsd-user disable all BSD usermode emulation targets
# --enable-guest-base enable GUEST_BASE support for usermode
# emulation targets
# --disable-guest-base disable GUEST_BASE support
# --enable-pie build Position Independent Executables
# --disable-pie do not build Position Independent Executables
# --fmod-lib path to FMOD library
# --fmod-inc path to FMOD includes
# --oss-lib path to OSS library
# --cpu=CPU Build for host CPU [$cpu]
# --enable-uuid enable uuid support
# --disable-vde disable support for vde network
# --enable-vde enable support for vde network
# --disable-netmap disable support for netmap network
# --enable-netmap enable support for netmap network
# --disable-linux-aio disable Linux AIO support
# --enable-linux-aio enable Linux AIO support
# --disable-cap-ng disable libcap-ng support
# --enable-cap-ng enable libcap-ng support
# --disable-attr disables attr and xattr support
# --enable-attr enable attr and xattr support
# --disable-blobs disable installing provided firmware blobs
# --enable-docs enable documentation build
# --disable-docs disable documentation build
# --disable-vhost-net disable vhost-net acceleration support
# --enable-vhost-net enable vhost-net acceleration support
# --enable-trace-backends=B Set trace backend
# Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
# --with-trace-file=NAME Full PATH,NAME of file to store traces
# Default:trace-<pid>
# --disable-spice disable spice
# --enable-spice enable spice
# --enable-rbd enable building the rados block device (rbd)
# --disable-libiscsi disable iscsi support
# --enable-libiscsi enable iscsi support
# --disable-libnfs disable nfs support
# --enable-libnfs enable nfs support
# --disable-smartcard-nss disable smartcard nss support
# --enable-smartcard-nss enable smartcard nss support
# --disable-libusb disable libusb (for usb passthrough)
# --enable-libusb enable libusb (for usb passthrough)
# --disable-usb-redir disable usb network redirection support
# --enable-usb-redir enable usb network redirection support
# --enable-lzo enable the support of lzo compression library
# --enable-snappy enable the support of snappy compression library
# --disable-guest-agent disable building of the QEMU Guest Agent
# --enable-guest-agent enable building of the QEMU Guest Agent
# --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
# --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
# --disable-seccomp disable seccomp support
# --enable-seccomp enables seccomp support
# --with-coroutine=BACKEND coroutine backend. Supported options:
# gthread, ucontext, sigaltstack, windows
# --disable-coroutine-pool disable coroutine freelist (worse performance)
# --enable-coroutine-pool enable coroutine freelist (better performance)
# --enable-glusterfs enable GlusterFS backend
# --disable-glusterfs disable GlusterFS backend
# --enable-gcov enable test coverage analysis with gcov
# --gcov=GCOV use specified gcov [$gcov_tool]
# --disable-tpm disable TPM support
# --enable-tpm enable TPM support
# --disable-libssh2 disable ssh block device support
# --enable-libssh2 enable ssh block device support
# --disable-vhdx disables support for the Microsoft VHDX image format
# --enable-vhdx enable support for the Microsoft VHDX image format
# --disable-quorum disable quorum block filter support
# --enable-quorum enable quorum block filter support
# --disable-numa disable libnuma support
# --enable-numa enable libnuma support
#--disable-blobs : BIOS needed for x86
#--disable-fdt: Cannot use if supporting ARM
QEMUS_BUILT = "arm-softmmu i386-softmmu mips-softmmu nios2-softmmu xtensa-softmmu riscv32-softmmu"
QEMU_FLAGS = "--disable-docs --disable-sdl --disable-debug-info --disable-cap-ng \
--disable-libnfs --disable-libusb --disable-libiscsi --disable-usb-redir --disable-linux-aio\
--disable-guest-agent --disable-libssh2 --disable-vnc-png --disable-seccomp \
--disable-tpm --disable-numa --disable-glusterfs \
--disable-virtfs --disable-xen --disable-curl --disable-attr --disable-curses\
"
do_configure() {
${S}/configure ${QEMU_FLAGS} --target-list="${QEMUS_BUILT}" --prefix=${prefix} \
--sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --localstatedir=${localstatedir}
}
FILES_${PN} = " \
/opt/zephyr-sdk \
"
INSANE_SKIP_${PN} = "already-stripped"

View File

@ -0,0 +1,33 @@
SUMMARY = "BOSSA is a flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers."
HOMEPAGE = "https://github.com/shumatech/BOSSA"
#
# Note: In order to build this recipe, you need wxWidgets libraries :
# sudo apt-get install wx2.8-headers libwxgtk2.8-0 libwxgtk2.8-dev
#
LICENSE = "SHUMATECH"
LIC_FILES_CHKSUM = "file://LICENSE;md5=94411054a7f6921218ab9c05b6b4b15b"
DEPENDS = "readline"
PR = "r0"
SRCREV = "5cae9fee241bd3c95c197b2464e9b83240994c43"
SRC_URI = "git://github.com/shumatech/BOSSA.git;protocol=https"
S = "${WORKDIR}/git"
do_compile() {
oe_runmake bin/bossac bin/bossash
}
do_install() {
install -d ${D}${bindir}
install -m 0755 ${S}/bin/bossac ${D}${bindir}
install -m 0755 ${S}/bin/bossash ${D}${bindir}
}
FILES_${PN} = "${bindir} "
BBCLASSEXTEND += "nativesdk"

View File

@ -0,0 +1,16 @@
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -62,9 +62,9 @@
threads="pthreads"
# HIDAPI/hidraw libs
- PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev])
- LIBS_HIDRAW_PR+=" $libudev_LIBS"
- CFLAGS_HIDRAW+=" $libudev_CFLAGS"
+# PKG_CHECK_MODULES([libudev], [libudev], true, [hidapi_lib_error libudev])
+# LIBS_HIDRAW_PR+=" $libudev_LIBS"
+# CFLAGS_HIDRAW+=" $libudev_CFLAGS"
# HIDAPI/libusb libs
AC_CHECK_LIB([rt], [clock_gettime], [LIBS_LIBUSB_PRIVATE+=" -lrt"], [hidapi_lib_error librt])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
SUMMARY = "HIDAPI is a library which allows an application to interface with USB and Bluetooth HID-Class devices"
HOMEPAGE = "https://github.com/signal11/hidapi"
SECTION = "libs"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE-bsd.txt;md5=b5fa085ce0926bb50d0621620a82361f"
DEPENDS += "udev"
RDEPENDS_${PN} += "udev"
PR = "r0"
SRCREV = "b5b2e1779b6cd2edda3066bbbf0921a2d6b1c3c0"
SRC_URI = "git://github.com/signal11/hidapi.git;protocol=https \
file://libusb.h \
"
BBCLASSEXTEND += " native nativesdk"
S = "${WORKDIR}/git"
inherit autotools pkgconfig
EXTRA_OECONF = " --libdir=${base_libdir}"
do_configure() {
cd ${S}
./bootstrap
export PKG_CONFIG_DIR=
export PKG_CONFIG_LIBDIR=${prefix}/lib/pkgconfig:${prefix}/share/pkgconfig
export PKG_CONFIG_SYSROOT_DIR=${prefix}
oe_runconf ${EXTRA_OECONF}
}
do_compile() {
cp ${WORKDIR}/libusb.h* ${S}/libusb
cd ${S}/linux
make Makefile-manual
}
do_install() {
cd ${S}/linux
oe_runmake DESTDIR=${D} install
# pkgconfig is needed to keep OpenOCD happy.
# (OpenOCD searches for HIDAPI via pkgconfig)
install -d ${D}${libdir}/pkgconfig
cp ${S}/pc/hidapi-hidraw.pc ${D}${libdir}/pkgconfig
#rm ${D}${includedir}/hidapi/hidapi.h
}
FILES_${PN} += "${base_libdir}/*.so.*"
FILES_${PN}-dev += "${base_libdir}/*.so ${base_libdir}/*.a"
FILES_${PN}-dev += "${includedir}"

View File

@ -0,0 +1,49 @@
DESCRIPTION = "Standalone tarball containing various host SDK packages for Zephyr development."
SUMMARY = "Standalone tarball for running Zephyr SDK builds on all systems"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690 \
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
TOOLCHAIN_TARGET_TASK ?= ""
TOOLCHAIN_HOST_TASK ?= "\
nativesdk-zephyr-qemu \
nativesdk-openocd \
nativesdk-bossa \
nativesdk-open-firmware-tools \
nativesdk-dtc \
nativesdk-hidapi-libraw \
"
TOOLCHAIN_OUTPUTNAME ?= "${DISTRO}-${SDKMACHINE}-hosttools-standalone-${DISTRO_VERSION}"
RDEPENDS = "${TOOLCHAIN_HOST_TASK}"
inherit meta
inherit populate_sdk
inherit toolchain-scripts
create_sdk_files_append () {
rm -f ${SDK_OUTPUT}/${SDKPATH}/site-config-*
rm -f ${SDK_OUTPUT}/${SDKPATH}/environment-setup-*
rm -f ${SDK_OUTPUT}/${SDKPATH}/version-*
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/usr/share/readline
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/usr/share/glib-2.0
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/etc
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/var
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${SDK_SYS}/sbin
rm -rfv ${SDK_OUTPUT}/${SDKPATH}/sysroots/${MULTIMACH_HOST_SYS}
# Generate new sdk-environment-setup stub file
script=${1:-${SDK_OUTPUT}/${SDKPATH}/environment-setup-${SDK_SYS}}
touch $script
echo 'export PATH=${SDKPATHNATIVE}${bindir_nativesdk}:$PATH' >> $script
# In order for the self-extraction script to correctly extract and set up things,
# we need a 'OECORE_NATIVE_SYSROOT=xxx' line in environment setup script.
# However, this tarball is inherently a tool set instead of a fully functional SDK,
# so instead of exporting the variable, we use a comment here.
echo '#OECORE_NATIVE_SYSROOT="${SDKPATHNATIVE}"' >> $script
toolchain_create_sdk_version ${SDK_OUTPUT}/${SDKPATH}/version-${SDK_SYS}
}

View File

@ -0,0 +1,32 @@
From 780b0b8e48551ba49b011caeeb09101a09c14a61 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Fri, 26 May 2017 17:11:32 +0100
Subject: [PATCH] Makefile: ensure frontends/ exits before writing into it
As previously, if GCC dependencies are not being written and the build is out of
tree then frontends/ won't exist so we need to create it.
Upstream-Status: Backport
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit f7986375129d1ada7dc6abeeec5b9d00ef6f7149)
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile.am b/Makefile.am
index 1baa110..434db5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -171,6 +171,7 @@ if COND_kconfig
bin_SCRIPTS += frontends/kconfig
frontends/kconfig: frontends/kconfig.in
+ $(MKDIR_P) $(@D)
$(AM_V_GEN)$(SED) -e 's/@KCFG_LIST@/$(kcfg_list)/g' \
$< >$@
@chmod +x $@
--
2.12.0

View File

@ -0,0 +1,26 @@
From 3b9b0f82c33f793a14d44bf06b6c8136bc3fc4bf Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 27 Apr 2017 16:48:42 +0300
Subject: [PATCH] Switch utils/kconfig-diff to use Python 3
The script supports it, but continues to refer to 2.x in shebang.
Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
utils/kconfig-diff | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/kconfig-diff b/utils/kconfig-diff
index 0db267d..19189f3 100755
--- a/utils/kconfig-diff
+++ b/utils/kconfig-diff
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
#
# diffconfig - a tool to compare .config files.
#
--
2.11.0

View File

@ -0,0 +1,95 @@
From 23b426d38d6ce143c1c1cdd9f1c62176a17409b5 Mon Sep 17 00:00:00 2001
From: Anas Nashif <anas.nashif@intel.com>
Date: Wed, 16 Aug 2017 23:22:45 -0400
Subject: [PATCH 1/2] zephyr: add support for wildcards
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
---
libs/parser/lconf.l | 37 +++++++++++++++++++++++++++++++++++++
libs/parser/lkc.h | 1 +
libs/parser/yconf.y | 2 +-
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/libs/parser/lconf.l b/libs/parser/lconf.l
index c410d25..502b9c5 100644
--- a/libs/parser/lconf.l
+++ b/libs/parser/lconf.l
@@ -8,6 +8,7 @@
* Released under the terms of the GNU GPL v2.0.
*/
+#include <glob.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -347,6 +348,42 @@ void zconf_nextfile(const char *name)
current_file = file;
}
+void zconf_nextfiles(const char *wildcard)
+{
+ glob_t g;
+ char **w;
+ int i;
+ char *env, fullname[PATH_MAX+1];
+ const char *expanded = sym_expand_string_value(wildcard);
+
+ if (glob(expanded, 0, NULL, &g) != 0) {
+ env = getenv(SRCTREE);
+ if (env) {
+ sprintf(fullname, "%s/%s", env, expanded);
+ if (glob(fullname, 0, NULL, &g) != 0) {
+ return;
+ }
+ } else {
+ return;
+ }
+ }
+ if (g.gl_pathv == NULL) {
+ globfree(&g);
+ return;
+ }
+
+ /* working through files backwards, since
+ * we're first pushing them on a stack
+ * before actually handling them.
+ */
+ for (i = g.gl_pathc; i > 0; i--) {
+ w = &g.gl_pathv[i - 1];
+ zconf_nextfile(*w);
+ }
+
+ globfree(&g);
+}
+
static void zconf_endfile(void)
{
struct buffer *parent;
diff --git a/libs/parser/lkc.h b/libs/parser/lkc.h
index 91ca126..b1f1cc3 100644
--- a/libs/parser/lkc.h
+++ b/libs/parser/lkc.h
@@ -73,6 +73,7 @@ void zconf_starthelp(void);
FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
void zconf_nextfile(const char *name);
+void zconf_nextfiles(const char *name);
int zconf_lineno(void);
const char *zconf_curname(void);
diff --git a/libs/parser/yconf.y b/libs/parser/yconf.y
index f57c062..8b4a6e7 100644
--- a/libs/parser/yconf.y
+++ b/libs/parser/yconf.y
@@ -393,7 +393,7 @@ menu_block:
source_stmt: T_SOURCE prompt T_EOL
{
printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
- zconf_nextfile($2);
+ zconf_nextfiles($2);
};
/* comment entry */
--
2.9.4

View File

@ -0,0 +1,67 @@
From a375f2682bebaf05fa704236f51f3bddbdeaac8d Mon Sep 17 00:00:00 2001
From: Anas Nashif <anas.nashif@intel.com>
Date: Sat, 19 Aug 2017 08:11:04 -0400
Subject: [PATCH 2/2] kconfig: prefer default values that are defined later
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
---
libs/parser/symbol.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/libs/parser/symbol.c b/libs/parser/symbol.c
index 20136ff..1b7234e 100644
--- a/libs/parser/symbol.c
+++ b/libs/parser/symbol.c
@@ -11,6 +11,12 @@
#include "lkc.h"
+/* When this is set to 1, sym_get_default_prop() will
+ * return P_DEFAULT that are parsed later in Kconfig
+ * files.
+ */
+#define PREFER_LATER_DEFAULTS 1
+
struct symbol symbol_yes = {
.name = "y",
.curr = { "y", yes },
@@ -112,6 +118,28 @@ struct property *sym_get_env_prop(struct symbol *sym)
return NULL;
}
+#if PREFER_LATER_DEFAULTS
+struct property *sym_get_default_prop(struct symbol *sym)
+{
+ struct property *prop;
+ struct property *ret_prop = NULL;
+
+ for_all_defaults(sym, prop) {
+ prop->visible.tri = expr_calc_value(prop->visible.expr);
+ if (prop->visible.tri != no) {
+ if (prop->type == P_DEFAULT) {
+ /* Prefer P_DEFAULT that are parsed
+ * later in all Kconfig files.
+ */
+ ret_prop = prop;
+ continue;
+ }
+ return prop;
+ }
+ }
+ return ret_prop;
+}
+#else
static struct property *sym_get_default_prop(struct symbol *sym)
{
struct property *prop;
@@ -123,6 +151,7 @@ static struct property *sym_get_default_prop(struct symbol *sym)
}
return NULL;
}
+#endif
static struct property *sym_get_range_prop(struct symbol *sym)
{
--
2.9.4

View File

@ -0,0 +1,45 @@
# Copyright (C) 2012 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Linux kernel style configuration framework for other projects"
DESCRIPTION = "The kconfig-frontends project aims at centralising \
the effort of keeping an up-to-date, out-of-tree, packaging of the \
kconfig infrastructure, ready for use by third-party projects. \
The kconfig-frontends package provides the kconfig parser, as well as all \
the frontends"
HOMEPAGE = "http://ymorin.is-a-geek.org/projects/kconfig-frontends"
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "file://COPYING;md5=9b8cf60ff39767ff04b671fca8302408"
DEPENDS += "ncurses flex bison gperf-native"
RDEPENDS_${PN} += "python3 bash"
SRC_URI = "git://ymorin.is-a-geek.org/kconfig-frontends;branch=4.11.x \
file://0001-Makefile-ensure-frontends-exits-before-writing-into-.patch \
file://0001-Switch-utils-kconfig-diff-to-use-Python-3.patch \
file://0001-zephyr-add-support-for-wildcards.patch \
file://0002-kconfig-prefer-default-values-that-are-defined-later.patch \
"
SRCREV = "f22fce3a308be1c7790ebefc6bbedb33c5f7c86a"
S = "${WORKDIR}/git"
PV = "4.11.0.1"
BBCLASSEXTEND += "nativesdk"
inherit autotools pkgconfig
do_configure_prepend () {
mkdir -p ${S}/scripts/.autostuff/m4
}
do_install_append() {
ln -s kconfig-conf ${D}${bindir}/conf
ln -s kconfig-mconf ${D}${bindir}/mconf
}
EXTRA_OECONF += "--disable-gconf --disable-qconf"
# Some packages have the version preceeding the .so instead properly
# versioned .so.<version>, so we need to reorder and repackage.
SOLIBS = "-${@d.getVar('PV', True)[:-2]}.so"
FILES_SOLIBSDEV = "${libdir}/libkconfig-parser.so"

View File

@ -0,0 +1,47 @@
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
DEPENDS = "libusb-compat hidapi-libraw"
RDEPENDS_${PN} = "libusb1 hidapi-libraw"
# The various arc files are based on the commit e781e73a39bc5c845b73dc96b751d867278a7583
# of https://github.com/foss-for-synopsys-dwc-arc-processors/openocd
SRC_URI = " \
git://github.com/zephyrproject-rtos/openocd.git;protocol=https;nobranch=1 \
"
SRCREV = "ea2753a721baee6971c5149f34cbef0f0667e37e"
S = "${WORKDIR}/git"
inherit pkgconfig autotools gettext
BBCLASSEXTEND += "nativesdk"
EXTRA_OECONF = "--enable-ftdi --enable-cmsis-dap --enable-jlink --enable-stlink --disable-doxygen-html "
do_configure() {
cd ${S}
export ALL_PROXY="${ALL_PROXY}"
export GIT_PROXY_COMMAND=${GIT_PROXY_COMMAND}
./bootstrap
oe_runconf ${EXTRA_OECONF}
}
do_compile() {
:
}
do_install() {
cd ${S}
oe_runmake DESTDIR=${D} install
if [ -e "${D}${infodir}" ]; then
rm -Rf ${D}${infodir}
fi
if [ -e "${D}${mandir}" ]; then
rm -Rf ${D}${mandir}
fi
if [ -e "${D}${bindir}/.debug" ]; then
rm -Rf ${D}${bindir}/.debug
fi
}

View File

@ -0,0 +1,34 @@
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
DEPENDS = "openssl"
SRCREV = "04a535d508e60e4dbfeccb07b362d8f5d4f8cbf1"
SRC_URI = "git://git.alsa-project.org/sound-open-firmware-tools.git"
S = "${WORKDIR}/git"
inherit autotools
BBCLASSEXTEND += "nativesdk"
do_configure_prepend() {
cd ${S}
${S}/autogen.sh
}
do_configure() {
make distclean || :
oe_runconf
}
do_compile() {
cd ${S}
oe_runmake
}
do_install() {
cd ${S}
oe_runmake DESTDIR=${D} install
}

View File

@ -0,0 +1,9 @@
SRCREV = "78e113e81c9d33d0f33704b187a46399d5a75419"
PV = "1.4.7+git"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
do_install () {
oe_runmake install NO_PYTHON=1
}
FILES_${PN}-misc_append = "${bindir}/fdtoverlay ${bindir}/fdtput ${bindir}/fdtget"

View File

@ -0,0 +1,26 @@
From e9852b9d206df1e42aa4c8afec55a0f5e099b533 Mon Sep 17 00:00:00 2001
From: Saul Wold <sgw@linux.intel.com>
Date: Thu, 3 Nov 2011 08:35:47 -0700
Subject: [PATCH] dtc: Add patch to correctly install shared libraries and
Upstream-Status: Inappropriate [configuration]
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index d8ebc4f..f5e01be 100644
--- a/Makefile
+++ b/Makefile
@@ -205,8 +205,8 @@ install-bin: all $(SCRIPTS)
install-lib: all
@$(VECHO) INSTALL-LIB
$(INSTALL) -d $(DESTDIR)$(LIBDIR)
- $(INSTALL_LIB) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)
- ln -sf $(notdir $(LIBFDT_lib)) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname)
+ $(INSTALL) $(LIBFDT_lib) $(DESTDIR)$(LIBDIR)/$(LIBFDT_soname)
+ ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/$(notdir $(LIBFDT_lib))
ln -sf $(LIBFDT_soname) $(DESTDIR)$(LIBDIR)/libfdt.$(SHAREDLIB_EXT)
$(INSTALL_DATA) $(LIBFDT_archive) $(DESTDIR)$(LIBDIR)

View File

@ -0,0 +1,184 @@
#!/bin/sh
#
# The folder "toolchains" should contain several individually installable toolchains.
# This script merges the toolchains into a single installable file.
#
# Ideally the script would do:
# build toolchain x86 -> copy to ./toolchains
# build toolchain ARM -> copy to ./toolchains
# build toolchain ARC -> copy to ./toolchains
# build host tools -> copy to ./toolchains
# merge toolchains (using makeself)
#
# At present copying is done manually.
#
# SDK should follow a vM.m versioning scheme
#
# Major versions for big interface/usage changes
# Minor versions for additions of interfaces, transparent changes
#
# Default installation directory should be /opt/zephyr-sdk/
#
# Naming scheme: 1st drop
# zephyr-sdk-0.1-i686-setup.run
#
# After that (with additional content/fixes)
# zephyr-sdk-0.2-i686-setup.run
#
# ….
#
# Once the toolchain/SDK is ”feature complete”
#
# zephyr-sdk-1.0-i686-setup.run
#
# ….
#
# Edit as needed:
version_major=0
version_minor=9
subversion_minor=5
prerelease=
if [ "$1" != "" ] ; then
product_name=$1
else
product_name=zephyr-sdk
fi
# Create ./setup.sh
if [ "$subversion_minor" -ne "0" ]; then
sdk_version=$version_major.$version_minor.$subversion_minor
else
sdk_version=$version_major.$version_minor
fi
if [ -n "$prerelease" ]; then
sdk_version=${sdk_version}-${prerelease}
fi
setup=toolchains/setup.sh
default_dir=/opt/${product_name}/
toolchain_name=${product_name}-${sdk_version}-setup.run
version_dir=info-zephyr-sdk-${sdk_version}
# Identify files present in toolchains folder
parse_toolchain_name()
{
local varname=$1
local arch=$2
local num
local filename
num=$(ls toolchains | grep $arch | wc -l)
if [ "$num" -gt "1" ]; then
echo "Error: Multiple toolchains for \"$arch\" "
exit 1
fi
if [ "$num" -eq "0" ]; then
echo "Warning: Missing toolchain for \"$arch\" "
fi
filename=$(ls toolchains | grep $arch)
eval "$varname=\$filename"
}
parse_toolchain_name file_gcc_arm arm
parse_toolchain_name file_gcc_arc arc
parse_toolchain_name file_gcc_x86 i586
parse_toolchain_name file_gcc_iamcu iamcu
parse_toolchain_name file_gcc_mips mips32r2
parse_toolchain_name file_gcc_nios2 nios2
parse_toolchain_name file_gcc_xtensa xtensa
parse_toolchain_name file_gcc_riscv32 riscv32
parse_toolchain_name file_hosttools hosttools
# Host tools are non-optional
if [ -z "$file_hosttools" ]; then
echo "Error: Missing host tools!"
exit 1
fi
echo '#!/bin/bash' > $setup
echo "DEFAULT_INSTALL_DIR=$default_dir" >> $setup
echo "TOOLCHAIN_NAME=$toolchain_name" >> $setup
echo "VERSION_DIR=$version_dir" >> $setup
echo "SDK_VERSION=${sdk_version}" >> $setup
cat template_dir >>$setup
if [ -n "$file_gcc_x86" ]; then
echo "./$file_gcc_x86 -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing x86 tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_arm" ]; then
echo "./$file_gcc_arm -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing arm tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_arc" ]; then
echo "./$file_gcc_arc -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing arc tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_iamcu" ]; then
echo "./$file_gcc_iamcu -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing iamcu tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_mips" ]; then
echo "./$file_gcc_mips -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing mips tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_nios2" ]; then
echo "./$file_gcc_nios2 -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing nios2 tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_xtensa" ]; then
echo "./$file_gcc_xtensa -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing xtensa tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_gcc_riscv32" ]; then
echo "./$file_gcc_riscv32 -R -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing riscv32 tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
if [ -n "$file_hosttools" ]; then
echo "./$file_hosttools -y -d \$target_sdk_dir > /dev/null &" >> $setup
echo "spinner \$! \"Installing additional host tools...\"" >> $setup
echo "[ \$? -ne 0 ] && echo \"Error(s) encountered during installation.\" && exit 1" >>$setup
echo "echo \"\"" >>$setup
fi
echo "" >>$setup
echo "do_cleanup" >>$setup
echo "" >>$setup
echo "echo \"Success installing SDK. SDK is ready to be used.\"" >>$setup
chmod 777 $setup
makeself toolchains/ $toolchain_name "SDK for Zephyr" ./setup.sh

View File

@ -0,0 +1,236 @@
#!/bin/bash
#
# Copyright (C) 2015-2016, Intel Corporation.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
META_ZEPHYR_SDK_SOURCE=${SDK_SOURCE:-"meta-zephyr-sdk"}
META_POKY_SOURCE=${POKY_SOURCE:-"poky"}
META_ZEPHYR_SDK_SOURCE=$(readlink -f $META_ZEPHYR_SDK_SOURCE)
META_POKY_SOURCE=$(readlink -f $META_POKY_SOURCE)
TOOLCHAINS="${META_ZEPHYR_SDK_SOURCE}/scripts/toolchains"
META_DOWNLOADS=${META_DOWNLOADS:-"$META_POKY_SOURCE/downloads"}
META_SSTATE=${SSTATE_LOCATION:-"$META_POKY_SOURCE/sstate"}
if [ ! -d $META_ZEPHYR_SDK_SOURCE ] ; then
echo "ERROR: could not find $META_ZEPHYR_SDK_SOURCE"
exit 1
fi
if [ ! -d $META_POKY_SOURCE ] ; then
echo "ERROR: could not find $META_POKY_SOURCE"
exit 1
fi
if [ ! -d $META_DOWNLOADS ] ; then
mkdir -p $META_DOWNLOADS
fi
export DL_DIR=$META_DOWNLOADS
if [ ! -d $TOOLCHAINS ] ; then
mkdir -p $TOOLCHAINS
fi
rm -rf $TOOLCHAINS/*
# setconf_var, i.e. "MACHINE","qemuarm",$localconf
setconf_var()
{
sed -i "/^$1=/d" $3
echo "$1=\"$2\"" >> $3
echo $1="$2"
}
header ()
{
echo ""
echo "########################################################################"
echo " $1"
echo "########################################################################"
}
newbuild()
{
cd $META_POKY_SOURCE
source oe-init-build-env $1
# Create bblayers.conf
bblayers=conf/bblayers.conf
echo "# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf" > $bblayers
echo "# changes incompatibly" >> $bblayers
echo "LCONF_VERSION = \"6\"" >> $bblayers
echo "" >> $bblayers
echo "BBPATH = \"\${TOPDIR}\"" >> $bblayers
echo "BBFILES ?= \"\"" >> $bblayers
echo "BBLAYERS ?= \" \\" >> $bblayers
echo " $META_POKY_SOURCE/meta \\" >> $bblayers
echo " $META_POKY_SOURCE/meta-yocto \\" >> $bblayers
echo " $META_POKY_SOURCE/meta-yocto-bsp \\" >> $bblayers
echo " $META_ZEPHYR_SDK_SOURCE \\" >> $bblayers
echo " \" " >> $bblayers
# Common values for all builds
localconf=conf/local.conf
setconf_var "SSTATE_DIR" "$META_SSTATE" $localconf
setconf_var "DL_DIR" "$META_DOWNLOADS" $localconf
setconf_var "SDKMACHINE" "x86_64" $localconf
setconf_var "DISTRO" "zephyr-sdk" $localconf
}
if [ "$1" = "tools" ]; then
header "Building Zephyr host tools..."
newbuild build-zephyr-tools > /dev/null
setconf_var "MACHINE" "qemux86" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake hosttools-tarball -c clean > /dev/null
bitbake hosttools-tarball
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
echo "Building additional host tools...done"
fi
if [ "$1" = "xtensa" ]; then
# build Xtensa toolchain
header "Building Xtensa toolchain..."
newbuild build-zephyr-xtensa > /dev/null
setconf_var "MACHINE" "xtensa" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib xtensa-hal-staticdev" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building Xtensa toolchain...done"
fi
if [ "$1" = "riscv32" ]; then
# build RISC-V toolchain
header "Building riscv32 toolchain..."
newbuild build-zephyr-riscv32 > /dev/null
setconf_var "MACHINE" "riscv32" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building riscv32 toolchain...done"
fi
if [ "$1" = "nios2" ]; then
# build NIOS2 toolchain
header "Building Nios2 toolchain..."
newbuild build-zephyr-nios2 > /dev/null
setconf_var "MACHINE" "nios2" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building Nios2 toolchain...done"
fi
if [ "$1" = "arm" ]; then
# build ARM toolchain
header "Building ARM toolchain..."
newbuild build-zephyr-arm > /dev/null
setconf_var "MACHINE" "qemuarm" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
setconf_var "TUNE_FEATURES" "armv7m cortexm3" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building ARM toolchain...done"
fi
if [ "$1" = "x86" ]; then
# build x86 toolchain
header "Building x86 toolchain..."
newbuild build-zephyr-x86 > /dev/null
setconf_var "MACHINE" "qemux86" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building x86 toolchain...done"
fi
if [ "$1" = "mips" ]; then
# build MIPS toolchain
header "Building MIPS toolchain..."
newbuild build-zephyr-mips > /dev/null
setconf_var "MACHINE" "qemumips" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building MIPS toolchain...done"
fi
if [ "$1" = "arc" ]; then
# build ARC toolchain...
header "Building ARC toolchain..."
newbuild build-zephyr-arc > /dev/null
setconf_var "MACHINE" "arc" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building ARC toolchain...done"
fi
if [ "$1" = "iamcu" ]; then
# build IAMCU toolchain
header "Building IAMCU toolchain..."
newbuild build-zephyr-iamcu > /dev/null
setconf_var "MACHINE" "iamcu" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building IAMCU toolchain...done"
fi

View File

@ -0,0 +1,229 @@
#!/bin/bash
#
# Copyright (C) 2015-2016, Intel Corporation.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
META_ZEPHYR_SDK_SOURCE=${SDK_SOURCE:-"meta-zephyr-sdk"}
META_POKY_SOURCE=${POKY_SOURCE:-"poky"}
META_ZEPHYR_SDK_SOURCE=$(readlink -f $META_ZEPHYR_SDK_SOURCE)
META_POKY_SOURCE=$(readlink -f $META_POKY_SOURCE)
TOOLCHAINS="${META_ZEPHYR_SDK_SOURCE}/scripts/toolchains"
META_DOWNLOADS=${META_DOWNLOADS:-"$META_POKY_SOURCE/downloads"}
META_SSTATE=${SSTATE_LOCATION:-"$META_POKY_SOURCE/sstate"}
if [ ! -d $META_ZEPHYR_SDK_SOURCE ] ; then
echo "ERROR: could not find $META_ZEPHYR_SDK_SOURCE"
exit 1
fi
if [ ! -d $META_POKY_SOURCE ] ; then
echo "ERROR: could not find $META_POKY_SOURCE"
exit 1
fi
if [ ! -d $META_DOWNLOADS ] ; then
mkdir -p $META_DOWNLOADS
fi
export DL_DIR=$META_DOWNLOADS
if [ ! -d $TOOLCHAINS ] ; then
mkdir -p $TOOLCHAINS
fi
rm -rf $TOOLCHAINS/*
# setconf_var, i.e. "MACHINE","qemuarm",$localconf
setconf_var()
{
sed -i "/^$1=/d" $3
echo "$1=\"$2\"" >> $3
echo $1="$2"
}
header ()
{
echo ""
echo "########################################################################"
echo " $1"
echo "########################################################################"
}
newbuild()
{
cd $META_POKY_SOURCE
source oe-init-build-env $1
# Create bblayers.conf
bblayers=conf/bblayers.conf
echo "# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf" > $bblayers
echo "# changes incompatibly" >> $bblayers
echo "LCONF_VERSION = \"6\"" >> $bblayers
echo "" >> $bblayers
echo "BBPATH = \"\${TOPDIR}\"" >> $bblayers
echo "BBFILES ?= \"\"" >> $bblayers
echo "BBLAYERS ?= \" \\" >> $bblayers
echo " $META_POKY_SOURCE/meta \\" >> $bblayers
echo " $META_POKY_SOURCE/meta-yocto \\" >> $bblayers
echo " $META_POKY_SOURCE/meta-yocto-bsp \\" >> $bblayers
echo " $META_ZEPHYR_SDK_SOURCE \\" >> $bblayers
echo " \" " >> $bblayers
# Common values for all builds
localconf=conf/local.conf
setconf_var "SSTATE_DIR" "$META_SSTATE" $localconf
setconf_var "DL_DIR" "$META_DOWNLOADS" $localconf
setconf_var "SDKMACHINE" "x86_64" $localconf
setconf_var "DISTRO" "zephyr-sdk" $localconf
}
##############################################################################
# 32 bit build
##############################################################################
header "Building Zephyr host tools..."
newbuild build-zephyr-tools > /dev/null
setconf_var "MACHINE" "qemux86" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake hosttools-tarball -c clean > /dev/null
bitbake hosttools-tarball
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
echo "Building additional host tools...done"
# build Xtensa toolchain
header "Building Xtensa toolchain..."
newbuild build-zephyr-xtensa > /dev/null
setconf_var "MACHINE" "xtensa" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib xtensa-hal-staticdev" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building Xtensa toolchain...done"
# build RISC-V toolchain
header "Building riscv32 toolchain..."
newbuild build-zephyr-riscv32 > /dev/null
setconf_var "MACHINE" "riscv32" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building riscv32 toolchain...done"
# build NIOS2 toolchain
header "Building Nios2 toolchain..."
newbuild build-zephyr-nios2 > /dev/null
setconf_var "MACHINE" "nios2" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building Nios2 toolchain...done"
# build ARM toolchain
header "Building ARM toolchain..."
newbuild build-zephyr-arm > /dev/null
setconf_var "MACHINE" "qemuarm" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
setconf_var "TUNE_FEATURES" "armv7m cortexm3" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building ARM toolchain...done"
# build x86 toolchain
header "Building x86 toolchain..."
newbuild build-zephyr-x86 > /dev/null
setconf_var "MACHINE" "qemux86" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building x86 toolchain...done"
# build MIPS toolchain
header "Building MIPS toolchain..."
newbuild build-zephyr-mips > /dev/null
setconf_var "MACHINE" "qemumips" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building MIPS toolchain...done"
# build ARC toolchain...
header "Building ARC toolchain..."
newbuild build-zephyr-arc > /dev/null
setconf_var "MACHINE" "arc" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building ARC toolchain...done"
# build IAMCU toolchain
header "Building IAMCU toolchain..."
newbuild build-zephyr-iamcu > /dev/null
setconf_var "MACHINE" "iamcu" $localconf
setconf_var "TCLIBC" "baremetal" $localconf
setconf_var "TOOLCHAIN_TARGET_TASK_append" " newlib" $localconf
rm -f ./tmp/deploy/sdk/*.sh
bitbake meta-toolchain -c clean > /dev/null
bitbake meta-toolchain
[ $? -ne 0 ] && echo "Error(s) encountered during bitbake." && exit 1
cp ./tmp/deploy/sdk/*.sh $TOOLCHAINS
[ $? -ne 0 ] && exit 1
header "Building IAMCU toolchain...done"
# Pack it together ...
cd $META_ZEPHYR_SDK_SOURCE/scripts
header "Creating SDK..."
./make_zephyr_sdk.sh
if [ $? -ne 0 ] ; then
echo "Error(s) encountered during SDK creation."
exit 1
fi

View File

@ -0,0 +1,48 @@
#!/bin/bash
#
# Copyright (C) 2015-2016, Intel Corporation.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
POKY_KNOWN_COMMIT=${POKY_COMMIT:-"dc8508f609974cc99606b9042bfa7f870ce80228"}
META_ZEPHYR_SDK_SOURCE=${SDK_SOURCE:-"meta-zephyr-sdk"}
META_POKY_SOURCE=${POKY_SOURCE:-"poky"}
META_ZEPHYR_SDK_SOURCE=$(readlink -f $META_ZEPHYR_SDK_SOURCE)
META_POKY_SOURCE=$(readlink -f $META_POKY_SOURCE)
if [ ! -d $META_ZEPHYR_SDK_SOURCE ] ; then
echo "ERROR: could not find $META_ZEPHYR_SDK_SOURCE"
exit 1
fi
if [ ! -d $META_POKY_SOURCE ] ; then
git clone http://git.yoctoproject.org/git/poky
META_POKY_SOURCE=$(readlink -f "poky")
fi
# Checkout the commit known to build...
cd $META_POKY_SOURCE
git checkout $POKY_KNOWN_COMMIT
# Patch poky with meta-zephyr-sdk patches
if [ -d $META_ZEPHYR_SDK_SOURCE/patches ] ; then
echo "Patching poky in: $PWD"
for i in $META_ZEPHYR_SDK_SOURCE/patches/*.patch;
do
patch -s -p1 < $i;
done
fi

View File

@ -0,0 +1,200 @@
target_sdk_dir=""
post_install_cleanup=1
confirm=0
usage () {
cat << EOF
Usage : $TOOLCHAIN_NAME < -- options >
Options:
-h
Display this help and exit.
-d <dir>
Specify the absolute path of the SDK installation directory.
-y
Automatic yes to prompts; assume "yes" as answer to all prompts.
EOF
}
verify_os () {
case "$(uname -s)" in
Darwin)
echo 'OS X is not supported!'
exit 1
;;
# Linux, the only supported OS
Linux)
#echo 'Linux'
;;
# Other OS ...
# see https://en.wikipedia.org/wiki/Uname#Examples
# Don't allow to install on any of them, this includes cygwin, Windows,
# Solaris etc.
*)
echo 'Unsupported OS'
exit 1
;;
esac
}
while [ "$1" != "" ]; do
case $1 in
-h )
usage
exit 0
;;
-d )
shift
target_sdk_dir=$1
;;
-nocleanup )
post_install_cleanup=0;
;;
-y )
confirm="y";
;;
* )
echo "Error: Invalid argument \"$1\""
usage
exit 1
;;
esac
shift
done
spinner()
{
local pid=$1
local delay=0.175
local spinstr='|/-\'
local infotext=$2
while kill -0 $pid 2>/dev/null ; do
local temp=${spinstr#?}
printf " [%c] %s" "$spinstr" "$infotext"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
for i in $(seq 1 ${#infotext}); do
printf "\b"
done
done
printf " [*] %s" "$infotext"
printf " \b\b\b\b"
}
do_cleanup()
{
cd $target_sdk_dir
if [ $post_install_cleanup = "1" ]; then
#rm site-config*
rm environment-setup*
fi
install -d -m 0755 $VERSION_DIR
mv version-* $VERSION_DIR
echo "$SDK_VERSION" > sdk_version
chmod 0644 sdk_version
}
# Read the input "y"
read_confirm () {
echo "The directory $target_sdk_dir/sysroots will be removed! "
if [ "$confirm" != "y" ]; then
echo "Do you want to continue (y/n)? "
while read confirm; do
[ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \
-o "$confirm" = "N" ] && break
echo "Invalid input \"$confirm\", please input 'y' or 'n': "
done
else
echo
fi
}
verify_os
which python3 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: required python3 binary not in PATH" 1>&2
exit 1
fi
which xz 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo "ERROR: required xz binary not in PATH" 1>&2
exit 1
fi
if [ "$target_sdk_dir" = "" ]; then
read -e -p "Enter target directory for SDK (default: $DEFAULT_INSTALL_DIR): " target_sdk_dir
[ "$target_sdk_dir" = "" ] && target_sdk_dir=$DEFAULT_INSTALL_DIR
fi
eval target_sdk_dir=$target_sdk_dir
if [[ $target_sdk_dir != /* ]]; then
echo "The target directory path ($target_sdk_dir) must be an absolute path. Abort!"
exit 1;
fi
eval target_sdk_dir=$(echo "$target_sdk_dir"|sed 's/ /\\ /g')
if [ -d "$target_sdk_dir" ]; then
target_sdk_dir=$(cd "$target_sdk_dir"; pwd)
else
target_sdk_dir=$(readlink -m "$target_sdk_dir")
fi
if [ -n "$(echo $target_sdk_dir|grep ' ')" ]; then
echo "The target directory path ($target_sdk_dir) contains spaces. Abort!"
exit 1
fi
echo "Installing SDK to $target_sdk_dir"
if [ -d $target_sdk_dir ]; then
# If the directory exists, test for write permission
if [ ! -w $target_sdk_dir ] ; then
echo "No permission, please run as 'sudo'"
exit 1
else
# wipe the directory first
if [ -d $target_sdk_dir/sysroots ]; then
read_confirm
if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
rm -rf $target_sdk_dir/sysroots/
rm -rf $target_sdk_dir/info-zephyr-sdk*/
rm -fr $target_sdk_dir/sdk_version
else
# Abort the installation
echo "SDK installation aborted!"
exit 1
fi
fi
fi
else
echo "Creating directory $target_sdk_dir"
# Try to create the directory (this will not succeed if user doesn't have rights)
if install -d -m 0751 $target_sdk_dir >/dev/null 2>&1 ; then
echo "Success"
else
echo "No permission, please run as 'sudo'"
exit 1
fi
fi
if (( EUID != 0 )); then
umask 0002
#else
# umask 0022
fi