Skip to content

ports/renesas-ra/boards/VK-RA6M5: Last New Board. #10943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2023
Merged
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
78 changes: 40 additions & 38 deletions ports/renesas-ra/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,17 @@ endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)

ifeq ($(BOARD),RA4M1_CLICKER)
BOARD_LOW = ra4m1_ek
CMSIS_MCU_LOW = ra4m1
CMSIS_MCU_CAP = RA4M1
USE_FSP_LPM = 0
endif

ifeq ($(BOARD),EK_RA4M1)
BOARD_LOW = ra4m1_ek
CMSIS_MCU_LOW = ra4m1
CMSIS_MCU_CAP = RA4M1
USE_FSP_LPM = 0
endif

ifeq ($(BOARD),EK_RA4W1)
BOARD_LOW = ra4w1_ek
CMSIS_MCU_LOW = ra4w1
CMSIS_MCU_CAP = RA4W1
USE_FSP_LPM = 1
endif

ifeq ($(BOARD),EK_RA6M1)
BOARD_LOW = ra6m1_ek
CMSIS_MCU_LOW = ra6m1
CMSIS_MCU_CAP = RA6M1
USE_FSP_LPM = 1
endif

ifeq ($(BOARD),EK_RA6M2)
BOARD_LOW = ra6m2_ek
CMSIS_MCU_LOW = ra6m2
CMSIS_MCU_CAP = RA6M2
USE_FSP_LPM = 1
endif

# select use wrapper function of FSP library
USE_FSP_FLASH = 1

include ../../py/mkenv.mk
-include mpconfigport.mk
include $(BOARD_DIR)/mpconfigboard.mk

USE_FSP_LPM ?= 1
USE_FSP_QSPI ?= 0
FSP_BOARD_NAME ?= $(shell echo $(BOARD) | tr '[:upper:]' '[:lower:]')

# Files that are generated and needed before the QSTR build.
#QSTR_GENERATED_HEADERS = $(BUILD)/pins_qstr.h $(BUILD)/modstm_qstr.h
QSTR_GENERATED_HEADERS = $(BUILD)/pins_qstr.h
Expand Down Expand Up @@ -101,16 +70,18 @@ INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/api
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/instances
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include
#INC += -Ilwip_inc
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M5))
INC += -Ira
endif
INC += -I$(BOARD_DIR)/ra_gen
INC += -I$(BOARD_DIR)/ra_cfg/driver
INC += -I$(BOARD_DIR)/ra_cfg/fsp_cfg
INC += -I$(BOARD_DIR)/ra_cfg/fsp_cfg/bsp
INC += -Idebug

CFLAGS += -D$(CMSIS_MCU)
CFLAGS += -DRA_HAL_H='<$(CMSIS_MCU)_hal.h>'
CFLAGS += -DRA_CFG_H='<$(FSP_BOARD_NAME)_conf.h>'

# Basic Cortex-M flags
CFLAGS_CORTEX_M = -mthumb
Expand All @@ -123,12 +94,19 @@ CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
SUPPORTS_HARDWARE_FP_SINGLE = 1
endif

ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),m33))
CFLAGS_CORTEX_M += -mfpu=fpv5-sp-d16 -mfloat-abi=hard
SUPPORTS_HARDWARE_FP_SINGLE = 1
endif

# Options for particular MCU series
CFLAGS_MCU_RA4M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
CFLAGS_MCU_RA4W1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
CFLAGS_MCU_RA6M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
CFLAGS_MCU_RA6M2 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
CFLAGS_MCU_RA6M5 = $(CFLAGS_CORTEX_M) -mtune=cortex-m33 -mcpu=cortex-m33

ASFLAGS += $(CFLAGS_CORTEX_M) -mcpu=cortex-$(MCU_SERIES)
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
#CFLAGS += -D$(CMSIS_MCU)
CFLAGS += $(CFLAGS_MCU_$(CMSIS_MCU))
Expand Down Expand Up @@ -315,11 +293,13 @@ SRC_C += \
gccollect.c \
help.c \
machine_adc.c \
machine_dac.c \
machine_i2c.c \
machine_spi.c \
machine_uart.c \
machine_pin.c \
machine_rtc.c \
machine_sdcard.c \
modmachine.c \
extint.c \
usrsw.c \
Expand Down Expand Up @@ -365,6 +345,17 @@ HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/fsp/src/,\
CFLAGS_FSP = -Wno-unused-variable -Wno-unused-function
$(BUILD)/lib/fsp/ra/fsp/src/r_sci_uart/r_sci_uart.o: CFLAGS += $(CFLAGS_FSP)

ifeq ($(USE_FSP_QSPI), 1)
CFLAGS += -DUSE_FSP_QSPI
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_qspi/r_qspi.c
endif

ifeq ($(USE_FSP_SDHI), 1)
CFLAGS += -DUSE_FSP_SDHI
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_sdhi/r_sdhi.c \
$(HAL_DIR)/ra/fsp/src/r_dtc/r_dtc.c
endif

ifeq ($(USE_FSP_LPM), 1)
CFLAGS += -DUSE_FSP_LPM
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_lpm/r_lpm.c
Expand All @@ -377,16 +368,17 @@ HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_lp/r_flash_lp.c
endif
endif

ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2))
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2 RA6M5))
ifeq ($(USE_FSP_FLASH), 1)
CFLAGS += -DUSE_FSP_FLASH
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_hp/r_flash_hp.c
endif
endif

ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M5))
HAL_SRC_C += $(addprefix ra/,\
ra_adc.c \
ra_dac.c \
ra_flash.c \
ra_gpio.c \
ra_i2c.c \
Expand All @@ -397,6 +389,7 @@ HAL_SRC_C += $(addprefix ra/,\
ra_sci.c \
ra_spi.c \
ra_timer.c \
ra_gpt.c \
ra_utils.c \
)

Expand All @@ -413,6 +406,12 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_O))
OBJ += $(BUILD)/pins_$(BOARD).o

ifeq ($(CMSIS_MCU),RA6M5)
$(BUILD)/shared/runtime/gchelper_thumb2.o: $(TOP)/shared/runtime/gchelper_thumb2.s
$(ECHO) "AS $<"
$(Q)$(AS) $(ASFLAGS) -o $@ $<
endif

# This file contains performance critical functions so turn up the optimisation
# level. It doesn't add much to the code size and improves performance a bit.
# Don't use -O3 with this file because gcc tries to optimise memset in terms of itself.
Expand Down Expand Up @@ -486,6 +485,9 @@ endif
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M2))
AF_FILE = boards/ra6m2_af.csv
endif
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M5))
AF_FILE = boards/ra6m5_af.csv
endif
GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
Expand Down
7 changes: 6 additions & 1 deletion ports/renesas-ra/RA4M1_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
// #include "hal_data.h"
#include "bsp_api.h"
#include "common_data.h"
#if defined(USE_DBG_PRINT)
#include RA_CFG_H
#endif

#define SCI_CH 0
#define SCI_CH DEFAULT_DBG_CH
#define SCI_BAUD 115200
#define UART_CH SCI_CH
#define UART_TxStr sci_tx_str
Expand All @@ -56,8 +59,10 @@

#include "ra_config.h"
#include "ra_adc.h"
#include "ra_dac.h"
#include "ra_flash.h"
#include "ra_gpio.h"
#include "ra_gpt.h"
#include "ra_i2c.h"
#include "ra_icu.h"
#include "ra_init.h"
Expand Down
7 changes: 6 additions & 1 deletion ports/renesas-ra/RA4W1_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
// #include "hal_data.h"
#include "bsp_api.h"
#include "common_data.h"
#if defined(USE_DBG_PRINT)
#include RA_CFG_H
#endif

#define SCI_CH 0
#define SCI_CH DEFAULT_DBG_CH
#define SCI_BAUD 115200
#define UART_CH SCI_CH
#define UART_TxStr sci_tx_str
Expand All @@ -56,8 +59,10 @@

#include "ra_config.h"
#include "ra_adc.h"
#include "ra_dac.h"
#include "ra_flash.h"
#include "ra_gpio.h"
#include "ra_gpt.h"
#include "ra_i2c.h"
#include "ra_icu.h"
#include "ra_init.h"
Expand Down
7 changes: 6 additions & 1 deletion ports/renesas-ra/RA6M1_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
// #include "hal_data.h"
#include "bsp_api.h"
#include "common_data.h"
#if defined(USE_DBG_PRINT)
#include RA_CFG_H
#endif

#define SCI_CH 0
#define SCI_CH DEFAULT_DBG_CH
#define SCI_BAUD 115200
#define UART_CH SCI_CH
#define UART_TxStr sci_tx_str
Expand All @@ -56,8 +59,10 @@

