Skip to content
Snippets Groups Projects
Commit 758d12ab authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

zephyr-kernel: add support for zephyr v3.1.0


This adds support for zephyr v3.1.0. It's not a backport from upstream
as meta-zephyr master branch build is still broken as of writing this.

There are several incompatible changes between v3.0 and v3.1 that require
us to use separate patches for the ACM console. Other patches needed
to be moved around between version too - when we drop v2.7 and v3.0, it
will become much cleaner.

On the flip side: lvgl is now upstream so v3.1 doesn't need the lvgl
backports. On the flip flip side we need special handling of the DSHIELD
option for lvgl as long as we support both v3 versions.

Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@huawei.com>
parent f987d74c
No related branches found
No related tags found
1 merge request!15zephyr-kernel: add support for zephyr v3.1.0
Pipeline #6742 passed with warnings
From e201097658f65fc636887bcc1cfa7d458d90cb10 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
Date: Tue, 19 Jul 2022 14:50:24 +0200
Subject: [PATCH] zephyr 3.1.0: console: enable the USB ACM0 console
This is a forward port of the ACM0 console patch for zephyr v3.1.0.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@huawei.com>
---
boards/arm/arduino_nano_33_ble/CMakeLists.txt | 2 +-
.../arduino_nano_33_ble-common.dtsi | 7 ++++-
.../arduino_nano_33_ble_defconfig | 5 ++++
boards/arm/arduino_nano_33_ble/board.c | 26 +++++++++++++++++++
subsys/shell/backends/shell_uart.c | 2 +-
5 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/boards/arm/arduino_nano_33_ble/CMakeLists.txt b/boards/arm/arduino_nano_33_ble/CMakeLists.txt
index b4fe264e0e..011d33b267 100644
--- a/boards/arm/arduino_nano_33_ble/CMakeLists.txt
+++ b/boards/arm/arduino_nano_33_ble/CMakeLists.txt
@@ -2,4 +2,4 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
-zephyr_library_sources(board.c)
+zephyr_library_sources(board.c )
diff --git a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi
index 7c39c42bac..d31945d50e 100644
--- a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi
+++ b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble-common.dtsi
@@ -6,7 +6,6 @@
/ {
chosen {
- zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-mcumgr = &uart0;
zephyr,bt-mon-uart = &uart0;
@@ -14,6 +13,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &code_partition;
+ zephyr,console = &cdc_acm_uart0;
};
leds {
@@ -209,4 +209,9 @@ arduino_spi: &spi2 {
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
+
+ cdc_acm_uart0: cdc_acm_uart0 {
+ compatible = "zephyr,cdc-acm-uart";
+ label = "CDC_ACM_0";
+ };
};
diff --git a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig
index 2d91725aaf..b1f90c3148 100644
--- a/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig
+++ b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig
@@ -24,3 +24,8 @@ CONFIG_BOOTLOADER_BOSSA_LEGACY=y
CONFIG_GPIO_AS_PINRESET=y
CONFIG_PINCTRL=y
+
+CONFIG_USB_DEVICE_STACK=y
+CONFIG_USB_DEVICE_PRODUCT="Zephyr USB console sample"
+
+CONFIG_UART_LINE_CTRL=y
diff --git a/boards/arm/arduino_nano_33_ble/board.c b/boards/arm/arduino_nano_33_ble/board.c
index b79033c362..f687b87d50 100644
--- a/boards/arm/arduino_nano_33_ble/board.c
+++ b/boards/arm/arduino_nano_33_ble/board.c
@@ -6,6 +6,8 @@
#include <zephyr/init.h>
#include <zephyr/drivers/gpio.h>
+#include <usb/usb_device.h>
+#include <drivers/uart.h>
static int board_init(const struct device *dev)
{
@@ -22,3 +24,27 @@ static int board_init(const struct device *dev)
}
SYS_INIT(board_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
+
+BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_CHOSEN(zephyr_console), zephyr_cdc_acm_uart),
+ "Console device is not ACM CDC UART device");
+
+static int board_internal_usb_cdc_acm_init(const struct device *unused)
+{
+ ARG_UNUSED(unused);
+ const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
+ uint32_t dtr = 0;
+
+ if (usb_enable(NULL)) {
+ return -ENODEV;
+ }
+
+ /* Poll if the DTR flag was set */
+ while (!dtr) {
+ uart_line_ctrl_get(dev, UART_LINE_CTRL_DTR, &dtr);
+ /* Give CPU resources to low priority threads. */
+ k_sleep(K_MSEC(100));
+ }
+
+ return 0;
+}
+SYS_INIT(board_internal_usb_cdc_acm_init, APPLICATION, 99);
diff --git a/subsys/shell/backends/shell_uart.c b/subsys/shell/backends/shell_uart.c
index b30e163dc3..a9af34bde1 100644
--- a/subsys/shell/backends/shell_uart.c
+++ b/subsys/shell/backends/shell_uart.c
@@ -335,7 +335,7 @@ static int enable_shell_uart(const struct device *arg)
return 0;
}
-SYS_INIT(enable_shell_uart, POST_KERNEL,
+SYS_INIT(enable_shell_uart, APPLICATION,
CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY);
const struct shell *shell_backend_uart_get_ptr(void)
--
2.34.1
From 4f48eac03ac25a66af25d72e7b88f04d3ddd770d Mon Sep 17 00:00:00 2001 From 168eab56fc9645406728b04654ed57121fa62f54 Mon Sep 17 00:00:00 2001
From: Chase Qi <chase.qi@linaro.org> From: Chase Qi <chase.qi@linaro.org>
Date: Mon, 9 May 2022 18:31:19 +0800 Date: Fri, 22 Jul 2022 17:10:47 +0200
Subject: [PATCH 2/2] twister: set toolchain to ZEPHYR_GCC_VARIANT Subject: [PATCH] v3.1.0: twister: set toolchain to ZEPHYR_GCC_VARIANT
Set toolchain to ZEPHYR_GCC_VARIANT. Defaults to 'yocto'. Set toolchain to ZEPHYR_GCC_VARIANT. Defaults to 'yocto'.
Upstream status: inappropriate [OE specific]
Signed-off-by: Chase Qi <chase.qi@linaro.org> Signed-off-by: Chase Qi <chase.qi@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
--- ---
scripts/pylib/twister/twisterlib.py | 2 ++ scripts/pylib/twister/twisterlib.py | 2 ++
1 file changed, 2 insertions(+) 1 file changed, 2 insertions(+)
diff --git a/scripts/pylib/twister/twisterlib.py b/scripts/pylib/twister/twisterlib.py diff --git a/scripts/pylib/twister/twisterlib.py b/scripts/pylib/twister/twisterlib.py
index e8c342df91..d54d13fdc0 100755 index 34d14ce84d..0549584b21 100755
--- a/scripts/pylib/twister/twisterlib.py --- a/scripts/pylib/twister/twisterlib.py
+++ b/scripts/pylib/twister/twisterlib.py +++ b/scripts/pylib/twister/twisterlib.py
@@ -3042,6 +3042,8 @@ class TestSuite(DisablePyTestCollectionMixin): @@ -3339,6 +3339,8 @@ class TestPlan(DisablePyTestCollectionMixin):
@staticmethod @staticmethod
def get_toolchain(): def get_toolchain():
+ return os.getenv("ZEPHYR_GCC_VARIANT", "yocto") + return os.getenv("ZEPHYR_GCC_VARIANT", "yocto")
+ +
toolchain_script = Path(ZEPHYR_BASE) / Path('cmake/verify-toolchain.cmake') toolchain_script = Path(ZEPHYR_BASE) / Path('cmake/modules/verify-toolchain.cmake')
result = CMake.run_cmake_script([toolchain_script, "FORMAT=json"]) result = CMake.run_cmake_script([toolchain_script, "FORMAT=json"])
-- --
2.25.1 2.34.1
...@@ -6,6 +6,9 @@ SRC_URI += " \ ...@@ -6,6 +6,9 @@ SRC_URI += " \
git://github.com/zephyrproject-rtos/mcumgr.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/mcumgr;name=mcumgr \ git://github.com/zephyrproject-rtos/mcumgr.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/mcumgr;name=mcumgr \
git://github.com/zephyrproject-rtos/TraceRecorderSource.git;protocol=https;nobranch=1;destsuffix=git/modules/debug/TraceRecorder;name=TraceRecorder \ git://github.com/zephyrproject-rtos/TraceRecorderSource.git;protocol=https;nobranch=1;destsuffix=git/modules/debug/TraceRecorder;name=TraceRecorder \
git://github.com/zephyrproject-rtos/trusted-firmware-m.git;protocol=https;nobranch=1;destsuffix=git/modules/tee/tfm;name=tfm \ git://github.com/zephyrproject-rtos/trusted-firmware-m.git;protocol=https;nobranch=1;destsuffix=git/modules/tee/tfm;name=tfm \
git://github.com/zephyrproject-rtos/hal_cypress.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/cypress;name=cypress \
file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
${@bb.utils.contains("ONIRO_ENABLE_ACM0", "1", "", "file://0001-console-enable-the-USB-ACM0-console-by-default.patch", d)} \
" "
# #
......
...@@ -70,6 +70,9 @@ ZEPHYR_BRANCH = "v3.0-branch" ...@@ -70,6 +70,9 @@ ZEPHYR_BRANCH = "v3.0-branch"
PV = "3.0.0+git${SRCPV}" PV = "3.0.0+git${SRCPV}"
SRC_URI += " \ SRC_URI += " \
git://github.com/zephyrproject-rtos/hal_cypress.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/cypress;name=cypress \
file://0001-lvgl-add-support-for-lvgl-v8.2.0.patch \ file://0001-lvgl-add-support-for-lvgl-v8.2.0.patch \
file://0001-boards-arm-arduino_nano_33_ble-add-support-for-the-a.patch \ file://0001-boards-arm-arduino_nano_33_ble-add-support-for-the-a.patch \
file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
${@bb.utils.contains("ONIRO_ENABLE_ACM0", "1", "", "file://0001-console-enable-the-USB-ACM0-console-by-default.patch", d)} \
" "
SRCREV_FORMAT = "default_cmsis"
#
# Generated with:
#
# #!/usr/bin/python3
#
# import yaml
# import sys
#
# if __name__ == "__main__":
# with open(sys.argv[1], "r") as fd:
# data = yaml.safe_load(fd)
#
# for project in data["manifest"]["projects"]:
# print("SRCREV_{} = \"{}\"".format(project["name"], project["revision"]))
#
SRCREV_default = "2ddd73feafd3316af2c547c34d6969bea637d5c6"
SRCREV_canopennode = "53d3415c14d60f8f4bfca54bfbc5d5a667d7e724"
SRCREV_chre = "0edfe2c2ec656afb910cfab8ed59a5ffd59b87c8"
SRCREV_civetweb = "094aeb41bb93e9199d24d665ee43e9e05d6d7b1c"
SRCREV_cmsis = "5f86244bad4ad5a590e084f0e72ba7a1416c2edf"
SRCREV_edtt = "1ea61a390d2bfcf3b2ecdba8f8b0b98dfdffbd11"
SRCREV_fatfs = "a30531af3a95a9a3ea7d771ea8a578ebfed45514"
SRCREV_fff = "6ce5ba26486e93d5b7696a3e23f0585932c14b16"
SRCREV_altera = "0d225ddd314379b32355a00fb669eacf911e750d"
SRCREV_atmel = "78c5567c05b6b434dd7d98f49156319df4217bac"
SRCREV_espressif = "df85671c5d0405c0747c2939c8dfe808b7e4cf38"
SRCREV_gigadevice = "63a72ca90b7e0d7257211ddc5c79e8c0b940371b"
SRCREV_infineon = "4af06965f57ba1e7d170e6a97d24c33785543a8c"
SRCREV_microchip = "5d079f1683a00b801373bbbbf5d181d4e33b30d5"
SRCREV_nordic = "a85bb3676d61d1ae202088e0d3fec556056b2c9e"
SRCREV_nuvoton = "b4d31f33238713a568e23618845702fadd67386f"
SRCREV_nxp = "2302a1e94f5bc00ce59db4e249b688ad2e959f58"
SRCREV_openisa = "40d049f69c50b58ea20473bee14cf93f518bf262"
SRCREV_quicklogic = "b3a66fe6d04d87fd1533a5c8de51d0599fcd08d0"
SRCREV_rpi_pico = "191f5ba46fda49523cdaaef27583d1c875ba2c36"
SRCREV_silabs = "be39d4eebeddac6e18e9c0c3ba1b31ad1e82eaed"
SRCREV_st = "52a522ca4a8a9ec1e9bb5bb514e1ab6f102863fe"
SRCREV_stm32 = "51b373cd3455b8c2b9babbf6ff41918116a442ac"
SRCREV_telink = "ffcfd6282aa213f1dc0848dbca6279b098f6b143"
SRCREV_ti = "905a5d4134899630071f9383aadaaf266e8f8cd2"
SRCREV_xtensa = "0e577021bb66e644afd067cd9f7c71ab11b62b3d"
SRCREV_libmetal = "850a3c3fd5bc655987021dc9106d8e8cd0f7e061"
SRCREV_liblc3codec = "3951cf1b71ff3be086c9b9b595e473e12301337c"
SRCREV_littlefs = "652f2c5646e79b881e6f3099686ad3b7af9e216c"
SRCREV_loramac-node = "12019623bbad9eb54fe51066847a7cbd4b4eac57"
SRCREV_lvgl = "df717ac87a9fd80246cc8df24554475e59bda21f"
SRCREV_lz4 = "8e303c264fc21c2116dc612658003a22e933124d"
SRCREV_mbedtls = "7fed49c9b9f983ad6416986661ef637459723bcb"
SRCREV_mcuboot = "e58ea98aec6e5539c5f872a98059e461d0155bbb"
SRCREV_mipi-sys-t = "a5163c1800a5243f8b05d84c942da008df4cb666"
SRCREV_nanopb = "d148bd26718e4c10414f07a7eb1bd24c62e56c5d"
SRCREV_net-tools = "f49bd1354616fae4093bf36e5eaee43c51a55127"
SRCREV_nrf_hw_models = "b8cea37dbdc8fc58cc14b4e19fa850877a9da520"
SRCREV_open-amp = "8d53544871e1f300c478224faca6be8384ab0d04"
SRCREV_openthread = "e2a765599aa0379d0f72f0149a9cbafec070c12d"
SRCREV_segger = "3a52ab222133193802d3c3b4d21730b9b1f1d2f6"
SRCREV_sof = "2efc3ea41c0074c6dab5f376fafaa26f52c25c75"
SRCREV_tflite-micro = "9156d050927012da87079064db59d07f03b8baf6"
SRCREV_tinycbor = "9e1f34bc08123aaad7666d3652aaa839e8178b3b"
SRCREV_tinycrypt = "3e9a49d2672ec01435ffbf0d788db6d95ef28de0"
SRCREV_TraceRecorderSource = "e8ca3b6a83d19b2fc4738a0d9607190436e5e452"
SRCREV_trusted-firmware-m = "7c53a6e76130a85303f83b15d868a92fdcd5f5be"
SRCREV_tf-m-tests = "c99a86b295c4887520da9d8402566d7f225c974e"
SRCREV_psa-arch-tests = "a81f9da287569f169d60026916952641b233faa8"
SRCREV_zcbor = "882c489a7d9fdfff31d27666914a78a9eb6976d7"
SRCREV_zscilib = "fc979a8dcb74169c69b02835927bff8f070d6325"
ZEPHYR_BRANCH = "v3.1-branch"
PV = "3.1.0+git${SRCPV}"
SRC_URI += " \
${@bb.utils.contains("ONIRO_ENABLE_ACM0", "1", "file://0001-zephyr-3.1.0-console-enable-the-USB-ACM0-console.patch", "", d)} \
"
...@@ -19,7 +19,6 @@ SRC_URI = "\ ...@@ -19,7 +19,6 @@ SRC_URI = "\
git://github.com/zephyrproject-rtos/fatfs.git;protocol=https;nobranch=1;destsuffix=git/modules/fs/fatfs;name=fatfs \ git://github.com/zephyrproject-rtos/fatfs.git;protocol=https;nobranch=1;destsuffix=git/modules/fs/fatfs;name=fatfs \
git://github.com/zephyrproject-rtos/hal_altera.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/altera;name=altera \ git://github.com/zephyrproject-rtos/hal_altera.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/altera;name=altera \
git://github.com/zephyrproject-rtos/hal_atmel.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/atmel;name=atmel \ git://github.com/zephyrproject-rtos/hal_atmel.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/atmel;name=atmel \
git://github.com/zephyrproject-rtos/hal_cypress.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/cypress;name=cypress \
git://github.com/zephyrproject-rtos/hal_espressif.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/espressif;name=espressif \ git://github.com/zephyrproject-rtos/hal_espressif.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/espressif;name=espressif \
git://github.com/zephyrproject-rtos/hal_infineon.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/infineon;name=infineon \ git://github.com/zephyrproject-rtos/hal_infineon.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/infineon;name=infineon \
git://github.com/zephyrproject-rtos/hal_microchip.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/microchip;name=microchip \ git://github.com/zephyrproject-rtos/hal_microchip.git;protocol=https;nobranch=1;destsuffix=git/modules/hal/microchip;name=microchip \
...@@ -53,11 +52,9 @@ SRC_URI = "\ ...@@ -53,11 +52,9 @@ SRC_URI = "\
git://github.com/zephyrproject-rtos/lz4.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/lz4;name=lz4 \ git://github.com/zephyrproject-rtos/lz4.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/lz4;name=lz4 \
git://github.com/zephyrproject-rtos/tflite-micro.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/tflite-micro;name=tflite-micro \ git://github.com/zephyrproject-rtos/tflite-micro.git;protocol=https;nobranch=1;destsuffix=git/modules/lib/tflite-micro;name=tflite-micro \
file://0001-cmake-add-yocto-toolchain.patch \ file://0001-cmake-add-yocto-toolchain.patch \
file://0001-x86-fix-efi-binary-generation-issue-in-cross-compila.patch \
${@bb.utils.contains("ONIRO_ENABLE_ACM0", "1", "file://0001-console-enable-the-USB-ACM0-console-by-default.patch", "", d)} \
" "
S = "${WORKDIR}/git" S = "${WORKDIR}/git"
# Default to a stable version # Default to a stable version
PREFERRED_VERSION_zephyr-kernel ??= "3.0.0" PREFERRED_VERSION_zephyr-kernel ??= "3.1.0"
include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc include zephyr-kernel-src-${PREFERRED_VERSION_zephyr-kernel}.inc
...@@ -2,7 +2,16 @@ include zephyr-sample.inc ...@@ -2,7 +2,16 @@ include zephyr-sample.inc
ZEPHYR_SRC_DIR = "${S}/samples/subsys/display/lvgl" ZEPHYR_SRC_DIR = "${S}/samples/subsys/display/lvgl"
# TODO Once more machines and displays are supported, add a PACKAGECONFIG. python __anonymous() {
EXTRA_OECMAKE:append =" -DSHIELD=adafruit_2_8_tft_touch_v2" pver = d.getVar("PREFERRED_VERSION_zephyr-kernel")
shield = None
if pver == "3.1.0":
shield = " -DSHIELD=adafruit_2_8_tft_touch_v2_nano"
else:
shield = " -DSHIELD=adafruit_2_8_tft_touch_v2"
d.setVar("EXTRA_OECMAKE:append", shield)
}
COMPATIBLE_MACHINE = "(nrf52840dk-nrf52840|arduino-nano-33-ble)" COMPATIBLE_MACHINE = "(nrf52840dk-nrf52840|arduino-nano-33-ble)"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment