Skip to content

Commit 406d404

Browse files
committed
ports/renesas-ra/boards/VK-RA6M5: New Board.
ports/renesas-ra/boards: New processor RA6M5. ports/renesas-ra: Integration to the existing RA family. Signed-off-by: mbedNoobNinja <novoltage@gmail.com>
1 parent 0acc733 commit 406d404

Some content is hidden

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

75 files changed

+5161
-244
lines changed

ports/renesas-ra/Makefile

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,48 +16,17 @@ endif
1616
# If the build directory is not given, make it reflect the board name.
1717
BUILD ?= build-$(BOARD)
1818

19-
ifeq ($(BOARD),RA4M1_CLICKER)
20-
BOARD_LOW = ra4m1_ek
21-
CMSIS_MCU_LOW = ra4m1
22-
CMSIS_MCU_CAP = RA4M1
23-
USE_FSP_LPM = 0
24-
endif
25-
26-
ifeq ($(BOARD),RA4M1_EK)
27-
BOARD_LOW = ra4m1_ek
28-
CMSIS_MCU_LOW = ra4m1
29-
CMSIS_MCU_CAP = RA4M1
30-
USE_FSP_LPM = 0
31-
endif
32-
33-
ifeq ($(BOARD),RA4W1_EK)
34-
BOARD_LOW = ra4w1_ek
35-
CMSIS_MCU_LOW = ra4w1
36-
CMSIS_MCU_CAP = RA4W1
37-
USE_FSP_LPM = 1
38-
endif
39-
40-
ifeq ($(BOARD),RA6M1_EK)
41-
BOARD_LOW = ra6m1_ek
42-
CMSIS_MCU_LOW = ra6m1
43-
CMSIS_MCU_CAP = RA6M1
44-
USE_FSP_LPM = 1
45-
endif
46-
47-
ifeq ($(BOARD),RA6M2_EK)
48-
BOARD_LOW = ra6m2_ek
49-
CMSIS_MCU_LOW = ra6m2
50-
CMSIS_MCU_CAP = RA6M2
51-
USE_FSP_LPM = 1
52-
endif
53-
5419
# select use wrapper function of FSP library
5520
USE_FSP_FLASH = 1
5621

5722
include ../../py/mkenv.mk
5823
-include mpconfigport.mk
5924
include $(BOARD_DIR)/mpconfigboard.mk
6025

26+
USE_FSP_LPM ?= 1
27+
FSP_BOARD_NAME ?= $(shell echo $(BOARD) | tr '[:upper:]' '[:lower:]')
28+
EXPECTED_FSP_HASH ?= $(patsubst +%,%,$(shell git -C ../.. submodule status --cached lib/fsp))
29+
6130
# Files that are generated and needed before the QSTR build.
6231
#QSTR_GENERATED_HEADERS = $(BUILD)/pins_qstr.h $(BUILD)/modstm_qstr.h
6332
QSTR_GENERATED_HEADERS = $(BUILD)/pins_qstr.h
@@ -99,7 +68,7 @@ INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/api
9968
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/inc/instances
10069
INC += -I$(TOP)/$(HAL_DIR)/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include
10170
#INC += -Ilwip_inc
102-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
71+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M3 RA6M5))
10372
INC += -Ira
10473
endif
10574
INC += -I$(BOARD_DIR)/ra_gen
@@ -109,6 +78,7 @@ INC += -Idebug
10978

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

11383
# Basic Cortex-M flags
11484
CFLAGS_CORTEX_M = -mthumb
@@ -121,12 +91,20 @@ CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard
12191
SUPPORTS_HARDWARE_FP_SINGLE = 1
12292
endif
12393

94+
ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),m33))
95+
CFLAGS_CORTEX_M += -mfpu=fpv5-sp-d16 -mfloat-abi=hard
96+
SUPPORTS_HARDWARE_FP_SINGLE = 1
97+
endif
98+
12499
# Options for particular MCU series
125100
CFLAGS_MCU_RA4M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
126101
CFLAGS_MCU_RA4W1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
127102
CFLAGS_MCU_RA6M1 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
128103
CFLAGS_MCU_RA6M2 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
104+
CFLAGS_MCU_RA6M3 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4
105+
CFLAGS_MCU_RA6M5 = $(CFLAGS_CORTEX_M) -mtune=cortex-m33 -mcpu=cortex-m33
129106

