From e99ef81cf57646547b0bcdf59c4522351bc250bb Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Mon, 1 Sep 2025 10:37:09 +0200 Subject: [PATCH 1/6] nano_matter: add initial support for the Arduino Nano Matter --- boards.txt | 61 +++++++++++++++++++ cores/arduino/threads.cpp | 9 ++- platform.txt | 29 ++++++++- programmers.txt | 8 ++- .../arduino_nano_matter_mgm240sd22vna.conf | 10 +++ .../arduino_nano_matter_mgm240sd22vna.overlay | 57 +++++++++++++++++ .../variant.h | 8 +++ 7 files changed, 179 insertions(+), 3 deletions(-) create mode 100644 variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf create mode 100644 variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay create mode 100644 variants/arduino_nano_matter_mgm240sd22vna/variant.h diff --git a/boards.txt b/boards.txt index b85a2ffa4..547a7e71c 100644 --- a/boards.txt +++ b/boards.txt @@ -527,6 +527,67 @@ opta.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg opta.debug.cortex-debug.custom.request=attach opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd +########################################################################################## + +nano_matter.name=Arduino Nano Matter +nano_matter.build.core=arduino +nano_matter.build.crossprefix=arm-zephyr-eabi- +nano_matter.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ + +nano_matter.menu.debug.false=Standard +nano_matter.menu.debug.true=Debug +nano_matter.menu.debug.true.build.zsk_args.debug=-debug + +nano_matter.build.zephyr_target=arduino_nano_matter +nano_matter.build.zephyr_args= +nano_matter.build.zephyr_hals=hal_silabs +nano_matter.build.variant=arduino_nano_matter_mgm240sd22vna +nano_matter.build.mcu=cortex-m33 +nano_matter.build.fpu=-mfpu=fpv4-sp-d16 +nano_matter.build.architecture=cortex-m33 + +nano_matter.build.float-abi=-mfloat-abi=hard +nano_matter.build.extra_flags= +nano_matter.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit +nano_matter.build.architecture=cortex-m33 +nano_matter.build.board=ARDUINO_NANO_MATTER +nano_matter.vid.0=0x2341 +nano_matter.pid.0=0x0072 +nano_matter.upload_port.0.vid=0x2341 +nano_matter.upload_port.0.pid=0x0072 + +nano_matter.upload.tool=sl_openocd +nano_matter.upload.tool.default=sl_openocd +nano_matter.upload.maximum_data_size=262144 +nano_matter.upload.maximum_size=1572864 +nano_matter.upload.address=0x080C4000 +nano_matter.upload.protocol=SWD +nano_matter.upload.setup_command= +nano_matter.upload.use_1200bps_touch=false +nano_matter.upload.wait_for_upload_port=false +nano_matter.upload.native_usb=false + +nano_matter.bootloader.tool=sl_openocd +nano_matter.bootloader.tool.default=sl_openocd +nano_matter.bootloader.vid=0x2341 +nano_matter.bootloader.pid=0x0072 +nano_matter.bootloader.interface=0 +nano_matter.bootloader.file=zephyr-{build.variant}.hex +nano_matter.bootloader.target=arduino_nano_matter + +nano_matter.debug.server=openocd +nano_matter.debug.server.openocd.scripts.0=interface/cmsis-dap.cfg +nano_matter.debug.server.openocd.scripts.1=target/efm32s2_g23.cfg +nano_matter.debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt +#nano_matter.debug.cortex-debug.custom.postAttachCommands.1=monitor reset_config srst_nogate +#nano_matter.debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_breakpoint_override hard +nano_matter.debug.cortex-debug.custom.postAttachCommands.3=monitor gdb_sync +nano_matter.debug.cortex-debug.custom.postAttachCommands.4=c +nano_matter.debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt +nano_matter.debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync +nano_matter.debug.cortex-debug.custom.overrideRestartCommands.2=c +nano_matter.debug.cortex-debug.custom.request=attach + ############################################################################################################## unoq.name=Arduino UNO Q diff --git a/cores/arduino/threads.cpp b/cores/arduino/threads.cpp index 5a4e7a9b7..cf0d73767 100644 --- a/cores/arduino/threads.cpp +++ b/cores/arduino/threads.cpp @@ -12,10 +12,17 @@ void start_static_threads() { STRUCT_SECTION_FOREACH (_static_thread_data, thread_data) _FOREACH_STATIC_THREAD(thread_data) { +#ifdef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME + k_timeout_t init_delay = K_MSEC(thread_data->init_delay_ms); +#else + k_timeout_t init_delay = thread_data->init_delay; +#endif + k_thread_create(thread_data->init_thread, thread_data->init_stack, thread_data->init_stack_size, thread_data->init_entry, thread_data->init_p1, thread_data->init_p2, thread_data->init_p3, thread_data->init_prio, - thread_data->init_options, thread_data->init_delay); + thread_data->init_options, init_delay); + k_thread_name_set(thread_data->init_thread, thread_data->init_name); thread_data->init_thread->init_data = thread_data; } diff --git a/platform.txt b/platform.txt index f88550ff6..b9c369227 100644 --- a/platform.txt +++ b/platform.txt @@ -178,6 +178,30 @@ tools.openocd.bootloader.params.verbose=-d2 tools.openocd.bootloader.params.quiet=-d0 tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" {bootloader.programmer} {upload.transport} {bootloader.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; {bootloader.extra_action.preflash}; program {{runtime.platform.path}/bootloaders/{bootloader.file}}; reset run; shutdown" + +# +# OpenOCD (Silabs) +# +tools.sl_openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path} +tools.sl_openocd.cmd={path}/bin/openocd + +tools.sl_openocd.upload.params.verbose=-d2 +tools.sl_openocd.upload.params.quiet=-d0 +tools.sl_openocd.upload.pattern="{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.elf-zsk.bin} {upload.address} bin; reset; exit" + +tools.sl_openocd.program.params.verbose=-d2 +tools.sl_openocd.program.params.quiet=-d0 +tools.sl_openocd.program.pattern="{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.elf-zsk.bin} {upload.address} bin; reset; exit" + +tools.sl_openocd.erase.params.verbose=-d2 +tools.sl_openocd.erase.params.quiet=-d0 +tools.sl_openocd.erase.pattern="{cmd}" {erase.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash erase_sector 0 1 last; exit" + +tools.sl_openocd.bootloader.params.verbose=-d2 +tools.sl_openocd.bootloader.params.quiet=-d0 +tools.sl_openocd.bootloader.pattern="{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; program {{runtime.platform.path}/firmwares/{bootloader.file}}; reset; exit" + + # # BOSSA # @@ -327,7 +351,7 @@ tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ tools.gdb.cmd=arm-none-eabi-gdb tools.gdb.cmd.windows=arm-none-eabi-gdb.exe -debug.executable={build.path}/{build.project_name}.elf +debug.executable={build.path}/{build.project_name}_debug.elf debug.toolchain=gcc debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ debug.toolchain.prefix=arm-none-eabi @@ -342,3 +366,6 @@ debug.cortex-debug.custom.postAttachCommands.3=c debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync debug.cortex-debug.custom.overrideRestartCommands.2=c + +debug.server.openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}/bin/openocd +debug.server.openocd.scripts_dir={runtime.tools.openocd-0.12.0-arduino1-static.path}/share/openocd/scripts/ diff --git a/programmers.txt b/programmers.txt index b0df70934..576c82ab9 100644 --- a/programmers.txt +++ b/programmers.txt @@ -14,4 +14,10 @@ jlink.program.protocol= jlink.program.tool=pyocd jlink.program.tool.default=pyocd jlink.program.extra_params= -jlink.programmer.protocol=jlink \ No newline at end of file +jlink.programmer.protocol=jlink + +openocd.name=OpenOCD +openocd.protocol=SWD +openocd.program.tool=openocd +openocd.program.tool.default=openocd +openocd.program.extra_params= diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf new file mode 100644 index 000000000..4bc9b91bd --- /dev/null +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -0,0 +1,10 @@ +CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME=n + +CONFIG_MAIN_STACK_SIZE=32768 +CONFIG_HEAP_MEM_POOL_SIZE=32768 + +CONFIG_BT_RX_STACK_SIZE=4096 +CONFIG_BT_HCI_TX_STACK_SIZE=4096 + +CONFIG_FPU=y +CONFIG_I2C=y diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay new file mode 100644 index 000000000..3c9c224a5 --- /dev/null +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay @@ -0,0 +1,57 @@ +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* Arduino user sketch partition */ + user_sketch: partition@C4000 { + reg = <0x000C4000 0x000B8000>; + label = "user"; + }; + }; +}; + +/ { + zephyr,user { + digital-pin-gpios = <&gpioa 4 0>, /* D0 */ + <&gpioa 5 0>, /* D1 */ + <&gpioa 3 0>, /* D2 */ + <&gpioc 6 0>, /* D3 */ + <&gpioc 7 0>, /* D4 */ + <&gpioc 8 0>, /* D5 */ + <&gpioc 9 0>, /* D6 */ + <&gpiod 2 0>, /* D7 */ + <&gpiod 3 0>, /* D8 */ + <&gpiod 4 0>, /* D9 */ + <&gpiod 5 0>, /* D10 */ + <&gpioa 9 0>, /* D11 */ + <&gpioa 8 0>, /* D12 */ + <&gpiob 4 0>, /* D13 */ + <&gpiob 0 0>, /* A0 */ + <&gpiob 2 0>, /* A1 */ + <&gpiob 5 0>, /* A2 */ + <&gpioc 0 0>, /* A3 */ + <&gpioa 6 0>, /* A4 */ + <&gpioa 7 0>, /* A5 */ + <&gpiob 1 0>, /* A6 */ + <&gpiob 3 0>, /* A7 */ + <&gpioc 1 0>, /* 22 LED R */ + <&gpioc 2 0>, /* 23 LED G */ + <&gpioc 3 0>, /* 24 LED B */ + <&gpioa 0 0>, /* 25 Button */ + <&gpioc 4 0>, /* 26 Serial Tx */ + <&gpioc 5 0>; /* 27 Serial Rx */ + + builtin-led-gpios = <&gpioc 1 0>; + serials = <&usart0>; + i2cs = <&i2c0>; + }; +}; + +&i2c0 { + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; + clock-frequency = ; + status = "okay"; +}; diff --git a/variants/arduino_nano_matter_mgm240sd22vna/variant.h b/variants/arduino_nano_matter_mgm240sd22vna/variant.h new file mode 100644 index 000000000..46d78cd0a --- /dev/null +++ b/variants/arduino_nano_matter_mgm240sd22vna/variant.h @@ -0,0 +1,8 @@ +#pragma once + +#define MOSI 11 +#define MISO 12 +#define SCK 13 +#define SS 10 +#define SDA 4 +#define SCL 5 From 8ceb687e5491d184951ecfd388456f2574b30b33 Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Wed, 22 Oct 2025 00:05:28 +0200 Subject: [PATCH 2/6] nano_matter: add PWM support --- .../arduino_nano_matter_mgm240sd22vna.conf | 1 + .../arduino_nano_matter_mgm240sd22vna.overlay | 32 +++++++++++++++++++ .../variant.h | 7 ++++ 3 files changed, 40 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 4bc9b91bd..8c2403d53 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -8,3 +8,4 @@ CONFIG_BT_HCI_TX_STACK_SIZE=4096 CONFIG_FPU=y CONFIG_I2C=y +CONFIG_PWM=y diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay index 3c9c224a5..2aed50d06 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay @@ -43,6 +43,18 @@ <&gpioc 4 0>, /* 26 Serial Tx */ <&gpioc 5 0>; /* 27 Serial Rx */ + builtin-led-gpios = <&gpioc 1 GPIO_ACTIVE_LOW>, /* 22 LED R */ + <&gpioc 2 GPIO_ACTIVE_LOW>, /* 23 LED G */ + <&gpioc 3 GPIO_ACTIVE_LOW>; /* 24 LED B */ + + pwm-pin-gpios = <&gpiob 0 0>, /* A0 */ + <&gpiob 2 0>, /* A1 */ + <&gpiob 5 0>; /* A2 */ + + pwms = <&timer0_pwm 0 255 PWM_POLARITY_INVERTED>, + <&timer0_pwm 1 255 PWM_POLARITY_INVERTED>, + <&timer0_pwm 2 255 PWM_POLARITY_INVERTED>; + builtin-led-gpios = <&gpioc 1 0>; serials = <&usart0>; i2cs = <&i2c0>; @@ -55,3 +67,23 @@ clock-frequency = ; status = "okay"; }; + +&timer0 { + status = "okay"; + + timer0_pwm: pwm { + pinctrl-0 = <&timer0_default>; + pinctrl-names = "default"; + status = "okay"; + }; +}; + +&pinctrl { + timer0_default: timer0_default { + group0 { + pins = , , ; + drive-push-pull; + output-high; + }; + }; +}; diff --git a/variants/arduino_nano_matter_mgm240sd22vna/variant.h b/variants/arduino_nano_matter_mgm240sd22vna/variant.h index 46d78cd0a..473b0108f 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/variant.h +++ b/variants/arduino_nano_matter_mgm240sd22vna/variant.h @@ -6,3 +6,10 @@ #define SS 10 #define SDA 4 #define SCL 5 + +#define LED_BUILTIN_1 23 +#define LED_BUILTIN_2 24 +#define LED_BUILTIN_ACTIVE (LOW) +#define LED_BUILTIN_INACTIVE (!LED_BUILTIN_ACTIVE) + +#define BTN_BUILTIN 25 From 4f973f0b35596ffc93380a78362812ddde07b50c Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Mon, 27 Oct 2025 13:04:30 +0100 Subject: [PATCH 3/6] nano_matter: add SPI support --- .../arduino_nano_matter_mgm240sd22vna.conf | 1 + .../arduino_nano_matter_mgm240sd22vna.overlay | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) 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 8c2403d53..bae202838 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -8,4 +8,5 @@ CONFIG_BT_HCI_TX_STACK_SIZE=4096 CONFIG_FPU=y CONFIG_I2C=y +CONFIG_SPI=y CONFIG_PWM=y diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay index 2aed50d06..e223abd2d 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay @@ -55,9 +55,9 @@ <&timer0_pwm 1 255 PWM_POLARITY_INVERTED>, <&timer0_pwm 2 255 PWM_POLARITY_INVERTED>; - builtin-led-gpios = <&gpioc 1 0>; serials = <&usart0>; i2cs = <&i2c0>; + spis = <&eusart1>; }; }; @@ -68,6 +68,34 @@ status = "okay"; }; +&pinctrl { + eusart1_default: eusart1_default { + group0 { + pins = , ; + drive-push-pull; + output-high; + }; + + group1 { + pins = ; + input-enable; + silabs,input-filter; + }; + }; +}; + +&eusart1 { + compatible = "silabs,eusart-spi"; + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <4000000>; + pinctrl-0 = <&eusart1_default>; + pinctrl-names = "default"; + status = "okay"; + + cs-gpios = <&gpiod 5 GPIO_ACTIVE_LOW>; +}; + &timer0 { status = "okay"; From 1bc966b7733c017121d41717d20e68e390c0e08b Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Tue, 28 Oct 2025 17:18:45 +0100 Subject: [PATCH 4/6] nano_matter: add static linking support --- boards.txt | 5 +++++ platform.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/boards.txt b/boards.txt index 547a7e71c..72cfed50b 100644 --- a/boards.txt +++ b/boards.txt @@ -538,6 +538,11 @@ nano_matter.menu.debug.false=Standard nano_matter.menu.debug.true=Debug nano_matter.menu.debug.true.build.zsk_args.debug=-debug +nano_matter.menu.link_mode.dynamic=Dynamic +nano_matter.menu.link_mode.static=Static +nano_matter.menu.link_mode.static.build.link_mode=static +nano_matter.menu.link_mode.static.upload.extension=bin-zsk.bin + nano_matter.build.zephyr_target=arduino_nano_matter nano_matter.build.zephyr_args= nano_matter.build.zephyr_hals=hal_silabs diff --git a/platform.txt b/platform.txt index b9c369227..db1d2bcef 100644 --- a/platform.txt +++ b/platform.txt @@ -187,11 +187,11 @@ tools.sl_openocd.cmd={path}/bin/openocd tools.sl_openocd.upload.params.verbose=-d2 tools.sl_openocd.upload.params.quiet=-d0 -tools.sl_openocd.upload.pattern="{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.elf-zsk.bin} {upload.address} bin; reset; exit" +tools.sl_openocd.upload.pattern="{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset; exit" tools.sl_openocd.program.params.verbose=-d2 tools.sl_openocd.program.params.quiet=-d0 -tools.sl_openocd.program.pattern="{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.elf-zsk.bin} {upload.address} bin; reset; exit" +tools.sl_openocd.program.pattern="{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f interface/cmsis-dap.cfg -f target/efm32s2_g23.cfg -c "init; reset_config srst_nogate; reset halt; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset; exit" tools.sl_openocd.erase.params.verbose=-d2 tools.sl_openocd.erase.params.quiet=-d0 From 2c385dd2f0642b4b2c0a9bafa84601471a8a4881 Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Thu, 30 Oct 2025 16:32:25 +0100 Subject: [PATCH 5/6] nano_matter: add ArduinoBLE support --- .../arduino_nano_matter_mgm240sd22vna.conf | 39 +++++++++++++++---- .../arduino_nano_matter_mgm240sd22vna.overlay | 4 ++ 2 files changed, 36 insertions(+), 7 deletions(-) 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 bae202838..0abcbeddb 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -1,12 +1,37 @@ -CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME=n - -CONFIG_MAIN_STACK_SIZE=32768 -CONFIG_HEAP_MEM_POOL_SIZE=32768 - -CONFIG_BT_RX_STACK_SIZE=4096 -CONFIG_BT_HCI_TX_STACK_SIZE=4096 +CONFIG_MAIN_STACK_SIZE=16000 +CONFIG_HEAP_MEM_POOL_SIZE=112000 +CONFIG_LLEXT_HEAP_SIZE=64 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_FPU=y CONFIG_I2C=y CONFIG_SPI=y CONFIG_PWM=y + +CONFIG_BT=y +CONFIG_BT_HCI=y +CONFIG_BT_HCI_RAW=y +CONFIG_BT_HCI_RAW_CMD_EXT=y +CONFIG_BT_MAX_CONN=4 +CONFIG_BT_SILABS_EFR32_HCI_VS=y +CONFIG_BT_SILABS_EFR32_LINK_LAYER_STACK_SIZE=4096 +CONFIG_BT_CTLR_PRIVACY=n +CONFIG_BT_RX_STACK_SIZE=4096 +CONFIG_BT_HCI_TX_STACK_SIZE=1024 + +CONFIG_MBEDTLS=y +CONFIG_TLS_CREDENTIALS=y +CONFIG_CURRENT_THREAD_USE_TLS=n +CONFIG_NETWORKING=y + +CONFIG_ASSERT=y +CONFIG_STACK_USAGE=n +CONFIG_STACK_SENTINEL=n +CONFIG_INIT_STACKS=n +CONFIG_THREAD_NAME=n +CONFIG_THREAD_STACK_INFO=n +CONFIG_STACK_CANARIES=n +CONFIG_THREAD_ANALYZER=n +CONFIG_SYS_HEAP_RUNTIME_STATS=n +# CONFIG_LOG_DEFAULT_LEVEL=3 diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay index e223abd2d..9f83fb7ed 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay @@ -115,3 +115,7 @@ }; }; }; + +&sysrtc0 { + status = "okay"; +}; From e3362971654e001381c5e1905bc11e8e92dd1975 Mon Sep 17 00:00:00 2001 From: Tamas Jozsi Date: Mon, 10 Nov 2025 17:48:22 +0100 Subject: [PATCH 6/6] loader: return if sketch_buf could not be allocated Without the return statement on alloc failure 'flash_area_read' gets an uninitialized pointer. --- loader/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/loader/main.c b/loader/main.c index defcfddca..a77b1fd3e 100644 --- a/loader/main.c +++ b/loader/main.c @@ -244,6 +244,7 @@ static int loader(const struct shell *sh) { if (!sketch_buf) { printk("Unable to allocate %d bytes\n", sketch_buf_len); + return -ENOMEM; } rc = flash_area_read(fa, 0, sketch_buf, sketch_buf_len);