Skip to content

Commit 0dcd8e2

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

File tree

8 files changed

+166
-7
lines changed

8 files changed

+166
-7
lines changed

boards.txt

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,69 @@ 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=openocd
560+
nano_matter.upload.tool.default=openocd
561+
nano_matter.upload.config=-f target/efm32s2_g23.cfg
562+
nano_matter.upload.programmer=-f interface/cmsis-dap.cfg
563+
nano_matter.upload.maximum_data_size=262144
564+
nano_matter.upload.maximum_size=1572864
565+
nano_matter.upload.address=0x080C4000
566+
nano_matter.upload.protocol=SWD
567+
nano_matter.upload.setup_command=
568+
nano_matter.upload.use_1200bps_touch=false
569+
nano_matter.upload.wait_for_upload_port=false
570+
nano_matter.upload.native_usb=false
571+
572+
nano_matter.bootloader.tool=openocd
573+
nano_matter.bootloader.tool.default=openocd
574+
nano_matter.bootloader.vid=0x2341
575+
nano_matter.bootloader.pid=0x0072
576+
nano_matter.bootloader.interface=0
577+
nano_matter.bootloader.file=zephyr-{build.variant}.hex
578+
nano_matter.bootloader.target=arduino_nano_matter
579+
580+
nano_matter.debug.server=openocd
581+
nano_matter.debug.server.openocd.scripts.0=interface/cmsis-dap.cfg
582+
nano_matter.debug.server.openocd.scripts.1=target/efm32s2_g23.cfg
583+
nano_matter.debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt
584+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.1=monitor reset_config srst_nogate
585+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_breakpoint_override hard
586+
nano_matter.debug.cortex-debug.custom.postAttachCommands.3=monitor gdb_sync
587+
nano_matter.debug.cortex-debug.custom.postAttachCommands.4=c
588+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
589+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
590+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.2=c
591+
nano_matter.debug.cortex-debug.custom.request=attach
592+
530593
##############################################################################################################
531594

532595
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
}

extra/artifacts/_common.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
"packager": "arduino",
4747
"name": "remoteocd",
4848
"version": "0.0.4-rc.4"
49+
},
50+
{
51+
"packager": "SiliconLabs",
52+
"name": "openocd",
53+
"version": "0.12.0-arduino1-static"
4954
}
5055
]
5156
}

platform.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,25 @@ pluggable_monitor.required.serial=builtin:serial-monitor
158158
#
159159
# OpenOCD
160160
#
161-
tools.openocd.path={runtime.tools.openocd-0.11.0-arduino2.path}
161+
tools.openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}
162162
tools.openocd.cmd=bin/openocd
163163
tools.openocd.cmd.windows=bin/openocd.exe
164164

165165
tools.openocd.upload.params.verbose=-d2
166166
tools.openocd.upload.params.quiet=-d0
167-
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" {bootloader.programmer} {upload.transport} {bootloader.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; program {{build.path}/{build.project_name}.elf}; reset run; shutdown"
167+
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" {upload.programmer} {upload.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset run; shutdown"
168168

169169
tools.openocd.program.params.verbose=-d2
170170
tools.openocd.program.params.quiet=-d0
171-
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" {bootloader.programmer} {upload.transport} {bootloader.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; program {{build.path}/{build.project_name}.elf}; reset run; shutdown"
171+
tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" {upload.programmer} {upload.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset run; shutdown"
172172

173173
tools.openocd.erase.params.verbose=-d2
174174
tools.openocd.erase.params.quiet=-d0
175175
tools.openocd.erase.pattern=
176176

177177
tools.openocd.bootloader.params.verbose=-d2
178178
tools.openocd.bootloader.params.quiet=-d0
179-
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"
179+
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" {upload.programmer} {upload.config} -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; program {{runtime.platform.path}/firmwares/{bootloader.file}}; reset run; shutdown"
180180

181181
#
182182
# BOSSA
@@ -327,7 +327,7 @@ tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
327327
tools.gdb.cmd=arm-none-eabi-gdb
328328
tools.gdb.cmd.windows=arm-none-eabi-gdb.exe
329329

330-
debug.executable={build.path}/{build.project_name}.elf
330+
debug.executable={build.path}/{build.project_name}_debug.elf
331331
debug.toolchain=gcc
332332
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
333333
debug.toolchain.prefix=arm-none-eabi
@@ -342,3 +342,6 @@ debug.cortex-debug.custom.postAttachCommands.3=c
342342
debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
343343
debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
344344
debug.cortex-debug.custom.overrideRestartCommands.2=c
345+
346+
debug.server.openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}/bin/openocd
347+
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)