Consolidated pull
cover Consolidated pull
This set of patches provides:
1. Support for Zephyr menuconfig and devshell.
These are meant to modify project settings: menuconfig is used to change kernel configuration, devshell makes it easier to manually edit Zephyr prj.conf files
2. New MACHINE qemu-x86, corresponding to the zephyr BOARD qemu_x86
3. Support for "newlib", for all supported toolchains: x86, IAMCU, ARM and ARC.
4. Minor housekeeping (removed unneeded patches, modified descriptions, etc.)
Juro Bystricky (5):
qemu-cortex-m3.conf: updated NAME/DESCRIPTION
qemu-x86.conf: New MACHINE
gcc (ARC): removed unneeded patches
zephyr.bbclass: support for image configuration
meta-zephyr: newlib support
classes/zephyr.bbclass | 53 +++ conf/distro/zephyr.conf | 1 + conf/machine/qemu-cortex-m3.conf | 4 +- conf/machine/qemu-x86.conf | 11 + recipes-core/newlib/newlib/assert-fiprintf.patch | 23 ++ .../newlib/newlib/gettimeofday-header-fix.patch | 20 ++ .../newlib/newlib/iamcu-commit-5d3ad3b.patch | 399 +++++++++++++++++++++ recipes-core/newlib/newlib_2.%.bb | 83 +++++ recipes-core/newlib/newlib_2.%.bbappend | 23 ++ recipes-devtools-arc/gcc/gcc-6.x.arc.inc | 2 - recipes-devtools/gcc/libgcc_6.%.bbappend | 3 + .../zephyr-kernel/files/Makefile.toolchain.yocto | 19 +- recipes-kernel/zephyr-kernel/zephyr-image.inc | 8 +- .../zephyr-kernel/zephyr-kernel-common.inc | 19 +- .../zephyr-kernel/zephyr-philosophers.bb | 10 +- .../zephyr-getchar/zephyr-getchar_git.bb | 10 +- 16 files changed, 657 insertions(+), 31 deletions(-) create mode 100644 classes/zephyr.bbclass create mode 100644 conf/machine/qemu-x86.conf create mode 100644 recipes-core/newlib/newlib/assert-fiprintf.patch create mode 100644 recipes-core/newlib/newlib/gettimeofday-header-fix.patch create mode 100644 recipes-core/newlib/newlib/iamcu-commit-5d3ad3b.patch create mode 100644 recipes-core/newlib/newlib_2.%.bb create mode 100644 recipes-core/newlib/newlib_2.%.bbappend create mode 100644 recipes-devtools/gcc/libgcc_6.%.bbappend
Signature · 1 line
2.7.4
PATCH 1/5 qemu-cortex-m3.conf: updated NAME/DESCRIPTION
--- conf/machine/qemu-cortex-m3.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
conf/machine/qemu-cortex-m3.conf +2 -2
@@ -1,6 +1,6 @@ #@TYPE: Machine -#@NAME: lm3s6965evb -#@DESCRIPTION: lm3s6965evb +#@NAME: qemu-cortex-m3 +#@DESCRIPTION: Machine for Zephyr BOARD qemu_cortex_m3 require conf/machine/include/qemu.inc require conf/machine/include/tune-cortexm3.inc
Signature · 1 line
2.7.4
PATCH 2/5 qemu-x86.conf: New MACHINE
In reply to Juro BystrickyMACHINE definition for Zephyr BOARD qemu_x86
--- conf/machine/qemu-x86.conf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 conf/machine/qemu-x86.conf
conf/machine/qemu-x86.conf new file +11 -0
@@ -0,0 +1,11 @@ +#@TYPE: Machine +#@NAME: qemu-x86 +#@DESCRIPTION: Machine for Zephyr BOARD qemu_x86 + +require conf/machine/include/qemu.inc +require conf/machine/include/tune-i586.inc + +# For runqemu (TBD) +QB_SYSTEM_NAME = "qemu-system-i386" +QB_MACHINE = "-machine pc-0.14" +QB_OPT_APPEND = "-nographic -display none -clock dynticks -no-acpi -balloon none"
Signature · 1 line
2.7.4
PATCH 3/5 gcc (ARC): removed unneeded patches
In reply to Juro Bystricky--- recipes-devtools-arc/gcc/gcc-6.x.arc.inc | 2 -- 1 file changed, 2 deletions(-)
recipes-devtools-arc/gcc/gcc-6.x.arc.inc +0 -2
@@ -28,8 +28,6 @@ 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 \ "
Signature · 1 line
2.7.4
PATCH 4/5 zephyr.bbclass: support for image configuration
In reply to Juro BystrickyNew class to support commands such as:
$ MACHINE=xxx bitbake yyy -c menuconfig $ MACHINE=xxx bitbake yyy -c devshell
Kernel options are typically configured via menuconfig.
The file "prj.conf" must be edited manually, hence the need for devshell. Once in devshell, user can use their favorite editor to edit the file.
For proper operation, these two variables need to be set in recipes:
ZEPHYR_SRC_DIR : path to the source, typically place with prj.confZEPHYR_BASE: Zephyr kernel tree location
[YOCTO#10657]
--- classes/zephyr.bbclass | 53 ++++++++++++++++++++++ recipes-kernel/zephyr-kernel/zephyr-image.inc | 8 +--- .../zephyr-kernel/zephyr-kernel-common.inc | 13 +++--- .../zephyr-kernel/zephyr-philosophers.bb | 10 ++-- .../zephyr-getchar/zephyr-getchar_git.bb | 10 ++-- 5 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 classes/zephyr.bbclass
classes/zephyr.bbclass new file +53 -0
@@ -0,0 +1,53 @@ + + +inherit terminal + +OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC" +HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}" +HOSTLDFLAGS = "${BUILD_LDFLAGS}" +CROSS_CURSES_LIB = "-lncurses -ltinfo" +CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"' +TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" + +KCONFIG_CONFIG_COMMAND ??= "menuconfig" + +python () { + # Translate MACHINE into Zephyr BOARD + # Zephyr BOARD is basically our MACHINE, except we must use "-" instead of "_" + board = d.getVar('MACHINE',True) + board = board.replace('-', '_') + d.setVar('BOARD',board) +} + +python do_menuconfig() { + os.chdir(d.getVar('ZEPHYR_SRC_DIR', True)) + configdir = d.getVar('ZEPHYR_SRC_DIR', True) + '/outdir/' + d.getVar('BOARD', True) + try: + mtime = os.path.getmtime(configdir +"/.config") + except OSError: + mtime = 0 + + oe_terminal("${SHELL} -c \"ZEPHYR_BASE=%s make BOARD=%s %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; \ + printf 'Press any key to continue... '; \ + read r; fi\"" % (d.getVar('ZEPHYR_BASE', True), d.getVar('BOARD', True),d.getVar('KCONFIG_CONFIG_COMMAND', True)), + d.getVar('PN', True) + ' Configuration', d) + + try: + newmtime = os.path.getmtime(configdir +"/.config") + except OSError: + newmtime = 0 + + if newmtime > mtime: + bb.warn("Configuration changed, recompile will be forced") + bb.build.write_taint('do_compile', d) +} +do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" +do_menuconfig[nostamp] = "1" +do_menuconfig[dirs] = "${B}" +addtask menuconfig after do_configure + +python do_devshell_prepend () { + # Most likely we need to manually edit prj.conf... + os.chdir(d.getVar('ZEPHYR_SRC_DIR', True)) +} +
recipes-kernel/zephyr-kernel/zephyr-image.inc +2 -6
@@ -6,15 +6,11 @@ inherit deploy QEMU_BIN_PATH = "${STAGING_BINDIR_NATIVE}" -OE_TERMINAL_EXPORTS += "CROSS_COMPILE" -OE_TERMINAL_EXPORTS += "BOARD" +ZEPHYR_BASE = "${S}" do_compile () { cd ${S} - export ZEPHYR_BASE=${S} - export ZEPHYR_GCC_VARIANT="yocto" - ${MAKE_COMMAND} -C ${ZEPHYR_IMAGE_SRCDIR} pristine - ${MAKE_COMMAND} -C ${ZEPHYR_IMAGE_SRCDIR} + oe_runmake ${ZEPHYR_MAKE_ARGS} -C ${ZEPHYR_IMAGE_SRCDIR} } do_deploy () {
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +7 -6
@@ -1,15 +1,12 @@ # Common settings for all Zephyr recipes +inherit zephyr + # There shouldn't be a manifest for zephyr kernels since there is no root # filesystem. IMAGE_NO_MANIFEST = "1" -# Zephyr BOARD is basically our MACHINE, except we must use "-" instead of "_" -BOARD="$(echo ${MACHINE} | tr - _)" - -# oe_runmake isn't used because of the make -e causing issues with some -# make variables. -MAKE_COMMAND = "make -j V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE}" +ZEPHYR_MAKE_ARGS = " V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE} ZEPHYR_GCC_VARIANT="yocto" ZEPHYR_BASE=${ZEPHYR_BASE} SYSROOT=${STAGING_DIR_TARGET}" # We always need a toolchain to cross-compile. INHIBIT_DEFAULT_DEPS = "1"
@@ -28,3 +25,7 @@ python () { d.delVar('CXXFLAGS') d.delVar('LDFLAGS') } +OE_TERMINAL_EXPORTS += "CROSS_COMPILE" +OE_TERMINAL_EXPORTS += "BOARD" +OE_TERMINAL_EXPORTS += "ZEPHYR_SRC_DIR" +OE_TERMINAL_EXPORTS += "ZEPHYR_BASE"
recipes-kernel/zephyr-kernel/zephyr-philosophers.bb +5 -5
@@ -2,12 +2,12 @@ require zephyr-kernel.inc require zephyr-kernel-common.inc inherit deploy +ZEPHYR_SRC_DIR = "${S}/samples/philosophers" +ZEPHYR_BASE = "${S}" + do_compile () { - cd ${S} - export ZEPHYR_BASE=${S} - export ZEPHYR_GCC_VARIANT="yocto" - ${MAKE_COMMAND} -C samples/philosophers pristine - ${MAKE_COMMAND} -C samples/philosophers + cd ${ZEPHYR_SRC_DIR} + oe_runmake ${ZEPHYR_MAKE_ARGS} } do_deploy () {
recipes-zephyr/zephyr-getchar/zephyr-getchar_git.bb +5 -5
@@ -9,14 +9,14 @@ SRCREV="b8d511be4d2b9e05c6adb413a33d6ea510aa0c6a" SRC_URI = "git://github.com/pfalcon/zephyr_console_helpers.git;protocol=https" S = "${WORKDIR}/git/zephyr_getchar" +ZEPHYR_SRC_DIR = "${S}" +ZEPHYR_BASE="${STAGING_DIR_TARGET}/usr/src/zephyr" + DEPENDS += " zephyr-kernel-src" do_compile () { - cd ${S} - export ZEPHYR_GCC_VARIANT="yocto" - export CROSS_COMPILE=${CROSS_COMPILE} - export ZEPHYR_BASE=${STAGING_DIR_TARGET}/usr/src/zephyr - make -j V=1 BOARD=${BOARD} + cd ${ZEPHYR_SRC_DIR} + oe_runmake ${ZEPHYR_MAKE_ARGS} } do_deploy () {
Signature · 1 line
2.7.4
PATCH 5/5 meta-zephyr: newlib support
In reply to Juro BystrickyThis patch adds newlib libraries for cortex-m3, x86, IAMCU and ARC toolchains.
[YOCTO#10662]
--- conf/distro/zephyr.conf | 1 + recipes-core/newlib/newlib/assert-fiprintf.patch | 23 ++ .../newlib/newlib/gettimeofday-header-fix.patch | 20 ++ .../newlib/newlib/iamcu-commit-5d3ad3b.patch | 399 +++++++++++++++++++++ recipes-core/newlib/newlib_2.%.bb | 83 +++++ recipes-core/newlib/newlib_2.%.bbappend | 23 ++ recipes-devtools/gcc/libgcc_6.%.bbappend | 3 + .../zephyr-kernel/files/Makefile.toolchain.yocto | 19 +- .../zephyr-kernel/zephyr-kernel-common.inc | 10 +- 9 files changed, 574 insertions(+), 7 deletions(-) create mode 100644 recipes-core/newlib/newlib/assert-fiprintf.patch create mode 100644 recipes-core/newlib/newlib/gettimeofday-header-fix.patch create mode 100644 recipes-core/newlib/newlib/iamcu-commit-5d3ad3b.patch create mode 100644 recipes-core/newlib/newlib_2.%.bb create mode 100644 recipes-core/newlib/newlib_2.%.bbappend create mode 100644 recipes-devtools/gcc/libgcc_6.%.bbappend
conf/distro/zephyr.conf +1 -0
@@ -11,3 +11,4 @@ TCLIBCAPPEND = "" TEST_TARGET = "QemuTargetZephyr" TEST_SUITES = "zephyr" +TOOLCHAIN_TARGET_TASK += " newlib"
recipes-core/newlib/newlib/assert-fiprintf.patch new file +23 -0
@@ -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 <[email protected]> + +--- 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 : "");
recipes-core/newlib/newlib/gettimeofday-header-fix.patch new file +20 -0
@@ -0,0 +1,20 @@ + +newlib-2.4.0 regression. +Export the prototype of gettimeofday + +Signed-off-by: Juro Bystricky <[email protected]> + +--- 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]));
recipes-core/newlib/newlib/iamcu-commit-5d3ad3b.patch new file +399 -0
399 lines not on this page · raw message
recipes-core/newlib/newlib_2.%.bb new file +83 -0
83 lines not on this page · raw message
recipes-core/newlib/newlib_2.%.bbappend new file +23 -0
@@ -0,0 +1,23 @@ +######################################################################## +# +# 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" + +# ERROR: QA Issue: Architecture did not match (195 to 93) +INSANE_SKIP_${PN}_arc += " arch " + +
recipes-devtools/gcc/libgcc_6.%.bbappend new file +3 -0
@@ -0,0 +1,3 @@ +EXTRA_OECONF_remove = "--enable_multilib" +EXTRA_OECONF_append = " --disable-multilib" +
recipes-kernel/zephyr-kernel/files/Makefile.toolchain.yocto +14 -5
@@ -1,8 +1,17 @@ +$(info ZEPHYR_SYSROOT:${ZEPHYR_SYSROOT}) + +LIBGCC_DIR = $(shell dirname `$(CC) -print-libgcc-file-name`) +$(info LIBGCCDIR:${LIBGCC_DIR} ) + +#NEWLIB_DIR = $(shell `$(CC) -print-multi-directory`) +#$(info NEWLIB_DIR:${NEWLIB_DIR}) + +LIB_INCLUDE_DIR += -L $(LIBGCC_DIR) -L $(ZEPHYR_SYSROOT)/usr/lib/$(NEWLIB_DIR) +$(info LIB_INCLUDE_DIR:${LIB_INCLUDE_DIR}) + +TOOLCHAIN_CFLAGS = -I$(ZEPHYR_SYSROOT)/usr/include +$(info TOOLCHAIN_CFLAGS:${TOOLCHAIN_CFLAGS}) -LIBGCC_DIR = $(shell dirname `$(CC)gcc -print-libgcc-file-name`) -LIB_INCLUDE_DIR += -L $(LIBGCC_DIR) -#TOOLCHAIN_CFLAGS = -I $(SYSROOT)/usr/include TOOLCHAIN_LIBS = gcc -export LIB_INCLUDE_DIR CROSS_COMPILE TOOLCHAIN_LIBS -#export TOOLCHAIN_CFLAGS +export LIB_INCLUDE_DIR CROSS_COMPILE TOOLCHAIN_LIBS TOOLCHAIN_CFLAGS
recipes-kernel/zephyr-kernel/zephyr-kernel-common.inc +8 -2
@@ -6,11 +6,14 @@ inherit zephyr # filesystem. IMAGE_NO_MANIFEST = "1" -ZEPHYR_MAKE_ARGS = " V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE} ZEPHYR_GCC_VARIANT="yocto" ZEPHYR_BASE=${ZEPHYR_BASE} SYSROOT=${STAGING_DIR_TARGET}" +ZEPHYR_GCC_VARIANT="yocto" +ZEPHYR_SYSROOT="${STAGING_DIR_TARGET}" + +ZEPHYR_MAKE_ARGS = " V=1 BOARD=${BOARD} CROSS_COMPILE=${CROSS_COMPILE} ZEPHYR_GCC_VARIANT=${ZEPHYR_GCC_VARIANT} ZEPHYR_BASE=${ZEPHYR_BASE} ZEPHYR_SYSROOT=${ZEPHYR_SYSROOT}" # We always need a toolchain to cross-compile. INHIBIT_DEFAULT_DEPS = "1" -DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc" +DEPENDS += "gcc-cross-${TARGET_ARCH} libgcc ${TOOLCHAIN_TARGET_TASK}" CROSS_COMPILE = "${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}" do_configure[noexec] = "1"
@@ -25,7 +28,10 @@ python () { d.delVar('CXXFLAGS') d.delVar('LDFLAGS') } + OE_TERMINAL_EXPORTS += "CROSS_COMPILE" OE_TERMINAL_EXPORTS += "BOARD" OE_TERMINAL_EXPORTS += "ZEPHYR_SRC_DIR" OE_TERMINAL_EXPORTS += "ZEPHYR_BASE" +OE_TERMINAL_EXPORTS += "ZEPHYR_SYSROOT" +OE_TERMINAL_EXPORTS += "ZEPHYR_GCC_VARIANT"
Signature · 1 line
2.7.4