-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: arm: add initial support for Arduino UNO R4 Minima
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 <[email protected]>
- Loading branch information
Showing
9 changed files
with
281 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_ARDUINO_UNO_R4_MINIMA | ||
bool "Arduino Uno R4 Minima board" | ||
depends on SOC_R7FA4M1AB3CFM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
* | ||
* 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
18
boards/arm/arduino_uno_r4/arduino_uno_r4_minima-pinctrl.dtsi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
&pinctrl { | ||
sci2_default: sci2_default { | ||
group1 { | ||
/* TODO define macros port3:pin0 sci0-txd*/ | ||
pinmux = <0x04630000>; | ||
}; | ||
group2 { | ||
/* TODO define macros port3:pin1 sci0-rxd*/ | ||
pinmux = <0x04650000>; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
* Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
* | ||
* 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; | ||
}; | ||
}; | ||
|
||
&sci2 { | ||
status = "okay"; | ||
pinctrl-0 = <&sci2_default>; | ||
pinctrl-names = "default"; | ||
uart { | ||
status = "okay"; | ||
}; | ||
}; | ||
|
||
&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>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright (c) 2023 TOKITA Hiroshi <[email protected]> | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_Args(pyocd "--target=r7fa4m1ab") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.. _arduino_uno_r4: | ||
|
||
Arduino UNO R4 Minima | ||
##################### | ||
|
||
Overview | ||
******** | ||
|
||
The Arduino UNO R4 Minima is a development board featuring the Renesas RA4M1 SoC | ||
in the Arduino form factor and is compatible with traditional Arduino. | ||
|
||
Programming and debugging | ||
************************* | ||
|
||
Building & Flashing | ||
=================== | ||
|
||
You can build and flash an application in the usual way (See | ||
:ref:`build_an_application` and | ||
:ref:`application_run` for more details). | ||
|
||
Here is an example for building and flashing the :ref:`blinky-sample` application. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/basic/blinky | ||
:board: arduino_uno_r4_minima | ||
:goals: build flash | ||
|
||
Debugging | ||
========= | ||
|
||
Debugging also can be done in the usual way. | ||
The following command is debugging the :ref:`blinky-sample` application. | ||
Also, see the instructions specific to the debug server that you use. | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/basic/blinky | ||
:board: arduino_uno_r4_minima | ||
:maybe-skip-config: | ||
:goals: debug | ||
|
||
|
||
Using pyOCD | ||
----------- | ||
|
||
Various debug adapters, including cmsis-dap probes, can debug the Arduino UNO R4 with pyOCD. | ||
The default configuration uses the pyOCD for debugging. | ||
You must install CMSIS-Pack when flashing or debugging Arduino UNO R4 Minima with pyOCD. | ||
If not installed yet, execute the following command to install CMSIS-Pack for Arduino UNO R4. | ||
|
||
.. code-block:: console | ||
pyocd pack install r7fa4m1ab | ||
Restoring Arduino Bootloader | ||
============================ | ||
|
||
If you corrupt the Arduino bootloader, you can restore it with the following command. | ||
|
||
.. code-block:: console | ||
wget https://raw.githubusercontent.com/arduino/ArduinoCore-renesas/main/bootloaders/UNO_R4/dfu_minima.hex | ||
pyocd flash -e sector -a 0x0 -t r7fa4m1ab dfu_minima.hex |