Skip to content

Commit e99ef81

Browse files
committed
nano_matter: add initial support for the Arduino Nano Matter
1 parent 8cbd9cf commit e99ef81

File tree

7 files changed

+179
-3
lines changed

7 files changed

+179
-3
lines changed

boards.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,67 @@ opta.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg
527527
opta.debug.cortex-debug.custom.request=attach
528528
opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd
529529

530+
##########################################################################################
531+
532+
nano_matter.name=Arduino Nano Matter
533+
nano_matter.build.core=arduino
534+
nano_matter.build.crossprefix=arm-zephyr-eabi-
535+
nano_matter.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/
536+
537+
nano_matter.menu.debug.false=Standard
538+
nano_matter.menu.debug.true=Debug
539+
nano_matter.menu.debug.true.build.zsk_args.debug=-debug
540+
541+
nano_matter.build.zephyr_target=arduino_nano_matter
542+
nano_matter.build.zephyr_args=
543+
nano_matter.build.zephyr_hals=hal_silabs
544+
nano_matter.build.variant=arduino_nano_matter_mgm240sd22vna
545+
nano_matter.build.mcu=cortex-m33
546+
nano_matter.build.fpu=-mfpu=fpv4-sp-d16
547+
nano_matter.build.architecture=cortex-m33
548+
549+
nano_matter.build.float-abi=-mfloat-abi=hard
550+
nano_matter.build.extra_flags=
551+
nano_matter.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
552+
nano_matter.build.architecture=cortex-m33
553+
nano_matter.build.board=ARDUINO_NANO_MATTER
554+
nano_matter.vid.0=0x2341
555+
nano_matter.pid.0=0x0072
556+
nano_matter.upload_port.0.vid=0x2341
557+
nano_matter.upload_port.0.pid=0x0072
558+
559+
nano_matter.upload.tool=sl_openocd
560+
nano_matter.upload.tool.default=sl_openocd
561+
nano_matter.upload.maximum_data_size=262144
562+
nano_matter.upload.maximum_size=1572864
563+
nano_matter.upload.address=0x080C4000
564+
nano_matter.upload.protocol=SWD
565+
nano_matter.upload.setup_command=
566+
nano_matter.upload.use_1200bps_touch=false
567+
nano_matter.upload.wait_for_upload_port=false
568+
nano_matter.upload.native_usb=false
569+
570+
nano_matter.bootloader.tool=sl_openocd
571+
nano_matter.bootloader.tool.default=sl_openocd
572+
nano_matter.bootloader.vid=0x2341
573+
nano_matter.bootloader.pid=0x0072
574+
nano_matter.bootloader.interface=0
575+
nano_matter.bootloader.file=zephyr-{build.variant}.hex
576+
nano_matter.bootloader.target=arduino_nano_matter
577+
578+
nano_matter.debug.server=openocd
579+
nano_matter.debug.server.openocd.scripts.0=interface/cmsis-dap.cfg
580+
nano_matter.debug.server.openocd.scripts.1=target/efm32s2_g23.cfg
581+
nano_matter.debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt
582+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.1=monitor reset_config srst_nogate
583+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_breakpoint_override hard
584+
nano_matter.debug.cortex-debug.custom.postAttachCommands.3=monitor gdb_sync
585+
nano_matter.debug.cortex-debug.custom.postAttachCommands.4=c
586+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
587+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
588+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.2=c
589+
nano_matter.debug.cortex-debug.custom.request=attach
590+
530591
##############################################################################################################
531592

532593
unoq.name=Arduino UNO Q

cores/arduino/threads.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,17 @@ void start_static_threads() {
1212
STRUCT_SECTION_FOREACH (_static_thread_data, thread_data)
1313

1414
_FOREACH_STATIC_THREAD(thread_data) {
15+
#ifdef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
16+
k_timeout_t init_delay = K_MSEC(thread_data->init_delay_ms);
17+
#else
18+
k_timeout_t init_delay = thread_data->init_delay;
19+
#endif
20+
1521
k_thread_create(thread_data->init_thread, thread_data->init_stack,
1622
thread_data->init_stack_size, thread_data->init_entry, thread_data->init_p1,
1723
thread_data->init_p2, thread_data->init_p3, thread_data->init_prio,
18-
thread_data->init_options, thread_data->init_delay);
24+
thread_data->init_options, init_delay);
25+
1926
k_thread_name_set(thread_data->init_thread, thread_data->init_name);
2027
thread_data->init_thread->init_data = thread_data;
2128
}

platform.txt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,30 @@ tools.openocd.bootloader.params.verbose=-d2
178178
tools.openocd.bootloader.params.quiet=-d0
179179
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"
180180

181+
182+
#
183+
# OpenOCD (Silabs)
184+
#
185+
tools.sl_openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}
186+
tools.sl_openocd.cmd={path}/bin/openocd
187+
188+
tools.sl_openocd.upload.params.verbose=-d2
189+
tools.sl_openocd.upload.params.quiet=-d0
190+
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"
191+
192+
tools.sl_openocd.program.params.verbose=-d2
193+
tools.sl_openocd.program.params.quiet=-d0
194+
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"
195+
196+
tools.sl_openocd.erase.params.verbose=-d2
197+
tools.sl_openocd.erase.params.quiet=-d0
198+
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"
199+
200+
tools.sl_openocd.bootloader.params.verbose=-d2
201+
tools.sl_openocd.bootloader.params.quiet=-d0
202+
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"
203+
204+
181205
#
182206
# BOSSA
183207
#
@@ -327,7 +351,7 @@ tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
327351
tools.gdb.cmd=arm-none-eabi-gdb
328352
tools.gdb.cmd.windows=arm-none-eabi-gdb.exe
329353

330-
debug.executable={build.path}/{build.project_name}.elf
354+
debug.executable={build.path}/{build.project_name}_debug.elf
331355
debug.toolchain=gcc
332356
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
333357
debug.toolchain.prefix=arm-none-eabi
@@ -342,3 +366,6 @@ debug.cortex-debug.custom.postAttachCommands.3=c
342366
debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
343367
debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
344368
debug.cortex-debug.custom.overrideRestartCommands.2=c
369+
370+
debug.server.openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}/bin/openocd
371+
debug.server.openocd.scripts_dir={runtime.tools.openocd-0.12.0-arduino1-static.path}/share/openocd/scripts/

programmers.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ jlink.program.protocol=
1414
jlink.program.tool=pyocd
1515
jlink.program.tool.default=pyocd
1616
jlink.program.extra_params=
17-
jlink.programmer.protocol=jlink
17+
jlink.programmer.protocol=jlink
18+
19+
openocd.name=OpenOCD
20+
openocd.protocol=SWD
21+
openocd.program.tool=openocd
22+
openocd.program.tool.default=openocd
23+
openocd.program.extra_params=
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME=n
2+
3+
CONFIG_MAIN_STACK_SIZE=32768
4+
CONFIG_HEAP_MEM_POOL_SIZE=32768
5+
6+
CONFIG_BT_RX_STACK_SIZE=4096
7+
CONFIG_BT_HCI_TX_STACK_SIZE=4096
8+
9+
CONFIG_FPU=y
10+
CONFIG_I2C=y
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
&flash0 {
2+
partitions {
3+
compatible = "fixed-partitions";
4+
#address-cells = <1>;
5+
#size-cells = <1>;
6+
7+
/* Arduino user sketch partition */
8+
user_sketch: partition@C4000 {
9+
reg = <0x000C4000 0x000B8000>;
10+
label = "user";
11+
};
12+
};
13+
};
14+
15+
/ {
16+
zephyr,user {
17+
digital-pin-gpios = <&gpioa 4 0>, /* D0 */
18+
<&gpioa 5 0>, /* D1 */
19+
<&gpioa 3 0>, /* D2 */
20+
<&gpioc 6 0>, /* D3 */
21+
<&gpioc 7 0>, /* D4 */
22+
<&gpioc 8 0>, /* D5 */
23+
<&gpioc 9 0>, /* D6 */
24+
<&gpiod 2 0>, /* D7 */
25+
<&gpiod 3 0>, /* D8 */
26+
<&gpiod 4 0>, /* D9 */
27+
<&gpiod 5 0>, /* D10 */
28+
<&gpioa 9 0>, /* D11 */
29+
<&gpioa 8 0>, /* D12 */
30+
<&gpiob 4 0>, /* D13 */
31+
<&gpiob 0 0>, /* A0 */
32+
<&gpiob 2 0>, /* A1 */
33+
<&gpiob 5 0>, /* A2 */
34+
<&gpioc 0 0>, /* A3 */
35+
<&gpioa 6 0>, /* A4 */
36+
<&gpioa 7 0>, /* A5 */
37+
<&gpiob 1 0>, /* A6 */
38+
<&gpiob 3 0>, /* A7 */
39+
<&gpioc 1 0>, /* 22 LED R */
40+
<&gpioc 2 0>, /* 23 LED G */
41+
<&gpioc 3 0>, /* 24 LED B */
42+
<&gpioa 0 0>, /* 25 Button */
43+
<&gpioc 4 0>, /* 26 Serial Tx */
44+
<&gpioc 5 0>; /* 27 Serial Rx */
45+
46+
builtin-led-gpios = <&gpioc 1 0>;
47+
serials = <&usart0>;
48+
i2cs = <&i2c0>;
49+
};
50+
};
51+
52+
&i2c0 {
53+
pinctrl-0 = <&i2c0_default>;
54+
pinctrl-names = "default";
55+
clock-frequency = <I2C_BITRATE_STANDARD>;
56+
status = "okay";
57+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
3+
#define MOSI 11
4+
#define MISO 12
5+
#define SCK 13
6+
#define SS 10
7+
#define SDA 4
8+
#define SCL 5

0 commit comments

Comments
 (0)