Skip to content

Commit 2646120

Browse files
committed
ports/renesas-ra: Add Ehternet support for VK-RA6M5.
Signed-off-by: mbedNoobNinja <novoltage@gmail.com>
1 parent 05cb140 commit 2646120

26 files changed

+1007
-21
lines changed

ports/renesas-ra/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ include ../../py/mkenv.mk
2424
include $(BOARD_DIR)/mpconfigboard.mk
2525

2626
USE_FSP_LPM ?= 1
27+
USE_FSP_OSPI ?= 0
2728
USE_FSP_QSPI ?= 0
29+
USE_FSP_SDHI ?= 0
30+
USE_FSP_ETH ?= 0
2831
FSP_BOARD_NAME ?= $(shell echo $(BOARD) | tr '[:upper:]' '[:lower:]')
2932

3033
# Files that are generated and needed before the QSTR build.
@@ -328,6 +331,8 @@ SRC_C += \
328331
machine_rtc.c \
329332
machine_sdcard.c \
330333
modmachine.c \
334+
network_lan.c \
335+
eth.c \
331336
extint.c \
332337
usrsw.c \
333338
flash.c \
@@ -385,6 +390,11 @@ HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/fsp/src/,\
385390
CFLAGS_FSP = -Wno-unused-variable -Wno-unused-function
386391
$(BUILD)/lib/fsp/ra/fsp/src/r_sci_uart/r_sci_uart.o: CFLAGS += $(CFLAGS_FSP)
387392

393+
ifeq ($(USE_FSP_OSPI), 1)
394+
CFLAGS += -DUSE_FSP_OSPI
395+
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_ospi/r_ospi.c
396+
endif
397+
388398
ifeq ($(USE_FSP_QSPI), 1)
389399
CFLAGS += -DUSE_FSP_QSPI
390400
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_qspi/r_qspi.c
@@ -396,6 +406,13 @@ HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_sdhi/r_sdhi.c \
396406
$(HAL_DIR)/ra/fsp/src/r_dtc/r_dtc.c
397407
endif
398408

409+
ifeq ($(USE_FSP_ETH), 1)
410+
CFLAGS += -DUSE_FSP_ETH
411+
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_ether_phy/targets/ICS1894/r_ether_phy_target_ics1894.c \
412+
$(HAL_DIR)/ra/fsp/src/r_ether_phy/r_ether_phy.c \
413+
$(HAL_DIR)/ra/fsp/src/r_ether/r_ether.c
414+
endif
415+
399416
ifeq ($(USE_FSP_LPM), 1)
400417
CFLAGS += -DUSE_FSP_LPM
401418
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_lpm/r_lpm.c
@@ -432,7 +449,10 @@ HAL_SRC_C += $(addprefix ra/,\
432449
ra_gpt.c \
433450
ra_utils.c \
434451
)
452+
endif
435453

454+
ifeq ($(MICROPY_SSL_MBEDTLS),1)
455+
LIB_SRC_C += mbedtls/mbedtls_port.c
436456
endif
437457

438458
ifeq ($(MICROPY_HW_ENABLE_RNG),1)

ports/renesas-ra/boards/VK_RA6M5/board.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,21 @@
22
"deploy": [
33
"../deploy.md"
44
],
5-
"docs": "",
5+
"docs": "https://vekatech.com/VK-RA6M5_docs/brochures/VK-RA6M5%20Flyer%20R2.pdf",
66
"features": [
7-
"DAC"
7+
"DAC",
8+
"USB",
9+
"microSD",
10+
"Ethernet",
11+
"External RAM",
12+
"External Flash"
813
],
914
"images": [
1015
"VK-RA6M5.jpg"
1116
],
1217
"mcu": "ra6m5",
1318
"product": "VK-RA6M5",
1419
"thumbnail": "",
15-
"url": "https://vekatech.com/VK-RA6M5_docs/brochures/VK-RA6M5%20Flyer%20R2.pdf",
20+
"url": "https://vekatech.com",
1621
"vendor": "Vekatech"
1722
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include("$(PORT_DIR)/boards/manifest.py")
2+
# Networking
3+
require("bundle-networking")

ports/renesas-ra/boards/VK_RA6M5/mpconfigboard.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@
1010
#define MICROPY_PY_BUILTINS_COMPLEX (1)
1111
#define MICROPY_PY_GENERATOR_PEND_THROW (1)
1212
#define MICROPY_PY_MATH (1)
13-
#define MICROPY_PY_UHEAPQ (1)
14-
#define MICROPY_PY_UTIMEQ (1)
13+
#define MICROPY_PY_HEAPQ (1)
1514
#define MICROPY_PY_THREAD (0) // disable ARM_THUMB_FP using vldr due to RA has single float only
15+
#define MICROPY_HW_ETH_MDC (1)
16+
#define MICROPY_PY_NETWORK (1)
17+
#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT MICROPY_HW_BOARD_NAME
1618

1719
// peripheral config
20+
#define MICROPY_HW_ENABLE_RNG (1)
1821
#define MICROPY_HW_ENABLE_RTC (1)
1922
#define MICROPY_HW_RTC_SOURCE (1) // 0: subclock
2023
#define MICROPY_HW_ENABLE_ADC (1)
2124
#define MICROPY_HW_HAS_FLASH (1)
25+
#define MICROPY_HW_ENABLE_USBDEV (1)
26+
#define MICROPY_HW_ENABLE_UART_REPL (1)
2227
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
2328
#define MICROPY_HW_HAS_QSPI_FLASH (1)
2429
#define MICROPY_HW_HAS_SDHI_CARD (1)
30+
#define MICROPY_HW_HAS_OSPI_RAM (1)
2531

2632
// board config
2733

ports/renesas-ra/boards/VK_RA6M5/mpconfigboard.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,22 @@ CMSIS_MCU = RA6M5
22
MCU_SERIES = m33
33
LD_FILES = boards/VK_RA6M5/vk_ra6m5.ld
44

5+
CFLAGS += -DCFG_TUH_MAX_SPEED=OPT_MODE_HIGH_SPEED \
6+
-DCFG_TUD_MAX_SPEED=OPT_MODE_FULL_SPEED \
7+
-DCFG_TUSB_RHPORT0_MODE=OPT_MODE_DEVICE \
8+
-DCFG_TUSB_RHPORT1_MODE=0
9+
510
# MicroPython settings
611
MICROPY_VFS_FAT = 1
12+
MICROPY_HW_ENABLE_RNG = 1
13+
MICROPY_PY_LWIP = 1
14+
MICROPY_PY_SSL = 1
15+
MICROPY_SSL_MBEDTLS = 1
716

817
# FSP settings
18+
USE_FSP_OSPI = 1
919
USE_FSP_QSPI = 1
1020
USE_FSP_SDHI = 1
21+
USE_FSP_ETH = 1
1122

1223
CFLAGS+=-DDEFAULT_DBG_CH=9
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* generated configuration header file - do not edit */
2+
#ifndef R_OSPI_CFG_H_
3+
#define R_OSPI_CFG_H_
4+
#ifdef __cplusplus
5+
extern "C" {

ports/renesas-ra/boards/VK_RA6M5/ra_cfg/fsp_cfg/bsp/bsp_mcu_family_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ extern "C" {
7777
(((RA_NOT_DEFINED > 0) ? 0U : 1U) << 2) /* CAN0 */ | \
7878
(((RA_NOT_DEFINED > 0) ? 0U : 1U) << 8) /* IIC1 */ | \
7979
(((RA_NOT_DEFINED > 0) ? 0U : 1U) << 9) /* IIC0 */ | \
80-
(((RA_NOT_DEFINED > 0) ? 0U : 1U) << 11) /* USBFS */ | \
80+
(((1 > 0) ? 0U : 1U) << 11) /* USBFS */ | \
8181
(((RA_NOT_DEFINED > 0) ? 0U : 1U) << 18) /* SPI1 */ | \
8282
(((1 > 0) ? 0U : 1U) << 19) /* SPI0 */ | \
8383
(((1 > 0) ? 0U : 1U) << 22) /* SCI9 */ | \

ports/renesas-ra/boards/VK_RA6M5/ra_gen/bsp_clock_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define BSP_CFG_CLKOUT_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* CLKOUT Disabled */
1616
#define BSP_CFG_UCK_SOURCE (BSP_CLOCKS_SOURCE_CLOCK_PLL2) /* UCLK Src: PLL2 */
1717
#define BSP_CFG_U60CK_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* U60CK Disabled */
18-
#define BSP_CFG_OCTA_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* OCTASPICLK Disabled */
18+
#define BSP_CFG_OCTA_SOURCE (BSP_CLOCKS_SOURCE_CLOCK_PLL) /* OCTASPICLK Src: PLL */
1919
#define BSP_CFG_CANFDCLK_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* CANFDCLK Disabled */
2020
#define BSP_CFG_CECCLK_SOURCE (BSP_CLOCKS_CLOCK_DISABLED) /* CECCLK Disabled */
2121
#define BSP_CFG_ICLK_DIV (BSP_CLOCKS_SYS_CLOCK_DIV_1) /* ICLK Div /1 */

ports/renesas-ra/boards/VK_RA6M5/ra_gen/common_data.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/* generated common source file - do not edit */
22
#include "common_data.h"
3+
sce_instance_ctrl_t sce_ctrl;
4+
const sce_cfg_t sce_cfg = { .lifecycle = SCE_SSD };
5+
#if SCE_USER_SHA_384_ENABLED
6+
uint32_t SCE_USER_SHA_384_FUNCTION(uint8_t *message, uint8_t *digest, uint32_t message_length);
7+
#endif
38
icu_instance_ctrl_t g_external_irq14_ctrl;
49
const external_irq_cfg_t g_external_irq14_cfg = { .channel = 14, .trigger =
510
EXTERNAL_IRQ_TRIG_RISING, .filter_enable = false, .pclk_div =

ports/renesas-ra/boards/VK_RA6M5/ra_gen/common_data.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#define COMMON_DATA_H_
44
#include <stdint.h>
55
#include "bsp_api.h"
6+
#include "r_sce.h"
67
#include "r_icu.h"
78
#include "r_external_irq_api.h"
89
#include "r_ioport.h"
910
#include "bsp_pin_cfg.h"
1011
FSP_HEADER
12+
extern sce_instance_ctrl_t sce_ctrl;
13+
extern const sce_cfg_t sce_cfg;
1114
/** External IRQ on ICU Instance. */
1215
extern const external_irq_instance_t g_external_irq14;
1316

0 commit comments

Comments
 (0)
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