From 44c50c07149335c028d98f4e4bb3acaa211ba4de Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 14:16:00 +0100 Subject: [PATCH 01/20] loader: redirect logs to uart In DEBUG mode if SHELL is disabled and board has a logging uart, loader will use it to print logs --- loader/main.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/loader/main.c b/loader/main.c index a77b1fd3..7388bda0 100644 --- a/loader/main.c +++ b/loader/main.c @@ -14,6 +14,7 @@ LOG_MODULE_REGISTER(sketch); #include #include #include +#include #include #include @@ -35,11 +36,11 @@ struct sketch_header_v1 { #define SKETCH_FLAG_LINKED 0x02 #define SKETCH_FLAG_IMMEDIATE 0x04 -#define TARGET_HAS_USB_CDC_SHELL \ - DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && CONFIG_SHELL && \ +#define TARGET_HAS_USB_CDC \ + DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && \ (CONFIG_USB_DEVICE_STACK || CONFIG_USB_DEVICE_STACK_NEXT) -#if TARGET_HAS_USB_CDC_SHELL +#if TARGET_HAS_USB_CDC const struct device *const usb_dev = DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), cdc_acm, 0)); @@ -63,6 +64,7 @@ int usb_enable(usb_dc_status_callback status_cb) { } #endif +#if CONFIG_SHELL static int enable_shell_usb(void) { bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0; uint32_t level = (CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ? @@ -75,6 +77,7 @@ static int enable_shell_usb(void) { return 0; } #endif +#endif #ifdef CONFIG_USERSPACE K_THREAD_STACK_DEFINE(llext_stack, CONFIG_MAIN_STACK_SIZE); @@ -198,8 +201,9 @@ static int loader(const struct shell *sh) { size_t sketch_buf_len = sketch_hdr->len; -#if TARGET_HAS_USB_CDC_SHELL +#if TARGET_HAS_USB_CDC int debug = (!sketch_valid) || (sketch_hdr->flags & SKETCH_FLAG_DEBUG); +#if CONFIG_SHELL if (debug && strcmp(k_thread_name_get(k_current_get()), "main") == 0) { // disables default shell on UART shell_uninit(shell_backend_uart_get_ptr(), NULL); @@ -214,6 +218,20 @@ static int loader(const struct shell *sh) { enable_shell_usb(); return 0; } +#elif CONFIG_LOG +#if !CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT + usb_enable(NULL); +#endif + for (int i = 0; i < log_backend_count_get(); i++) { + const struct log_backend *backend; + backend = log_backend_get(i); + log_backend_init(backend); + log_backend_enable(backend, backend->cb->ctx, CONFIG_LOG_DEFAULT_LEVEL); + if (!debug) { + break; + } + } +#endif #endif if (sketch_hdr->flags & SKETCH_FLAG_LINKED) { From 6efc26e0bb37734043768b1fdd5e06a424a0a81d Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 12:43:00 +0100 Subject: [PATCH 02/20] giga: relocate llext heap and main stack --- .../arduino_giga_r1_stm32h747xx_m7.conf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf index 29d512f8..70173685 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf @@ -11,10 +11,14 @@ CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_SHARED_MULTI_HEAP=y -CONFIG_HEAP_MEM_POOL_SIZE=24576 -CONFIG_SHELL_STACK_SIZE=32768 +CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 + +CONFIG_CODE_DATA_RELOCATION=y +CONFIG_MAIN_STACK_REGION="DTCM" +CONFIG_LLEXT_HEAP_REGION="SRAM2" CONFIG_CPP=n CONFIG_SHELL=n From e309ff0318b2089bc50a700fd7c7045e9b09e05d Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 11:55:35 +0100 Subject: [PATCH 03/20] giga: add log uart uart will be used by loader for logging when SHELL is not enabled --- .../arduino_giga_r1_stm32h747xx_m7.conf | 7 ++++++- .../arduino_giga_r1_stm32h747xx_m7.overlay | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf index 70173685..ab192dc0 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf @@ -3,9 +3,10 @@ CONFIG_USB_DEVICE_PRODUCT="Arduino GIGA R1" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0066 +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y @@ -23,6 +24,10 @@ CONFIG_LLEXT_HEAP_REGION="SRAM2" CONFIG_CPP=n CONFIG_SHELL=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BACKEND_UART_AUTOSTART=n +CONFIG_LOG_DEFAULT_LEVEL=2 + CONFIG_FPU=y CONFIG_ADC=y CONFIG_DAC=y diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay index 4d9269ca..6aba6b4b 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay @@ -320,9 +320,15 @@ /{ chosen { zephyr,camera = &dcmi; + zephyr,log-uart = &log_uarts; /* zephyr,console = &board_cdc_acm_uart; */ }; + log_uarts: log_uarts { + compatible = "zephyr,log-uart"; + uarts = <&usart1 &board_cdc_acm_uart>; + }; + /* used to overcome problems with _C analog pins */ gpioz: gpio@deadbeef { compatible = "vnd,gpio"; From b0cd5299109aab74219017b947ea1ae582cfded3 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 11:55:52 +0100 Subject: [PATCH 04/20] portentah7: add log uart uart will be used by loader for logging when SHELL is not enabled --- .../arduino_portenta_h7_stm32h747xx_m7.conf | 7 ++++++- .../arduino_portenta_h7_stm32h747xx_m7.overlay | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf index 4d5631b2..d515192d 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf @@ -3,9 +3,10 @@ CONFIG_USB_DEVICE_PRODUCT="Arduino Portenta H7" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x005b +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y @@ -17,6 +18,10 @@ CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_CPP=n CONFIG_SHELL=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BACKEND_UART_AUTOSTART=n +CONFIG_LOG_DEFAULT_LEVEL=2 + CONFIG_FPU=y CONFIG_ICACHE=y CONFIG_DCACHE=y diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay index f3f377b3..75782c44 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay @@ -248,6 +248,12 @@ zephyr,console = &usart6; zephyr,shell-uart = &usart6; zephyr,cdc-acm-uart0 = &usart6; + zephyr,log-uart = &log_uarts; + }; + + log_uarts: log_uarts { + compatible = "zephyr,log-uart"; + uarts = <&usart6 &board_cdc_acm_uart>; }; /* used to overcome problems with _C analog pins */ From b785726c4f75775de523ca7a0eaa4f3ff6cf7a6e Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 14:28:31 +0100 Subject: [PATCH 05/20] portentac33: add log uart uart will be used by loader for logging when SHELL is not enabled --- .../arduino_portenta_c33_r7fa6m5bh3cfc.conf | 9 ++++++--- .../arduino_portenta_c33_r7fa6m5bh3cfc.overlay | 11 +++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf index c79f252c..303cfae9 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf @@ -10,7 +10,6 @@ CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_SERIAL=y CONFIG_UART_LINE_CTRL=y CONFIG_USBD_CDC_ACM_CLASS=y -CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y CONFIG_USBD_LOG_LEVEL_ERR=y @@ -24,12 +23,16 @@ CONFIG_ARM_MPU=n CONFIG_CPP=n CONFIG_SHELL=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BACKEND_UART_AUTOSTART=n +CONFIG_LOG_DEFAULT_LEVEL=2 + CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_ISR_STACK_SIZE=8192 -CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=8192 -CONFIG_IDLE_STACK_SIZE=8192 +#CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=8192 +#CONFIG_IDLE_STACK_SIZE=8192 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192 CONFIG_ADC=y diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay index 6b5d5aef..26246342 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay @@ -5,6 +5,17 @@ }; }; +/{ + chosen { + zephyr,log-uart = &log_uarts; + }; + + log_uarts: log_uarts { + compatible = "zephyr,log-uart"; + uarts = <&uart9 &board_cdc_acm_uart>; + }; +}; + &flash0 { partitions { mcuboot: partition@0 { From 9e250d3b9ac6e6590f0c016d5cf6f462246dbc4d Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 16:08:49 +0100 Subject: [PATCH 06/20] opta: disable shell and cpp --- .../arduino_opta_stm32h747xx_m7.conf | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf index b23ca5cd..eada057d 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf @@ -12,12 +12,13 @@ CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=24576 -CONFIG_SHELL_STACK_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 -CONFIG_FPU=y +CONFIG_CPP=n +CONFIG_SHELL=n +CONFIG_FPU=y CONFIG_ADC=y CONFIG_DAC=n CONFIG_PWM=n @@ -45,13 +46,10 @@ CONFIG_SDHC_INIT_PRIORITY=75 CONFIG_SDIO_STACK=y CONFIG_CYW4343W=y CONFIG_WIFI=y -CONFIG_NET_L2_WIFI_SHELL=y CONFIG_AIROC_WIFI_CUSTOM=y CONFIG_STM32_MEMMAP=y -CONFIG_NET_CORE_LOG_LEVEL_DBG=y - CONFIG_NETWORKING=y CONFIG_NET_IPV6=n CONFIG_NET_IPV4=y @@ -87,7 +85,7 @@ CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT=y CONFIG_MBEDTLS_ENABLE_HEAP=y -CONFIG_MBEDTLS_HEAP_SIZE=60000 +CONFIG_MBEDTLS_HEAP_SIZE=80000 CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=7168 CONFIG_MBEDTLS_HASH_ALL_ENABLED=y CONFIG_MBEDTLS_CMAC=y From 81d8f7fb31e1e22d5d274f27b84075b9c231f8ef Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 16:10:41 +0100 Subject: [PATCH 07/20] opta: relocate llext heap and main stack --- .../arduino_opta_stm32h747xx_m7.conf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf index eada057d..d5ffaeb4 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf @@ -11,9 +11,14 @@ CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y CONFIG_LLEXT_STORAGE_WRITABLE=n -CONFIG_HEAP_MEM_POOL_SIZE=24576 +CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 + +CONFIG_CODE_DATA_RELOCATION=y +CONFIG_MAIN_STACK_REGION="DTCM" +CONFIG_LLEXT_HEAP_REGION="SRAM2" CONFIG_CPP=n CONFIG_SHELL=n From 98b9add3a9c47c77b60c3e3a9d8ec0f02cd8d5b7 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 2 Dec 2025 17:03:15 +0100 Subject: [PATCH 08/20] opta: add log uart uart will be used by loader for logging when SHELL is not enabled --- .../arduino_opta_stm32h747xx_m7.conf | 6 +++++- .../arduino_opta_stm32h747xx_m7.overlay | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf index d5ffaeb4..e52b427a 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf @@ -5,7 +5,7 @@ CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0064 CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y @@ -23,6 +23,10 @@ CONFIG_LLEXT_HEAP_REGION="SRAM2" CONFIG_CPP=n CONFIG_SHELL=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BACKEND_UART_AUTOSTART=n +CONFIG_LOG_DEFAULT_LEVEL=2 + CONFIG_FPU=y CONFIG_ADC=y CONFIG_DAC=n diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay index d018328e..2b8cef4c 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay @@ -40,6 +40,12 @@ zephyr,console = &usart6; zephyr,shell-uart = &usart6; zephyr,uart-mcumgr = &usart6; + zephyr,log-uart = &log_uarts; + }; + + log_uarts: log_uarts { + compatible = "zephyr,log-uart"; + uarts = <&usart6 &board_cdc_acm_uart>; }; /* used to overcome problems with _C analog pins */ From aff5bf85912fb1cf8204e72adcb8090598a8db18 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 15 Dec 2025 22:40:00 +0100 Subject: [PATCH 09/20] nano33ble: disable shell and cpp --- .../arduino_nano_33_ble_nrf52840_sense.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf index 1b7191ca..a93637af 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf @@ -23,11 +23,13 @@ CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y +CONFIG_CPP=n +CONFIG_SHELL=n + CONFIG_ADC=y CONFIG_PWM=y CONFIG_LLEXT_STORAGE_WRITABLE=n -CONFIG_SHELL_STACK_SIZE=2048 CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_MAIN_STACK_SIZE=16384 From 5a4543ca441424d5baf1b9c5baf76c70d2035932 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 15 Dec 2025 22:41:11 +0100 Subject: [PATCH 10/20] nano33ble: add log uart uart will be used by loader for logging when SHELL is not enabled --- .../arduino_nano_33_ble_nrf52840_sense.conf | 6 +++++- .../arduino_nano_33_ble_nrf52840_sense.overlay | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf index a93637af..cf4c5da6 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf @@ -19,13 +19,17 @@ CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x035A CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y CONFIG_CPP=n CONFIG_SHELL=n +CONFIG_LOG_BACKEND_UART=y +CONFIG_LOG_BACKEND_UART_AUTOSTART=n +CONFIG_LOG_DEFAULT_LEVEL=2 + CONFIG_ADC=y CONFIG_PWM=y diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay index ee99b269..beb71483 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay @@ -42,6 +42,17 @@ }; }; +/{ + chosen { + zephyr,log-uart = &log_uarts; + }; + + log_uarts: log_uarts { + compatible = "zephyr,log-uart"; + uarts = <&uart0 &board_cdc_acm_uart>; + }; +}; + / { zephyr,user { From 263e03565489f85f92c7e3a151b336aac43e5695 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 15 Dec 2025 22:41:49 +0100 Subject: [PATCH 11/20] nano33ble: autosize malloc arena --- .../arduino_nano_33_ble_nrf52840_sense.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf index cf4c5da6..9775847d 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf @@ -37,6 +37,7 @@ CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_MAIN_STACK_SIZE=16384 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_FPU=y From a43c29b0c4214a8a9d497f1182c404ded8ed7f99 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 10:43:07 +0100 Subject: [PATCH 12/20] nicla sense: disable shell and cpp --- .../arduino_nicla_sense_me_nrf52832.conf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf index 8fb871e5..63b7acf5 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf @@ -9,21 +9,23 @@ CONFIG_BT_BUF_EVT_DISCARDABLE_SIZE=255 CONFIG_BT_MAX_CONN=4 CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y - -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 +CONFIG_BT_RX_STACK_SIZE=1024 +CONFIG_BT_HCI_TX_STACK_SIZE=1024 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 + +CONFIG_CPP=n +CONFIG_SHELL=n + CONFIG_ADC=y #CONFIG_PWM=y CONFIG_LLEXT_STORAGE_WRITABLE=n -CONFIG_SHELL_STACK_SIZE=1024 CONFIG_HEAP_MEM_POOL_SIZE=1024 CONFIG_LLEXT_HEAP_SIZE=15 CONFIG_MAIN_STACK_SIZE=2048 - -CONFIG_BT_RX_STACK_SIZE=1024 -CONFIG_BT_HCI_TX_STACK_SIZE=1024 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 From 88833165e7bb689936e7a562a07c4c7b9d03658d Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 13:57:36 +0100 Subject: [PATCH 13/20] unoq: disable shell and cpp --- .../arduino_uno_q_stm32u585xx.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index 52da466e..cac73d77 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -1,8 +1,10 @@ CONFIG_LLEXT_STORAGE_WRITABLE=n -CONFIG_HEAP_MEM_POOL_SIZE=131072 -CONFIG_SHELL_STACK_SIZE=32768 -CONFIG_MAIN_STACK_SIZE=32768 +CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 + +CONFIG_CPP=n +CONFIG_SHELL=n CONFIG_FPU=y @@ -28,7 +30,6 @@ CONFIG_TEST_RANDOM_GENERATOR=y CONFIG_LOG_MODE_IMMEDIATE=n CONFIG_COUNTER=y -CONFIG_COUNTER_SHELL=y CONFIG_DEBUG_THREAD_INFO=y From 914e0084855833584a5d1f1b7a202bbbe699c509 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 13:58:19 +0100 Subject: [PATCH 14/20] unoq: restore immediate log mode --- .../arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index cac73d77..b680b990 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -27,8 +27,6 @@ CONFIG_ARM_MPU=n CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y -CONFIG_LOG_MODE_IMMEDIATE=n - CONFIG_COUNTER=y CONFIG_DEBUG_THREAD_INFO=y From f8a70d615667e8e7f03fc8da607c7b47bafc5f8d Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 13:59:01 +0100 Subject: [PATCH 15/20] unoq: remove unused config --- .../arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index b680b990..670bab41 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -31,7 +31,6 @@ CONFIG_COUNTER=y CONFIG_DEBUG_THREAD_INFO=y -CONFIG_MAX_THREAD_BYTES=6 CONFIG_DYNAMIC_THREAD=y CONFIG_DYNAMIC_THREAD_POOL_SIZE=2 CONFIG_DYNAMIC_THREAD_ALLOC=y From 9b4eb6efd20f03e3fb5423a910bf4beaf1c8c972 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 14:00:05 +0100 Subject: [PATCH 16/20] prj: make sure DYNAMIC_THREAD is enabled also with SHELL disabled --- loader/prj.conf | 3 +++ .../arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/loader/prj.conf b/loader/prj.conf index e5aaf7f4..055a60e7 100644 --- a/loader/prj.conf +++ b/loader/prj.conf @@ -52,3 +52,6 @@ CONFIG_INPUT_THREAD_PRIORITY_OVERRIDE=y CONFIG_INPUT_THREAD_PRIORITY=0 CONFIG_EVENTS=y +CONFIG_THREAD_STACK_INFO=y +CONFIG_DYNAMIC_THREAD=y +CONFIG_DYNAMIC_THREAD_ALLOC=y diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index 670bab41..354e5a46 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -31,9 +31,7 @@ CONFIG_COUNTER=y CONFIG_DEBUG_THREAD_INFO=y -CONFIG_DYNAMIC_THREAD=y CONFIG_DYNAMIC_THREAD_POOL_SIZE=2 -CONFIG_DYNAMIC_THREAD_ALLOC=y CONFIG_MAIN_THREAD_PRIORITY=5 From 3d4aab2a9d890851d0259b04259a4fe4921ed3d6 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 16:59:14 +0100 Subject: [PATCH 17/20] prj: disable SHELL and CPP for alla variants --- loader/prj.conf | 9 --------- .../arduino_giga_r1_stm32h747xx_m7.conf | 3 --- .../arduino_nano_33_ble_nrf52840_sense.conf | 3 --- .../arduino_nicla_sense_me_nrf52832.conf | 3 --- .../arduino_opta_stm32h747xx_m7.conf | 3 --- .../arduino_portenta_c33_r7fa6m5bh3cfc.conf | 3 --- .../arduino_portenta_h7_stm32h747xx_m7.conf | 3 --- .../arduino_uno_q_stm32u585xx.conf | 3 --- 8 files changed, 30 deletions(-) diff --git a/loader/prj.conf b/loader/prj.conf index 055a60e7..d0ee6c5b 100644 --- a/loader/prj.conf +++ b/loader/prj.conf @@ -13,15 +13,9 @@ CONFIG_MAIN_STACK_SIZE=32768 CONFIG_ARDUINO_API=y -CONFIG_SHELL=y -CONFIG_SHELL_STACK_SIZE=2048 -CONFIG_SHELL_CMD_BUFF_SIZE=2048 -CONFIG_SHELL_LOG_LEVEL_DBG=n - CONFIG_LLEXT=y CONFIG_LLEXT_LOG_LEVEL_ERR=y CONFIG_LLEXT_HEAP_SIZE=32 -CONFIG_LLEXT_SHELL=y CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_LLEXT_EXPORT_DEVICES=y @@ -41,9 +35,6 @@ CONFIG_UART_CONSOLE=y CONFIG_FLASH=y CONFIG_FLASH_MAP=y -CONFIG_CPP=y -CONFIG_STD_CPP17=y -CONFIG_GLIBCXX_LIBCPP=y CONFIG_REQUIRES_FULL_LIBC=y CONFIG_CBPRINTF_FP_SUPPORT=y diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf index ab192dc0..635490f9 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf @@ -21,9 +21,6 @@ CONFIG_CODE_DATA_RELOCATION=y CONFIG_MAIN_STACK_REGION="DTCM" CONFIG_LLEXT_HEAP_REGION="SRAM2" -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n CONFIG_LOG_DEFAULT_LEVEL=2 diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf index 9775847d..ea265a89 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf @@ -23,9 +23,6 @@ CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 CONFIG_UART_LINE_CTRL=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n CONFIG_LOG_DEFAULT_LEVEL=2 diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf index 63b7acf5..4388a81e 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf @@ -18,9 +18,6 @@ CONFIG_BT_BUF_CMD_TX_COUNT=10 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_ADC=y #CONFIG_PWM=y diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf index e52b427a..0f28cc3d 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf @@ -20,9 +20,6 @@ CONFIG_CODE_DATA_RELOCATION=y CONFIG_MAIN_STACK_REGION="DTCM" CONFIG_LLEXT_HEAP_REGION="SRAM2" -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n CONFIG_LOG_DEFAULT_LEVEL=2 diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf index 303cfae9..aa26f4aa 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf @@ -20,9 +20,6 @@ CONFIG_FPU=y CONFIG_USERSPACE=n CONFIG_ARM_MPU=n -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n CONFIG_LOG_DEFAULT_LEVEL=2 diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf index d515192d..f657c10e 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf @@ -15,9 +15,6 @@ CONFIG_SHARED_MULTI_HEAP=y CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n CONFIG_LOG_DEFAULT_LEVEL=2 diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index 354e5a46..1d6cbef9 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -3,9 +3,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 -CONFIG_CPP=n -CONFIG_SHELL=n - CONFIG_FPU=y CONFIG_ADC=y From 1dab3fbfff42b465494562a3a25b697407d6d299 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 16 Dec 2025 17:18:29 +0100 Subject: [PATCH 18/20] nano matter: disable CONFIG_DYNAMIC_THREAD and CONFIG_DYNAMIC_THREAD_ALLOC --- .../arduino_nano_matter_mgm240sd22vna.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf index 0abcbedd..2009182f 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -31,6 +31,8 @@ CONFIG_STACK_SENTINEL=n CONFIG_INIT_STACKS=n CONFIG_THREAD_NAME=n CONFIG_THREAD_STACK_INFO=n +CONFIG_DYNAMIC_THREAD=n +CONFIG_DYNAMIC_THREAD_ALLOC=n CONFIG_STACK_CANARIES=n CONFIG_THREAD_ANALYZER=n CONFIG_SYS_HEAP_RUNTIME_STATS=n From a369847c10d7949da0592ec9dd4857643b141358 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 17 Dec 2025 11:10:56 +0100 Subject: [PATCH 19/20] loader: do not initialize two times usb log_backend_init already initializes usb cdc_acm peripheral --- loader/main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/loader/main.c b/loader/main.c index 7388bda0..45a25c55 100644 --- a/loader/main.c +++ b/loader/main.c @@ -219,9 +219,6 @@ static int loader(const struct shell *sh) { return 0; } #elif CONFIG_LOG -#if !CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT - usb_enable(NULL); -#endif for (int i = 0; i < log_backend_count_get(); i++) { const struct log_backend *backend; backend = log_backend_get(i); From 2e913a71c06edcf9bab0285fc241534cb913ceaf Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 17 Dec 2025 11:38:02 +0100 Subject: [PATCH 20/20] c33: remove commented out configs --- .../arduino_portenta_c33_r7fa6m5bh3cfc.conf | 2 -- 1 file changed, 2 deletions(-) diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf index aa26f4aa..39767125 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf @@ -28,8 +28,6 @@ CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_ISR_STACK_SIZE=8192 -#CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=8192 -#CONFIG_IDLE_STACK_SIZE=8192 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192 CONFIG_ADC=y