From fff3f9107655476d8afc7b13099fc9066d6d195f Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sun, 10 Nov 2024 08:03:22 -0600 Subject: [PATCH 1/4] zephyr: Change thread_analyze() to pass a cpu argument. Zephyr v4.0.0 changed thread analyzer functions to pass a cpu argument and allow thread analysis on each cpu separately. Promote this change to the MicroPython zephyr module. Signed-off-by: Maureen Helm --- docs/library/zephyr.rst | 5 +++-- ports/zephyr/modzephyr.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/library/zephyr.rst b/docs/library/zephyr.rst index 10676d9085289..2452d2fa25b23 100644 --- a/docs/library/zephyr.rst +++ b/docs/library/zephyr.rst @@ -22,9 +22,10 @@ Functions Returns the thread id of the current thread, which is used to reference the thread. -.. function:: thread_analyze() +.. function:: thread_analyze(cpu) - Runs the Zephyr debug thread analyzer on the current thread and prints stack size statistics in the format: + Runs the Zephyr debug thread analyzer on the current thread on the given cpu + and prints stack size statistics in the format: "``thread_name``-20s: STACK: unused ``available_stack_space`` usage ``stack_space_used`` / ``stack_size`` (``percent_stack_space_used`` %); CPU: ``cpu_utilization`` %" diff --git a/ports/zephyr/modzephyr.c b/ports/zephyr/modzephyr.c index c059c7e395796..95a8334f87e73 100644 --- a/ports/zephyr/modzephyr.c +++ b/ports/zephyr/modzephyr.c @@ -48,11 +48,12 @@ static mp_obj_t mod_current_tid(void) { static MP_DEFINE_CONST_FUN_OBJ_0(mod_current_tid_obj, mod_current_tid); #ifdef CONFIG_THREAD_ANALYZER -static mp_obj_t mod_thread_analyze(void) { - thread_analyzer_print(); +static mp_obj_t mod_thread_analyze(mp_obj_t cpu_in) { + unsigned int cpu = mp_obj_get_int(cpu_in); + thread_analyzer_print(cpu); return mp_const_none; } -static MP_DEFINE_CONST_FUN_OBJ_0(mod_thread_analyze_obj, mod_thread_analyze); +static MP_DEFINE_CONST_FUN_OBJ_1(mod_thread_analyze_obj, mod_thread_analyze); #endif #ifdef CONFIG_SHELL_BACKEND_SERIAL From 43799d3d840b797212ab492efd00478976ff868c Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Mon, 11 Nov 2024 20:50:05 -0600 Subject: [PATCH 2/4] zephyr: Remove CONFIG_SDMMC_VOLUME_NAME. Zephyr v4.0.0 removed CONFIG_SDMMC_VOLUME_NAME and set the disk name based on a devicetree property to allow multiple instances of the sdmmc_subsys disk driver to be registered. All in-tree zephyr definitions of the devicetree property are set to "SD", therefore we use this constant string when initializing the MicroPython VFS. Unfortunately I don't have hardware to verify that this change works correctly at runtime; I can only verify that it resolves a build error found when upgrading to MicroPython to Zephyr v4.0.0. Signed-off-by: Maureen Helm --- ports/zephyr/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/zephyr/main.c b/ports/zephyr/main.c index 9fae2b3a873e5..969b6c30c91c0 100644 --- a/ports/zephyr/main.c +++ b/ports/zephyr/main.c @@ -97,7 +97,7 @@ static void vfs_init(void) { int ret = 0; #ifdef CONFIG_DISK_DRIVER_SDMMC - mp_obj_t args[] = { mp_obj_new_str_from_cstr(CONFIG_SDMMC_VOLUME_NAME) }; + mp_obj_t args[] = { mp_obj_new_str_from_cstr("SD") }; bdev = MP_OBJ_TYPE_GET_SLOT(&zephyr_disk_access_type, make_new)(&zephyr_disk_access_type, ARRAY_SIZE(args), 0, args); mount_point_str = "/sd"; #elif defined(CONFIG_FLASH_MAP) && FIXED_PARTITION_EXISTS(storage_partition) From 8a1535bfa738bc487d8f3c865ca54a5178da8c63 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sun, 10 Nov 2024 08:24:02 -0600 Subject: [PATCH 3/4] tools/ci.sh: Upgrade Zephyr docker image 0.27.4 and SDK 0.17.0. Upgrades CI to use the latest versions of the Zephyr docker image and Zephyr SDK. Signed-off-by: Maureen Helm --- tools/ci.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ci.sh b/tools/ci.sh index 4e6f09b0bb853..c381da682a40e 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -747,8 +747,8 @@ function ci_windows_build { ######################################################################################## # ports/zephyr -ZEPHYR_DOCKER_VERSION=v0.26.13 -ZEPHYR_SDK_VERSION=0.16.8 +ZEPHYR_DOCKER_VERSION=v0.27.4 +ZEPHYR_SDK_VERSION=0.17.0 ZEPHYR_VERSION=v3.7.0 function ci_zephyr_setup { From 470dcb3592f27390d27718f5c727b73b3a2c8241 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Sun, 10 Nov 2024 08:29:30 -0600 Subject: [PATCH 4/4] zephyr: Upgrade to Zephyr v4.0.0. Updates the Zephyr port build instructions and CI to use the latest Zephyr release tag. Tested on max32690fthr and frdm_k64f. Signed-off-by: Maureen Helm --- docs/zephyr/tutorial/repl.rst | 2 +- ports/zephyr/README.md | 6 +++--- tools/ci.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/zephyr/tutorial/repl.rst b/docs/zephyr/tutorial/repl.rst index db7b7333d2416..199dda2b7aeee 100644 --- a/docs/zephyr/tutorial/repl.rst +++ b/docs/zephyr/tutorial/repl.rst @@ -31,7 +31,7 @@ With your serial program open (PuTTY, screen, picocom, etc) you may see a blank screen with a flashing cursor. Press Enter (or reset the board) and you should be presented with the following text:: - *** Booting Zephyr OS build v3.7.0 *** + *** Booting Zephyr OS build v4.0.0 *** MicroPython v1.24.0-preview.179.g5b85b24bd on 2024-08-05; zephyr-frdm_k64f with mk64f12 Type "help()" for more information. >>> diff --git a/ports/zephyr/README.md b/ports/zephyr/README.md index 4590eb7199c25..5cbeb09bf6ef2 100644 --- a/ports/zephyr/README.md +++ b/ports/zephyr/README.md @@ -4,7 +4,7 @@ MicroPython port to Zephyr RTOS This is a work-in-progress port of MicroPython to Zephyr RTOS (http://zephyrproject.org). -This port requires Zephyr version v3.7.0, and may also work on higher +This port requires Zephyr version v4.0.0, and may also work on higher versions. All boards supported by Zephyr (with standard level of features support, like UART console) should work with MicroPython (but not all were tested). @@ -39,13 +39,13 @@ setup is correct. If you already have Zephyr installed but are having issues building the MicroPython port then try installing the correct version of Zephyr via: - $ west init zephyrproject -m https://github.com/zephyrproject-rtos/zephyr --mr v3.7.0 + $ west init zephyrproject -m https://github.com/zephyrproject-rtos/zephyr --mr v4.0.0 Alternatively, you don't have to redo the Zephyr installation to just switch from master to a tagged release, you can instead do: $ cd zephyrproject/zephyr - $ git checkout v3.7.0 + $ git checkout v4.0.0 $ west update With Zephyr installed you may then need to configure your environment, diff --git a/tools/ci.sh b/tools/ci.sh index c381da682a40e..d42288f9a6eef 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -749,7 +749,7 @@ function ci_windows_build { ZEPHYR_DOCKER_VERSION=v0.27.4 ZEPHYR_SDK_VERSION=0.17.0 -ZEPHYR_VERSION=v3.7.0 +ZEPHYR_VERSION=v4.0.0 function ci_zephyr_setup { docker pull zephyrprojectrtos/ci:${ZEPHYR_DOCKER_VERSION} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy