Skip to content

Commit

Permalink
boards/ra4: Add support for Arduino-R4-Minima
Browse files Browse the repository at this point in the history
Add support for arduino-r4-minima.
Created defconfig and board source files for:
* nsh
* nsh-leds

Signed-off-by: leocafonso <[email protected]>
  • Loading branch information
leocafonso committed Feb 25, 2025
1 parent cf643fa commit a0d142c
Show file tree
Hide file tree
Showing 16 changed files with 1,089 additions and 0 deletions.
12 changes: 12 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ config ARCH_BOARD_ARDUINO_DUE
This options selects the Arduino DUE board featuring the Atmel
ATSAM3X8E MCU running at 84 MHz.

config ARCH_BOARD_ARDUINO_R4_MINIMA
bool "Arduino R4 Minima"
depends on ARCH_CHIP_RA4
select ARCH_HAVE_LEDS
---help---
This options selects the Arduino R4 Minima board featuring the Renesas
R7FA4M1 MCU running at 48 MHz.

config ARCH_BOARD_ARDUINO_M0
bool "Arduino M0"
depends on ARCH_CHIP_SAMD21G18A
Expand Down Expand Up @@ -3313,6 +3321,7 @@ config ARCH_BOARD
default "amber" if ARCH_BOARD_AMBER
default "arduino-mega2560" if ARCH_BOARD_ARDUINO_MEGA2560
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
default "arduino-r4-minima" if ARCH_BOARD_ARDUINO_R4_MINIMA
default "arduino-m0" if ARCH_BOARD_ARDUINO_M0
default "arduino-nano-33ble" if ARCH_BOARD_ARDUINO_NANO_33BLE
default "arduino-nano-33ble-rev2" if ARCH_BOARD_ARDUINO_NANO_33BLE_REV2
Expand Down Expand Up @@ -4000,6 +4009,9 @@ endif
if ARCH_BOARD_ARDUINO_DUE
source "boards/arm/sam34/arduino-due/Kconfig"
endif
if ARCH_BOARD_ARDUINO_R4_MINIMA
source "boards/arm/ra4/arduino-r4-minima/Kconfig"
endif
if ARCH_BOARD_ARDUINO_M0
source "boards/arm/samd2l2/arduino-m0/Kconfig"
endif
Expand Down
21 changes: 21 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ##############################################################################
# boards/arm/nrf52/nrf52-feather/CMakeLists.txt
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ##############################################################################

add_subdirectory(src)
8 changes: 8 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_BOARD_ARDUINO_R4_MINIMA

endif
41 changes: 41 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/configs/nsh-leds/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_READLINE_ECHO is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="arduino-r4-minima"
CONFIG_ARCH_BOARD_ARDUINO_R4_MINIMA=y
CONFIG_ARCH_CHIP="ra4"
CONFIG_ARCH_CHIP_R7FA4M1ABxxFM=y
CONFIG_ARCH_CHIP_RA4=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=6965
CONFIG_BUILTIN=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=32768
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SCI2_SERIAL_CONSOLE=y
CONFIG_START_DAY=28
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2013
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=32
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y
40 changes: 40 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/configs/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="arduino-r4-minima"
CONFIG_ARCH_BOARD_ARDUINO_R4_MINIMA=y
CONFIG_ARCH_CHIP="ra4"
CONFIG_ARCH_CHIP_R7FA4M1ABxxFM=y
CONFIG_ARCH_CHIP_RA4=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=6965
CONFIG_BUILTIN=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=32768
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_WAITPID=y
CONFIG_SCI2_SERIAL_CONSOLE=y
CONFIG_START_DAY=28
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2013
CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=32
CONFIG_TESTING_OSTEST=y
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3
CONFIG_TESTING_OSTEST_STACKSIZE=2048
128 changes: 128 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/****************************************************************************
* boards/arm/ra4/arduino-r4-minima/include/board.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

#ifndef __BOARDS_ARM_RA_ARDUINO_UNO_R4_INCLUDE_BOARD_H
#define __BOARDS_ARM_RA_ARDUINO_UNO_R4_INCLUDE_BOARD_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Clocking *****************************************************************/

/* This is the canonical configuration:
* System Clock source : HOCO
* ICLK(Hz) : 64000000
* PCLKA(Hz) : 64000000
* PCLKB(Hz) : 64000000
* PCLKC(Hz) : 64000000
* PCLKD(Hz) : 64000000
* FCLK(Hz) : 64000000
* USBCLK(Hz) : 0
*/

/* Clock selection HOCO, MOCO, LOCO, PLL */

