Skip to content
Draft
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
52 changes: 52 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,58 @@ portentac33.bootloader.dfuse=-Q

##########################################################################################

unor4wifi.name=Arduino UNO R4 WiFi
unor4wifi.build.core=arduino
unor4wifi.build.crossprefix=arm-zephyr-eabi-
unor4wifi.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/

unor4wifi.menu.debug.false=Standard
unor4wifi.menu.debug.true=Debug
unor4wifi.menu.debug.true.build.zsk_args.debug=-debug

unor4wifi.menu.link_mode.dynamic=Dynamic
unor4wifi.menu.link_mode.static=Static
unor4wifi.menu.link_mode.static.build.link_mode=static
unor4wifi.menu.link_mode.static.upload.extension=bin-zsk.bin

unor4wifi.build.zephyr_target=arduino_uno_r4@wifi
unor4wifi.build.zephyr_args=
unor4wifi.build.zephyr_hals=hal_renesas
unor4wifi.build.artifact=zephyr_main
unor4wifi.build.variant=arduino_uno_r4_r7fa4m1ab3cfm
unor4wifi.build.mcu=cortex-m4
unor4wifi.build.fpu=-mfpu=fpv4-sp-d16
unor4wifi.build.architecture=cortex-m4

unor4wifi.build.float-abi=-mfloat-abi=hard
unor4wifi.build.extra_flags=
unor4wifi.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
unor4wifi.build.board=ARDUINO_UNO_R4_WIFI
unor4wifi.vid.0=0x2341
unor4wifi.pid.0=0x1002
unor4wifi.upload_port.0.vid=0x2341
unor4wifi.upload_port.0.pid=0x1002

unor4wifi.upload.tool=pyocd
unor4wifi.upload.tool.default=pyocd
unor4wifi.upload.protocol=
unor4wifi.upload.transport=
unor4wifi.upload.interface=0
unor4wifi.upload.use_1200bps_touch=false
unor4wifi.upload.wait_for_upload_port=false
unor4wifi.upload.native_usb=true
unor4wifi.upload.maximum_size=122880
unor4wifi.upload.maximum_data_size=16384
unor4wifi.upload.address=0x22000
unor4wifi.upload.target=r7fa4m1ab

unor4wifi.bootloader.tool=pyocd
unor4wifi.bootloader.tool.default=pyocd
unor4wifi.bootloader.file=zephyr-{build.variant}.elf
unor4wifi.bootloader.target=r7fa4m1ab

##########################################################################################

opta.name=Arduino Opta
opta.build.core=arduino
opta.build.crossprefix=arm-zephyr-eabi-
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) Arduino s.r.l. and/or its affiliated companies
# SPDX-License-Identifier: Apache-2.0

CONFIG_FPU=y
CONFIG_USERSPACE=n
CONFIG_ARM_MPU=n

CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_UART_INTERRUPT_DRIVEN=y

CONFIG_GPIO=y
CONFIG_I2C=y
CONFIG_SPI=y
CONFIG_ADC=y
CONFIG_PWM=y

CONFIG_FLASH=y
CONFIG_FLASH_MAP=y

CONFIG_LLEXT_STORAGE_WRITABLE=n
CONFIG_LLEXT_HEAP_SIZE=16

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_ISR_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512

CONFIG_BOOT_BANNER=y
CONFIG_THREAD_NAME=n
CONFIG_THREAD_STACK_INFO=n
CONFIG_THREAD_MONITOR=n
CONFIG_INIT_STACKS=n
CONFIG_STACK_CANARIES=n
CONFIG_STACK_SENTINEL=n
CONFIG_DYNAMIC_INTERRUPTS=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Copyright (c) Arduino s.r.l. and/or its affiliated companies
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/pwm/pwm.h>

/* RA4M1 has 256 KB flash. Split as:
* 0x00000 - 0x04000 (16 KB) bootloader
* 0x04000 - 0x22000 (120 KB) loader (image-0)
* 0x22000 - 0x40000 (120 KB) user_sketch
*/
&flash0 {
/delete-node/ partitions;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "bootloader";
reg = <0x00000000 DT_SIZE_K(16)>;
read-only;
};

code_partition: partition@4000 {
label = "image-0";
reg = <0x00004000 DT_SIZE_K(120)>;
};

user_sketch: partition@22000 {
label = "user_sketch";
reg = <0x00022000 DT_SIZE_K(120)>;
};
};
};

&adc0 {
#address-cells = <1>;
#size-cells = <0>;

a0: channel@9 {
reg = <9>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <14>;
};

a1: channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <14>;
};

