Skip to content

Commit ebc3c75

Browse files
authored
Merge pull request #255 from silabs-bozont/main
board: add support for the Arduino Nano Matter
2 parents 456d829 + dfaf05b commit ebc3c75

File tree

9 files changed

+271
-7
lines changed

9 files changed

+271
-7
lines changed

boards.txt

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,74 @@ opta.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg
568568
opta.debug.cortex-debug.custom.request=attach
569569
opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd
570570

571+
##########################################################################################
572+
573+
nano_matter.name=Arduino Nano Matter
574+
nano_matter.build.core=arduino
575+
nano_matter.build.crossprefix=arm-zephyr-eabi-
576+
nano_matter.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/
577+
578+
nano_matter.menu.debug.false=Standard
579+
nano_matter.menu.debug.true=Debug
580+
nano_matter.menu.debug.true.build.zsk_args.debug=-debug
581+
582+
nano_matter.menu.link_mode.dynamic=Dynamic
583+
nano_matter.menu.link_mode.static=Static
584+
nano_matter.menu.link_mode.static.build.link_mode=static
585+
nano_matter.menu.link_mode.static.upload.extension=bin-zsk.bin
586+
587+
nano_matter.build.zephyr_target=arduino_nano_matter
588+
nano_matter.build.zephyr_args=
589+
nano_matter.build.zephyr_hals=hal_silabs
590+
nano_matter.build.variant=arduino_nano_matter_mgm240sd22vna
591+
nano_matter.build.mcu=cortex-m33
592+
nano_matter.build.fpu=-mfpu=fpv4-sp-d16
593+
nano_matter.build.architecture=cortex-m33
594+
595+
nano_matter.build.float-abi=-mfloat-abi=hard
596+
nano_matter.build.extra_flags=
597+
nano_matter.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
598+
nano_matter.build.architecture=cortex-m33
599+
nano_matter.build.board=ARDUINO_NANO_MATTER
600+
nano_matter.vid.0=0x2341
601+
nano_matter.pid.0=0x0072
602+
nano_matter.upload_port.0.vid=0x2341
603+
nano_matter.upload_port.0.pid=0x0072
604+
605+
nano_matter.upload.tool=openocd
606+
nano_matter.upload.tool.default=openocd
607+
nano_matter.upload.config=-f target/efm32s2_g23.cfg
608+
nano_matter.upload.programmer=-f interface/cmsis-dap.cfg
609+
nano_matter.upload.maximum_data_size=262144
610+
nano_matter.upload.maximum_size=1572864
611+
nano_matter.upload.address=0x080C4000
612+
nano_matter.upload.protocol=SWD
613+
nano_matter.upload.setup_command=
614+
nano_matter.upload.use_1200bps_touch=false
615+
nano_matter.upload.wait_for_upload_port=false
616+
nano_matter.upload.native_usb=false
617+
618+
nano_matter.bootloader.tool=openocd
619+
nano_matter.bootloader.tool.default=openocd
620+
nano_matter.bootloader.vid=0x2341
621+
nano_matter.bootloader.pid=0x0072
622+
nano_matter.bootloader.interface=0
623+
nano_matter.bootloader.file=zephyr-{build.variant}.hex
624+
nano_matter.bootloader.target=arduino_nano_matter
625+
626+
nano_matter.debug.server=openocd
627+
nano_matter.debug.server.openocd.scripts.0=interface/cmsis-dap.cfg
628+
nano_matter.debug.server.openocd.scripts.1=target/efm32s2_g23.cfg
629+
nano_matter.debug.cortex-debug.custom.postAttachCommands.0=monitor reset halt
630+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.1=monitor reset_config srst_nogate
631+
#nano_matter.debug.cortex-debug.custom.postAttachCommands.2=monitor gdb_breakpoint_override hard
632+
nano_matter.debug.cortex-debug.custom.postAttachCommands.3=monitor gdb_sync
633+
nano_matter.debug.cortex-debug.custom.postAttachCommands.4=c
634+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
635+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
636+
nano_matter.debug.cortex-debug.custom.overrideRestartCommands.2=c
637+
nano_matter.debug.cortex-debug.custom.request=attach
638+
571639
##############################################################################################################
572640

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

loader/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static int loader(const struct shell *sh) {
244244

245245
if (!sketch_buf) {
246246
printk("Unable to allocate %d bytes\n", sketch_buf_len);
247+
return -ENOMEM;
247248
}
248249

249250
rc = flash_area_read(fa, 0, sketch_buf, sketch_buf_len);

platform.txt

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

168168
tools.openocd.upload.params.verbose=-d2
169169
tools.openocd.upload.params.quiet=-d0
170-
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"
170+
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"
171171

172172
tools.openocd.program.params.verbose=-d2
173173
tools.openocd.program.params.quiet=-d0
174-
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"
174+
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"
175175

176176
tools.openocd.erase.params.verbose=-d2
177177
tools.openocd.erase.params.quiet=-d0
178178
tools.openocd.erase.pattern=
179179

180180
tools.openocd.bootloader.params.verbose=-d2
181181
tools.openocd.bootloader.params.quiet=-d0
182-
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"
182+
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"
183183

184184
#
185185
# BOSSA
@@ -330,7 +330,7 @@ tools.gdb.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
330330
tools.gdb.cmd=arm-none-eabi-gdb
331331
tools.gdb.cmd.windows=arm-none-eabi-gdb.exe
332332

333-
debug.executable={build.path}/{build.project_name}.elf
333+
debug.executable={build.path}/{build.project_name}_debug.elf
334334
debug.toolchain=gcc
335335
debug.toolchain.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/
336336
debug.toolchain.prefix=arm-none-eabi
@@ -345,3 +345,6 @@ debug.cortex-debug.custom.postAttachCommands.3=c
345345
debug.cortex-debug.custom.overrideRestartCommands.0=monitor reset halt
346346
debug.cortex-debug.custom.overrideRestartCommands.1=monitor gdb_sync
347347
debug.cortex-debug.custom.overrideRestartCommands.2=c
348+
349+
debug.server.openocd.path={runtime.tools.openocd-0.12.0-arduino1-static.path}/bin/openocd
350+
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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
CONFIG_MAIN_STACK_SIZE=16000
2+
CONFIG_HEAP_MEM_POOL_SIZE=112000
3+
CONFIG_LLEXT_HEAP_SIZE=64
4+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
5+
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1
6+
7+
CONFIG_FPU=y
8+
CONFIG_I2C=y
9+
CONFIG_SPI=y
10+
CONFIG_PWM=y
11+
12+
CONFIG_BT=y
13+
CONFIG_BT_HCI=y
14+
CONFIG_BT_HCI_RAW=y
15+
CONFIG_BT_HCI_RAW_CMD_EXT=y
16+
CONFIG_BT_MAX_CONN=4
17+
CONFIG_BT_SILABS_EFR32_HCI_VS=y
18+
CONFIG_BT_SILABS_EFR32_LINK_LAYER_STACK_SIZE=4096
19+
CONFIG_BT_CTLR_PRIVACY=n
20+
CONFIG_BT_RX_STACK_SIZE=4096
21+
CONFIG_BT_HCI_TX_STACK_SIZE=1024
22+
23+
CONFIG_MBEDTLS=y
24+
CONFIG_TLS_CREDENTIALS=y
25+
CONFIG_CURRENT_THREAD_USE_TLS=n
26+
CONFIG_NETWORKING=y
27+
28+
CONFIG_ASSERT=y
29+
CONFIG_STACK_USAGE=n
30+
CONFIG_STACK_SENTINEL=n
31+
CONFIG_INIT_STACKS=n
32+
CONFIG_THREAD_NAME=n
33+
CONFIG_THREAD_STACK_INFO=n
34+
CONFIG_STACK_CANARIES=n
35+
CONFIG_THREAD_ANALYZER=n
36+
CONFIG_SYS_HEAP_RUNTIME_STATS=n
37+
# CONFIG_LOG_DEFAULT_LEVEL=3
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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 2 GPIO_ACTIVE_LOW>, /* 23 LED G */
47+
<&gpioc 1 GPIO_ACTIVE_LOW>, /* 22 LED R */
48+
<&gpioc 2 GPIO_ACTIVE_LOW>, /* 23 LED G */
49+
<&gpioc 3 GPIO_ACTIVE_LOW>; /* 24 LED B */
50+
51+
pwm-pin-gpios = <&gpiob 0 0>, /* A0 */
52+
<&gpiob 2 0>, /* A1 */
53+
<&gpiob 5 0>; /* A2 */
54+
55+
pwms = <&timer0_pwm 0 255 PWM_POLARITY_INVERTED>,
56+
<&timer0_pwm 1 255 PWM_POLARITY_INVERTED>,
57+
<&timer0_pwm 2 255 PWM_POLARITY_INVERTED>;
58+
59+
serials = <&usart0>;
60+
i2cs = <&i2c0>;
61+
spis = <&eusart1>;
62+
};
63+
};
64+
65+
&i2c0 {
66+
pinctrl-0 = <&i2c0_default>;
67+
pinctrl-names = "default";
68+
clock-frequency = <I2C_BITRATE_STANDARD>;
69+
status = "okay";
70+
};
71+
72+
&pinctrl {
73+
eusart1_default: eusart1_default {
74+
group0 {
75+
pins = <EUSART1_TX_PA9>, <EUSART1_SCLK_PB4>;
76+
drive-push-pull;
77+
output-high;
78+
};
79+
80+
group1 {
81+
pins = <EUSART1_RX_PA8>;
82+
input-enable;
83+
silabs,input-filter;
84+
};
85+
};
86+
};
87+
88+
&eusart1 {
89+
compatible = "silabs,eusart-spi";
90+
#address-cells = <1>;
91+
#size-cells = <0>;
92+
clock-frequency = <4000000>;
93+
pinctrl-0 = <&eusart1_default>;
94+
pinctrl-names = "default";
95+
status = "okay";
96+
97+
cs-gpios = <&gpiod 5 GPIO_ACTIVE_LOW>;
98+
};
99+
100+
&timer0 {
101+
status = "okay";
102+
103+
timer0_pwm: pwm {
104+
pinctrl-0 = <&timer0_default>;
105+
pinctrl-names = "default";
106+
status = "okay";
107+
};
108+
};
109+
110+
&pinctrl {
111+
timer0_default: timer0_default {
112+
group0 {
113+
pins = <TIMER0_CC0_PB0>, <TIMER0_CC1_PB2>, <TIMER0_CC2_PB5>;
114+
drive-push-pull;
115+
output-high;
116+
};
117+
};
118+
};
119+
120+
&sysrtc0 {
121+
status = "okay";
122+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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
9+
10+
#define LED_BUILTIN_1 23
11+
#define LED_BUILTIN_2 24
12+
#define LED_BUILTIN_ACTIVE (LOW)
13+
#define LED_BUILTIN_INACTIVE (!LED_BUILTIN_ACTIVE)
14+
15+
#define BTN_BUILTIN 25

0 commit comments

Comments
 (0)