Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,72 @@ 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.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
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
Expand Down
9 changes: 8 additions & 1 deletion cores/arduino/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 28 additions & 1 deletion platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}.{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}.{upload.extension}} {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
#
Expand Down Expand Up @@ -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
Expand All @@ -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/
8 changes: 7 additions & 1 deletion programmers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ jlink.program.protocol=
jlink.program.tool=pyocd
jlink.program.tool.default=pyocd
jlink.program.extra_params=
jlink.programmer.protocol=jlink
jlink.programmer.protocol=jlink

openocd.name=OpenOCD
openocd.protocol=SWD
openocd.program.tool=openocd
openocd.program.tool.default=openocd
openocd.program.extra_params=
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
&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 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>;

serials = <&usart0>;
i2cs = <&i2c0>;
spis = <&eusart1>;
};
};

&i2c0 {
pinctrl-0 = <&i2c0_default>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_STANDARD>;
status = "okay";
};

&pinctrl {
eusart1_default: eusart1_default {
group0 {
pins = <EUSART1_TX_PA9>, <EUSART1_SCLK_PB4>;
drive-push-pull;
output-high;
};

group1 {
pins = <EUSART1_RX_PA8>;
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";

timer0_pwm: pwm {
pinctrl-0 = <&timer0_default>;
pinctrl-names = "default";
status = "okay";
};
};

&pinctrl {
timer0_default: timer0_default {
group0 {
pins = <TIMER0_CC0_PB0>, <TIMER0_CC1_PB2>, <TIMER0_CC2_PB5>;
drive-push-pull;
output-high;
};
};
};

&sysrtc0 {
status = "okay";
};
15 changes: 15 additions & 0 deletions variants/arduino_nano_matter_mgm240sd22vna/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

#define MOSI 11
#define MISO 12
#define SCK 13
#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