8000 ports/renesas-ra/boards/VK-RA6M3: New Board. · micropython/micropython@29445de · GitHub
[go: up one dir, main page]

Skip to content

Commit 29445de

Browse files
committed
ports/renesas-ra/boards/VK-RA6M3: New Board.
ports/renesas-ra/boards: New processor RA6M3. ports/renesas-ra: Integration to the existing RA family. Signed-off-by: mbedNoobNinja <novoltage@gmail.com>
1 parent 850f09b commit 29445de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+7441
-33
lines changed

ports/renesas-ra/Makefile

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ CMSIS_MCU_CAP = RA6M2
4545
USE_FSP_LPM = 1
4646
endif
4747

48+
ifeq ($(BOARD),VK_RA6M3)
49+
BOARD_LOW = vk_ra6m3
50+
CMSIS_MCU_LOW = ra6m3
51+
CMSIS_MCU_CAP = RA6M3
52+
USE_FSP_LPM = 1
53+
endif
54+
4855
# select use wrapper function of FSP library
4956
USE_FSP_FLASH = 1
5057

@@ -93,7 +100,7 @@ INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/api
93100
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/instances
94101
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include
95102
#INC += -Ilwip_inc
96-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
103+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M3))
97104
INC += -Ira
98105
endif
99106
INC += -I$(BOARD_DIR)/ra_gen
@@ -102,7 +109,11 @@ INC += -I$(BOARD_DIR)/ra_cfg/fsp_cfg/bsp
102109
INC += -Idebug
103110

104111
CFLAGS += -D$(CMSIS_MCU)
112+
ifeq ($(BOARD),$(filter $(BOARD),VK_RA4W1 VK_RA6M3))
113+
CFLAGS += -DRA_HAL_H='<VK_$(CMSIS_MCU)_hal.h>'
114+
else
105115
CFLAGS += -DRA_HAL_H='<$(CMSIS_MCU)_hal.h>'
116+
endif
106117

107118
# Basic Cortex-M flags
108119
CFLAGS_CORTEX_M = -mthumb
@@ -120,6 +131,7 @@ CFLAGS_MCU_RA4M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
120131
CFLAGS_MCU_RA4W1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
121132
CFLAGS_MCU_RA6M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
122133
CFLAGS_MCU_RA6M2 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
134+
CFLAGS_MCU_RA6M3 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
123135