#define RA_CKSEL R_SYSTEM_SCKSCR_CKSEL_HOCO

#define RA_HOCOEN !R_OFS1_HOCOEN /* Inverted logic to enable */
#define RA_HOCO_FREQUENCY R_OFS1_HOCOFRQ1_64MHZ

#define RA_ICK_DIV R_SYSTEM_SCKDIVCR_ICK_DIV_1
#define RA_ICLK_FREQUENCY 64000000
#define RA_FCK_DIV R_SYSTEM_SCKDIVCR_FCK_DIV_1
#define RA_FCK_FREQUENCY 64000000
#define RA_PCKA_DIV R_SYSTEM_SCKDIVCR_PCKA_DIV_1
#define RA_PCKA_FREQUENCY 64000000
#define RA_PCKB_DIV R_SYSTEM_SCKDIVCR_PCKB_DIV_1
#define RA_PCKB_FREQUENCY 64000000
#define RA_PCKC_DIV R_SYSTEM_SCKDIVCR_PCKC_DIV_1
#define RA_PCKC_FREQUENCY 64000000
#define RA_PCKD_DIV R_SYSTEM_SCKDIVCR_PCKD_DIV_1
#define RA_PCKD_FREQUENCY 64000000

/* Alternate function pin selections */

#define GPIO_SCI2_RX GPIO_RXD2_MISO2_SCL2_1 /* P301 */
#define GPIO_SCI2_TX GPIO_TXD2_MOSI2_SDA2_1 /* P302 */

#define GPIO_SCI1_RX GPIO_RXD1_MISO1_SCL1_3 /* P502 */
#define GPIO_SCI1_TX GPIO_TXD1_MOSI1_SDA1_3 /* P501 */

#define GPIO_SCI9_RX GPIO_RXD9_MISO9_SCL9_1 /* P110 */
#define GPIO_SCI9_TX GPIO_TXD9_MOSI9_SDA9_1 /* P109 */

/* LED pin selections */

#define GPIO_L_LED (gpio_pinset_t){ PORT1,PIN11, (GPIO_OUPUT | GPIO_LOW_DRIVE | GPIO_OUTPUT_LOW)} /* P111 */
#define GPIO_TX_LED (gpio_pinset_t){ PORT0,PIN12, (GPIO_OUPUT | GPIO_LOW_DRIVE | GPIO_OUTPUT_HIGH)} /* P012 */
#define GPIO_RX_LED (gpio_pinset_t){ PORT0,PIN13, (GPIO_OUPUT | GPIO_LOW_DRIVE | GPIO_OUTPUT_HIGH)} /* P013 */

#define LED_DRIVER_PATH "/dev/userleds"

/* LED index values for use with board_userled() */

#define BOARD_LED_L 0
#define BOARD_LED_RX 1
#define BOARD_LED_TX 2
#define BOARD_NLEDS 3

/* LED bits for use with board_userled_all() */

#define BOARD_LED_L_BIT (1 << BOARD_LED_L)
#define BOARD_LED_RX_BIT (1 << BOARD_LED_RX)
#define BOARD_LED_TX_BIT (1 << BOARD_LED_TX)

/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/ra4m1_leds.c. The LEDs are used to encode
* OS-related events as follows:
*
* SYMBOL MEANING LED STATE
* L TX RX
* ----------------------- -------------------------- ---- ---- ----
*/

#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF OFF */
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF OFF */
#define LED_STACKCREATED 1 /* Idle stack created ON OFF OFF */
#define LED_INIRQ 2 /* In an interrupt N/C GLOW OFF */
#define LED_SIGNAL 2 /* In a signal handler N/C GLOW OFF */
#define LED_ASSERTION 2 /* An assertion failed N/C GLOW OFF */
#define LED_PANIC 3 /* The system has crashed N/C N/C Blinking */
#define LED_PANIC 3 /* MCU is is sleep mode ---- Not used ---- */

/* ID_CODE */

#define IDCODE1 0xFFFFFFFF
#define IDCODE2 0xFFFFFFFF
#define IDCODE3 0xFFFFFFFF
#define IDCODE4 0xFFFFFFFF

#endif /* __BOARDS_ARM_RA_ARDUINO_UNO_R4_INCLUDE_BOARD_H */
38 changes: 38 additions & 0 deletions boards/arm/ra4/arduino-r4-minima/scripts/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
############################################################################
# boards/arm/ra4/arduino-r4-minima/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################

include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs

ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)arduino-r4-minima.ld

ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__

NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
Loading

0 comments on commit a0d142c

Please sign in to comment.