Skip to content

Commit

Permalink
boards: arm: add initial support for Arduino UNO R4 Minima
Browse files Browse the repository at this point in the history
Add support for the Arduino UNO R4 Minima.
This board is the newest version of Arduino that uses Renesas RA4M1 SoC.

This commit provides only limited support to simplify the initial support patch.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
  • Loading branch information
soburi committed Jul 25, 2023
1 parent ba9c12a commit 2b89a41
Show file tree
Hide file tree
Showing 9 changed files with 295 additions and 0 deletions.
6 changes: 6 additions & 0 deletions boards/arm/arduino_uno_r4/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
# SPDX-License-Identifier: Apache-2.0

config BOARD_ARDUINO_UNO_R4_MINIMA
bool "Arduino Uno R4 Minima board"
depends on SOC_R7FA4M1AB3CFM
9 changes: 9 additions & 0 deletions boards/arm/arduino_uno_r4/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
# SPDX-License-Identifier: Apache-2.0

if BOARD_ARDUINO_UNO_R4_MINIMA

config BOARD
default "arduino_uno_r4_minima" if BOARD_ARDUINO_UNO_R4_MINIMA

endif # BOARD_ARDUINO_UNO_R4_MINIMA
13 changes: 13 additions & 0 deletions boards/arm/arduino_uno_r4/arduino_uno_r4_common.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <renesas/ra/r7fa4m1ab3cfm.dtsi>

/ {
model = "Arduino Uno R4 Board";
compatible = "renesas,r7fa4m1aB3cfm";
};
18 changes: 18 additions & 0 deletions boards/arm/arduino_uno_r4/arduino_uno_r4_minima-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
uart2_default: uart2_default {
group1 {
/* TODO define macros port3:pin0 sci0-txd*/
pinmux = <0x04630000>;
};
group2 {
/* TODO define macros port3:pin1 sci0-rxd*/
pinmux = <0x04650000>;
};
};
};
125 changes: 125 additions & 0 deletions boards/arm/arduino_uno_r4/arduino_uno_r4_minima.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*
* Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

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

#include "arduino_uno_r4_common.dtsi"
#include "arduino_uno_r4_minima-pinctrl.dtsi"

/ {
model = "Arduino Uno R4 Minima";

chosen {
zephyr,console = &uart2;
zephyr,shell-uart = &uart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &code_partition;
};

leds {
compatible = "gpio-leds";
led: led {
gpios = <&ioport1 11 GPIO_ACTIVE_HIGH>;
};
};

aliases {
led0 = &led;
};
};

&uart2 {
status = "okay";
pinctrl-0 = <&uart2_default>;
pinctrl-names = "default";
};

&ioport1 {
status = "okay";
};

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

boot_partition: partition@0 {
label = "bootloader";
reg = <0x00000000 0x4000>;
read-only;
};

code_partition: partition@4000 {
label = "code";
reg = <0x4000 0x3C000>;
read-only;
};
};
};

&fcu {
status = "okay";
};

&sosc {
status = "okay";
};

&hoco {
status = "okay";
clock-frequency = <48000000>;
};

&moco {
status = "okay";
};

&loco {
status = "okay";
};

&subclk {
status = "okay";
};

&sysclk {
status = "okay";
clocks = <&hoco>;
};

&iclk {
status = "okay";
clock-div = <1>;
};

&pclka {
status = "okay";
clock-div = <1>;
};

&pclkb {
status = "okay";
clock-div = <2>;
};

&pclkc {
status = "okay";
clock-div = <1>;
};

&pclkd {
status = "okay";
clock-div = <1>;
};

&fclk {
status = "okay";
clock-div = <2>;
};
12 changes: 12 additions & 0 deletions boards/arm/arduino_uno_r4/arduino_uno_r4_minima.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
identifier: arduino_uno_r4_minima
name: Arduino Uno R4 Minima
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 32
supported:
- gpio
- uart
25 changes: 25 additions & 0 deletions boards/arm/arduino_uno_r4/arduino_uno_r4_minima_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_RA4M1=y
CONFIG_SOC_R7FA4M1AB3CFM=y

CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000

CONFIG_BUILD_OUTPUT_HEX=y

# enable uart driver
CONFIG_SERIAL=y

# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

# enable GPIO
CONFIG_GPIO=y

CONFIG_PINCTRL=y

CONFIG_CLOCK_CONTROL=y

CONFIG_USE_DT_CODE_PARTITION=y
45 changes: 45 additions & 0 deletions boards/arm/arduino_uno_r4/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
# SPDX-License-Identifier: Apache-2.0

board_runner_args(e2-server-gdb
"--target=R7FA4M1AB"
"--adapter=E2LITE"
"-uConnectionTimeout=30"
"-uClockSrc=0"
"-uAllowClockSourceInternal=1"
"-uInteface=SWD"
"-uIfSpeed=auto"
"-uIdCodeBytes=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"-uResetCon=1"
"-uLowPower=1"
"-uresetOnReload=1"
"-uFlashBp=0"
"-uhookWorkRamSize=0x400"
"-ueraseRomOnDownload=0"
"-ueraseDataRomOnDownload=0"
"-uTraceMTB=0"
"-uTraceSizeMTB=1024"
"-uProgReWriteIRom=0"
"-uProgReWriteDFlash=0"
"-uOSRestriction=0"
"-uTimeMeasurementEnable=1"
"-uDWTEnable=0"
"-uMemRegion=0x00000000:0x40000:FLASH:e"
"-uMemRegion=0x40100000:0x2000:DATA_FLASH:e"
"-uCore=SINGLE_CORE\|enabled\|1\|main"
"-uSyncMode=async"
"-uFirstGDB=main"
"-w 0"
"-z 33"
"-n 0"
"-l"
)

#board_runner_args(dfu-util "--pid=\"2341:0069,:0369\"" "--alt=0" "--dfuse")

#include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)

board_runner_args(rfp-cli "--device=RA" "--tool=e2l" "--interface=swd" "--range=0x4000,0x40000" "--verify" "--reset")

include(${ZEPHYR_BASE}/boards/common/rfp-cli.board.cmake)
include(${ZEPHYR_BASE}/boards/common/e2-server-gdb.board.cmake)
42 changes: 42 additions & 0 deletions boards/arm/arduino_uno_r4/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _arduino_uno_r4:

Arduino UNO R4 Minima
#######################

Overview
********

Arduino UNO R4 Minima is a development board with a Renesas RA4M1 SoC.

Programming and debugging
*************************

Building & Flashing
===================

Here is an example for building the :ref:`blinky-sample` application.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: arduino_uno_r4_minima
:goals: build

The default runner tries to flash the board via an external programmer using openocd.
To flash via the USB port, select the DFU runner when flashing:

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: arduino_uno_r4_minima
:goals: flash

Debugging
=========

You can debug an application in the usual way. Here is an example for the
:ref:`blinky-sample` application.

.. zephyr-app-commands::
:zephyr-app: samples/basic/blinky
:board: longan_nano
:maybe-skip-config:
:goals: debug

0 comments on commit 2b89a41

Please sign in to comment.