124136
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
125137
#CFLAGS += -D$(CMSIS_MCU)
@@ -322,6 +334,11 @@ SRC_C += \
322334
$(BOARD_DIR)/src/hal_entry.c \
323335
$(wildcard $(BOARD_DIR)/*.c)
324336

337+
ifeq ($(BOARD),$(filter $(BOARD),VK_RA4W1 VK_RA6M3))
338+
SRC_C += \
339+
machine_dac.c
340+
endif
341+
325342
SRC_C += $(addprefix $(BOARD_DIR)/ra_gen/,\
326343
common_data.c \
327344
hal_data.c \
@@ -337,10 +354,12 @@ SRC_O += \
337354
SRC_O += \
338355
shared/runtime/gchelper_thumb2.o
339356

357+
ifneq ($(BOARD),$(filter $(BOARD),VK_RA4W1 VK_RA6M3))
340358
HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/board/$(BOARD_LOW)/,\
341359
board_init.c \
342360
board_leds.c \
343361
)
362+
endif
344363

345364
HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/fsp/src/bsp/mcu/all/,\
346365
bsp_clocks.c \
@@ -372,14 +391,14 @@ HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_lp/r_flash_lp.c
372391
endif
373392
endif
374393

375-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2))
394+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2 RA6M3))
376395
ifeq ($(USE_FSP_FLASH), 1)
377396
CFLAGS += -DUSE_FSP_FLASH
378397
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_hp/r_flash_hp.c
379398
endif
380399
endif
381400

382-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
401+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M3))
383402
HAL_SRC_C += $(addprefix ra/,\
384403
ra_adc.c \
385404
ra_flash.c \
@@ -397,6 +416,13 @@ HAL_SRC_C += $(addprefix ra/,\
397416

398417
endif
399418

419+
ifeq ($(BOARD),$(filter $(BOARD),VK_RA4W1 VK_RA6M3))
420+
HAL_SRC_C += $(addprefix ra/,\
421+
ra_gpt.c \
422+
ra_dac.c \
423+
)
424+
endif
425+
400426
OBJ += $(PY_O)
401427
OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
402428
OBJ += $(LIBM_O)
@@ -494,6 +520,9 @@ endif
494520
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M2))
495521
AF_FILE = boards/ra6m2_af.csv
496522
endif
523+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M3))
524+
AF_FILE = boards/ra6m3_af.csv
525+
endif
497526
GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c
498527
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
499528
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h

ports/renesas-ra/VK_RA6M3_hal.h

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021 Renesas Electronics Corporation
5+
* Copyright (c) 2023 Vekatech Ltd.
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
26+
#ifndef PORTS_RA_RA6M3_HAL_H_
27+
#define PORTS_RA_RA6M3_HAL_H_
28+
29+
#include <stdio.h>
30+
#include <stdint.h>
31+
#include <stdbool.h>
32+
// #include "hal_data.h"
33+
#include "bsp_api.h"
34+
#include "common_data.h"
35+
36+
#define SCI_CH 9
37+
#define SCI_BAUD 115200
38+
#define UART_CH SCI_CH
39+
#define UART_TxStr sci_tx_str
40+
#define PCLK 120000000
41+
42+
#define RA_PRI_SYSTICK (0)
43+
#define RA_PRI_UART (1)
44+
#define RA_PRI_SDIO (4)
45+
#define RA_PRI_DMA (5)
46+
#define RA_PRI_FLASH (6)
47+
#define RA_PRI_OTG_FS (6)
48+
#define RA_PRI_OTG_HS (6)
49+
#define RA_PRI_TIM5 (6)
50+
#define RA_PRI_CAN (7)
51+
#define RA_PRI_SPI (8)
52+
#define RA_PRI_I2C (8)
53+
#define RA_PRI_TIMX (13)
54+
#define RA_PRI_EXTINT (14)
55+
#define RA_PRI_PENDSV (15)
56+
#define RA_PRI_RTC_WKUP (15)
57+
58+
#include "ra_config.h"
59+
#include "ra_adc.h"
60+
#include "ra_dac.h"
61+
#include "ra_flash.h"
62+
#include "ra_gpio.h"
63+
#include "ra_gpt.h"
64+
#include "ra_i2c.h"
65+
#include "ra_icu.h"
66+
#include "ra_init.h"
67+
#include "ra_int.h"
68+
#include "ra_rtc.h"
69+
#include "ra_sci.h"
70+
#include "ra_spi.h"
71+
#include "ra_timer.h"
72+
#include "ra_utils.h"
73+
74+
typedef enum {
75+
HAL_OK = 0x00,
76+
HAL_ERROR = 0x01,
77+
HAL_BUSY = 0x02,
78+
HAL_TIMEOUT = 0x03
79+
} HAL_StatusTypeDef;
80+
81+
#define __IO volatile
82+
83+
#if defined(USE_DBG_PRINT)
84+
#if !defined(DEBUG_CH)
85+
#define DEBUG_CH SCI_CH
86+
#endif
87+
#if (DEBUG_CH == 7)
88+
#define DEBUG_TX_PIN P613
89+
#define DEBUG_RX_PIN P614
90+
#endif
91+
#if (DEBUG_CH == 8)
92+
#define DEBUG_TX_PIN P105
93+
#define DEBUG_RX_PIN P104
94+
#endif
95+
#if (DEBUG_CH == 9)
96+
#define DEBUG_TX_PIN P109
97+
#define DEBUG_RX_PIN P110
98+
#endif
99+
#define DEBUG_TXSTR(s) ra_sci_tx_str(DEBUG_CH, (unsigned char *)s)
100+
#define DEBUG_TXCH(c) ra_sci_tx_ch(DEBUG_CH, c)
101+
#else
102+
#define DEBUG_TXSTR(s)
103+
#define DEBUG_TXCH(c)
104+
#endif
105+
106+
#endif /* PORTS_RA_RA6M3_HAL_H_ */

0 commit comments

Comments
 (0)
0