107+
ASFLAGS += $(CFLAGS_CORTEX_M) -mcpu=cortex-$(MCU_SERIES)
130108
CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_EXTRA)
131109
#CFLAGS += -D$(CMSIS_MCU)
132110
CFLAGS += $(CFLAGS_MCU_$(CMSIS_MCU))
@@ -312,6 +290,7 @@ SRC_C += \
312290
gccollect.c \
313291
help.c \
314292
machine_adc.c \
293+
machine_dac.c \
315294
machine_i2c.c \
316295
machine_spi.c \
317296
machine_uart.c \
@@ -343,10 +322,13 @@ SRC_O += \
343322
SRC_O += \
344323
shared/runtime/gchelper_thumb2.o
345324

346-
HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/board/$(BOARD_LOW)/,\
325+
FSP_BOARD_DIR = $(HAL_DIR)/ra/board/$(FSP_BOARD_NAME)
326+
ifneq ($(wildcard $(TOP)/$(FSP_BOARD_DIR)/.),)
327+
HAL_SRC_C += $(addprefix $(FSP_BOARD_DIR)/,\
347328
board_init.c \
348329
board_leds.c \
349330
)
331+
endif
350332

351333
HAL_SRC_C += $(addprefix $(HAL_DIR)/ra/fsp/src/bsp/mcu/all/,\
352334
bsp_clocks.c \
@@ -378,16 +360,17 @@ HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_lp/r_flash_lp.c
378360
endif
379361
endif
380362

381-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2))
363+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M1 RA6M2 RA6M3 RA6M5))
382364
ifeq ($(USE_FSP_FLASH), 1)
383365
CFLAGS += -DUSE_FSP_FLASH
384366
HAL_SRC_C += $(HAL_DIR)/ra/fsp/src/r_flash_hp/r_flash_hp.c
385367
endif
386368
endif
387369

388-
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2))
370+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA4M1 RA4W1 RA6M1 RA6M2 RA6M3 RA6M5))
389371
HAL_SRC_C += $(addprefix ra/,\
390372
ra_adc.c \
373+
ra_dac.c \
391374
ra_flash.c \
392375
ra_gpio.c \
393376
ra_i2c.c \
@@ -398,6 +381,7 @@ HAL_SRC_C += $(addprefix ra/,\
398381
ra_sci.c \
399382
ra_spi.c \
400383
ra_timer.c \
384+
ra_gpt.c \
401385
ra_utils.c \
402386
)
403387

@@ -414,6 +398,12 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o))
414398
OBJ += $(addprefix $(BUILD)/, $(SRC_O))
415399
OBJ += $(BUILD)/pins_$(BOARD).o
416400

401+
ifeq ($(CMSIS_MCU),RA6M5)
402+
$(BUILD)/shared/runtime/gchelper_thumb2.o: $(TOP)/shared/runtime/gchelper_thumb2.s
403+
$(ECHO) "AS $<"
404+
$(Q)$(AS) $(ASFLAGS) -o $@ $<
405+
endif
406+
417407
# This file contains performance critical functions so turn up the optimisation
418408
# level. It doesn't add much to the code size and improves performance a bit.
419409
# Don't use -O3 with this file because gcc tries to optimise memset in terms of itself.
@@ -436,6 +426,20 @@ $(TOP)/lib/fsp/README.md:
436426
$(ECHO) "fsp submodule not found, fetching it now..."
437427
(cd $(TOP) && git submodule update --init lib/fsp)
438428

429+
CURRENT_FSP_HASH = $(patsubst +%,%,$(shell git -C $(TOP) submodule status lib/fsp))
430+
CHECK_FSP_VER:
431+
ifneq ($(CURRENT_FSP_HASH),$(EXPECTED_FSP_HASH))
432+
ifeq ($(CMSIS_MCU),RA6M5)
433+
$(ECHO) "Upgrading FSP to version supporting $(CMSIS_MCU) ... $(lastword $(EXPECTED_FSP_HASH))"
434+
@git -C $(TOP)/lib/fsp checkout $(firstword $(EXPECTED_FSP_HASH))
435+
else
436+
$(ECHO) "Reverting FSP to expected version ... $(lastword $(EXPECTED_FSP_HASH))"
437+
@git -C $(TOP) submodule update --checkout lib/fsp
438+
endif
439+
else
440+
$(ECHO) "Working with FSP $(lastword $(CURRENT_FSP_HASH))"
441+
endif
442+
439443
ifneq ($(FROZEN_MANIFEST)$(FROZEN_DIR),)
440444
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
441445
# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch).
@@ -500,6 +504,12 @@ endif
500504
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M2))
501505
AF_FILE = boards/ra6m2_af.csv
502506
endif
507+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M3))
508+
AF_FILE = boards/ra6m3_af.csv
509+
endif
510+
ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),RA6M5))
511+
AF_FILE = boards/ra6m5_af.csv
512+
endif
503513
GEN_PINS_SRC = $(BUILD)/pins_$(BOARD).c
504514
GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
505515
GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
@@ -518,7 +528,7 @@ SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C)
518528
# any of the objects. The normal dependency generation will deal with the
519529
# case when pins.h is modified. But when it doesn't exist, we don't know
520530
# which source files might need it.
521-
$(OBJ): | $(GEN_PINS_HDR)
531+
$(OBJ): | CHECK_FSP_VER $(GEN_PINS_HDR)
522532

523533
# With conditional pins, we may need to regenerate qstrdefs.h when config
524534
# options change.

ports/renesas-ra/RA4M1_hal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
// #include "hal_data.h"
3232
#include "bsp_api.h"
3333
#include "common_data.h"
34+
#if defined(USE_DBG_PRINT)
35+
#include RA_CFG_H
36+
#endif
3437

35-
#define SCI_CH 0
38+
#define SCI_CH DEFAULT_DBG_CH
3639
#define SCI_BAUD 115200
3740
#define UART_CH SCI_CH
3841
#define UART_TxStr sci_tx_str
@@ -56,8 +59,10 @@
5659

5760
#include "ra_config.h"
5861
#include "ra_adc.h"
62+
#include "ra_dac.h"
5963
#include "ra_flash.h"
6064
#include "ra_gpio.h"
65+
#include "ra_gpt.h"
6166
#include "ra_i2c.h"
6267
#include "ra_icu.h"
6368
#include "ra_init.h"

ports/renesas-ra/RA4W1_hal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
// #include "hal_data.h"
3232
#include "bsp_api.h"
3333
#include "common_data.h"
34+
#if defined(USE_DBG_PRINT)
35+
#include RA_CFG_H
36+
#endif
3437

35-
#define SCI_CH 0
38+
#define SCI_CH DEFAULT_DBG_CH
3639
#define SCI_BAUD 115200
3740
#define UART_CH SCI_CH
3841
#define UART_TxStr sci_tx_str
@@ -56,8 +59,10 @@
5659

5760
#include "ra_config.h"
5861
#include "ra_adc.h"
62+
#include "ra_dac.h"
5963
#include "ra_flash.h"
6064
#include "ra_gpio.h"
65+
#include "ra_gpt.h"
6166
#include "ra_i2c.h"
6267
#include "ra_icu.h"
6368
#include "ra_init.h"

ports/renesas-ra/RA6M1_hal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
// #include "hal_data.h"
3232
#include "bsp_api.h"
3333
#include "common_data.h"
34+
#if defined(USE_DBG_PRINT)
35+
#include RA_CFG_H
36+
#endif
3437

35-
#define SCI_CH 0
38+
#define SCI_CH DEFAULT_DBG_CH
3639
#define SCI_BAUD 115200
3740
#define UART_CH SCI_CH
3841
#define UART_TxStr sci_tx_str
@@ -56,8 +59,10 @@
5659

5760
#include "ra_config.h"
5861
#include "ra_adc.h"
62+
#include "ra_dac.h"
5963
#include "ra_flash.h"
6064
#include "ra_gpio.h"
65+
#include "ra_gpt.h"
6166
#include "ra_i2c.h"
6267
#include "ra_icu.h"
6368
#include "ra_init.h"

ports/renesas-ra/RA6M2_hal.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
// #include "hal_data.h"
3232
#include "bsp_api.h"
3333
#include "common_data.h"
34+
#if defined(USE_DBG_PRINT)
35+
#include RA_CFG_H
36+
#endif
3437

35-
#define SCI_CH 0
38+
#define SCI_CH DEFAULT_DBG_CH
3639
#define SCI_BAUD 115200
3740
#define UART_CH SCI_CH
3841
#define UART_TxStr sci_tx_str
@@ -56,8 +59,10 @@
5659

5760
#include "ra_config.h"
5861
#include "ra_adc.h"
62+
#include "ra_dac.h"
5963
#include "ra_flash.h"
6064
#include "ra_gpio.h"
65+
#include "ra_gpt.h"
6166
#include "ra_i2c.h"
6267
#include "ra_icu.h"
6368
#include "ra_init.h"

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