a2: channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <14>;
};

a3: channel@2 {
reg = <2>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <14>;
};
};

/ {
zephyr,user {
/* D0..D15 then A0..A5 (header order). */
digital-pin-gpios = <&ioport3 1 GPIO_ACTIVE_HIGH>, /* D0 RXD (P301) */
<&ioport3 2 GPIO_ACTIVE_HIGH>, /* D1 TXD (P302) */
<&ioport1 4 GPIO_ACTIVE_HIGH>, /* D2 (P104) */
<&ioport1 5 GPIO_ACTIVE_HIGH>, /* D3 (P105) */
<&ioport1 6 GPIO_ACTIVE_HIGH>, /* D4 (P106) */
<&ioport1 7 GPIO_ACTIVE_HIGH>, /* D5 (P107) */
<&ioport1 11 GPIO_ACTIVE_HIGH>, /* D6 (P111) */
<&ioport1 12 GPIO_ACTIVE_HIGH>, /* D7 (P112) */
<&ioport3 4 GPIO_ACTIVE_HIGH>, /* D8 (P304) */
<&ioport3 3 GPIO_ACTIVE_HIGH>, /* D9 (P303) */
<&ioport1 3 GPIO_ACTIVE_HIGH>, /* D10 (P103) CS */
<&ioport4 11 GPIO_ACTIVE_HIGH>, /* D11 (P411) MOSI*/
<&ioport4 10 GPIO_ACTIVE_HIGH>, /* D12 (P410) MISO*/
<&ioport1 2 GPIO_ACTIVE_HIGH>, /* D13 (P102) SCK */
<&ioport1 1 GPIO_ACTIVE_HIGH>, /* D14 (P101) SDA */
<&ioport1 0 GPIO_ACTIVE_HIGH>, /* D15 (P100) SCL */

<&ioport0 14 GPIO_ACTIVE_HIGH>, /* A0 (P014) */
<&ioport0 0 GPIO_ACTIVE_HIGH>, /* A1 (P000) */
<&ioport0 1 GPIO_ACTIVE_HIGH>, /* A2 (P001) */
<&ioport0 2 GPIO_ACTIVE_HIGH>, /* A3 (P002) */
<&ioport1 1 GPIO_ACTIVE_HIGH>, /* A4 (P101) */
<&ioport1 0 GPIO_ACTIVE_HIGH>; /* A5 (P100) */

builtin-led-gpios = <&ioport1 2 GPIO_ACTIVE_HIGH>; /* D13 LED */

pwm-pin-gpios = <&ioport3 4 0>, /* D8 GPT7_A */
<&ioport3 3 0>; /* D9 GPT7_B */

serials = <&uart2>; /* Serial1 = D0/D1 (UART to ESP32-S3) */
i2cs = <&iic1>; /* Wire = A4/A5 */
spis = <&spi0>; /* SPI = D11/D12/D13 */

pwms = <&pwm7 0 PWM_HZ(490) PWM_POLARITY_NORMAL>,
<&pwm7 1 PWM_HZ(490) PWM_POLARITY_NORMAL>;

io-channels = <&adc0 9>,
<&adc0 0>,
<&adc0 1>,
<&adc0 2>;

adc-pin-gpios = <&ioport0 14 0>, /* A0 */
<&ioport0 0 0>, /* A1 */
<&ioport0 1 0>, /* A2 */
<&ioport0 2 0>; /* A3 */
};
};
21 changes: 21 additions & 0 deletions variants/arduino_uno_r4_r7fa4m1ab3cfm/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) Arduino s.r.l. and/or its affiliated companies
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/kernel.h>

#define BSP_PRV_PRCR_KEY (0xA500U)
#define BSP_PRV_PRCR_PRC1_UNLOCK ((BSP_PRV_PRCR_KEY) | 0x2U)
#define BSP_PRV_PRCR_LOCK ((BSP_PRV_PRCR_KEY) | 0x0U)

#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) &R_SYSTEM->VBTBKR[0]))
#define DOUBLE_TAP_MAGIC 0x07738135

void _on_1200_bps() {
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_PRC1_UNLOCK;
BOOT_DOUBLE_TAP_DATA = DOUBLE_TAP_MAGIC;
R_SYSTEM->PRCR = (uint16_t) BSP_PRV_PRCR_LOCK;
NVIC_SystemReset();
}
7 changes: 7 additions & 0 deletions variants/arduino_uno_r4_r7fa4m1ab3cfm/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) Arduino s.r.l. and/or its affiliated companies
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once
Loading