#include "ra_config.h"
#include "ra_adc.h"
#include "ra_dac.h"
#include "ra_flash.h"
#include "ra_gpio.h"
#include "ra_gpt.h"
#include "ra_i2c.h"
#include "ra_icu.h"
#include "ra_init.h"
Expand Down
7 changes: 6 additions & 1 deletion ports/renesas-ra/RA6M2_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@
// #include "hal_data.h"
#include "bsp_api.h"
#include "common_data.h"
#if defined(USE_DBG_PRINT)
#include RA_CFG_H
#endif

#define SCI_CH 0
#define SCI_CH DEFAULT_DBG_CH
#define SCI_BAUD 115200
#define UART_CH SCI_CH
#define UART_TxStr sci_tx_str
Expand All @@ -56,8 +59,10 @@

#include "ra_config.h"
#include "ra_adc.h"
#include "ra_dac.h"
#include "ra_flash.h"
#include "ra_gpio.h"
#include "ra_gpt.h"
#include "ra_i2c.h"
#include "ra_icu.h"
#include "ra_init.h"
Expand Down
109 changes: 109 additions & 0 deletions ports/renesas-ra/RA6M5_hal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021 Renesas Electronics Corporation
* Copyright (c) 2023 Vekatech Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef PORTS_RA_RA6M5_HAL_H_
#define PORTS_RA_RA6M5_HAL_H_

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
// #include "hal_data.h"
#include "bsp_api.h"
#include "common_data.h"
#if defined(USE_DBG_PRINT)
#include RA_CFG_H
#endif

#define SCI_CH DEFAULT_DBG_CH
#define SCI_BAUD 115200
#define UART_CH SCI_CH
#define UART_TxStr sci_tx_str
#define PCLK 100000000

#define RA_PRI_SYSTICK (0)
#define RA_PRI_UART (1)
#define RA_PRI_SDIO (4)
#define RA_PRI_DMA (5)
#define RA_PRI_FLASH (6)
#define RA_PRI_OTG_FS (6)
#define RA_PRI_OTG_HS (6)
#define RA_PRI_TIM5 (6)
#define RA_PRI_CAN (7)
#define RA_PRI_SPI (8)
#define RA_PRI_I2C (8)
#define RA_PRI_TIMX (13)
#define RA_PRI_EXTINT (14)
#define RA_PRI_PENDSV (15)
#define RA_PRI_RTC_WKUP (15)

#include "ra_config.h"
#include "ra_adc.h"
#include "ra_dac.h"
#include "ra_flash.h"
#include "ra_gpio.h"
#include "ra_gpt.h"
#include "ra_i2c.h"
#include "ra_icu.h"
#include "ra_init.h"
#include "ra_int.h"
#include "ra_rtc.h"
#include "ra_sci.h"
#include "ra_spi.h"
#include "ra_timer.h"
#include "ra_utils.h"

typedef enum {
HAL_OK = 0x00,
HAL_ERROR = 0x01,
HAL_BUSY = 0x02,
HAL_TIMEOUT = 0x03
} HAL_StatusTypeDef;

#define __IO volatile

#if defined(USE_DBG_PRINT)
#if !defined(DEBUG_CH)
#define DEBUG_CH SCI_CH
#endif
#if (DEBUG_CH == 6)
#define DEBUG_TX_PIN P506
#define DEBUG_RX_PIN P505
#endif
#if (DEBUG_CH == 7)
#define DEBUG_TX_PIN P613
#define DEBUG_RX_PIN P614
#endif
#if (DEBUG_CH == 9)
#define DEBUG_TX_PIN P109
#define DEBUG_RX_PIN P110
#endif
#define DEBUG_TXSTR(s) ra_sci_tx_str(DEBUG_CH, (unsigned char *)s)
#define DEBUG_TXCH(c) ra_sci_tx_ch(DEBUG_CH, c)
#else
#define DEBUG_TXSTR(s)
#define DEBUG_TXCH(c)
#endif

#endif /* PORTS_RA_RA6M5_HAL_H_ */
6 changes: 3 additions & 3 deletions ports/renesas-ra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Currently supported features are:
- Filesystem on the internal flash using FatFs.
- `time` module with sleep, time, and ticks functions.
- `os` module with VFS support.
- `machine` module with the following classes: `Pin`, `ADC`, `I2C`, `SPI`,
`SoftI2C`, `SoftSPI`, `UART`, `RTC`
- sdcard driver if frozen driver is installed.
- `machine` module with the following classes: `Pin`, `ADC`, `PWM`, `DAC`, `I2C`,
`SPI`, `SoftI2C`, `SoftSPI`, `UART`, `RTC`, `SDCard`.
- `sdcard` module for MCUs without native `machine.SDCard` support.

Currently supported board product names are:

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy