RZ/G2L微处理器配备Cortex®-A55(1.2GHz)CPU、16 位DDR3L/DDR4接口、带Arm®Mali-G31的3D图形加速引擎以及视频编解码器(H.264)。此外,这款微处理器还配备有大量接口,如摄像头输入、显示输出、USB 2.0和千兆以太网,因此特别适用于入门级工业人机界面(HMI)和具有视频功能的嵌入式设备等应用。
点击可查看大图
https://www.renesas.cn/cn/zh/products/microcontrollers-microprocessors/rz-mpus/rzg2l-general-purpose-mpu-dual-core-arm-cortex-a55-cpus-and-single-core-cortex-m33-cpu-3d-graphics-and
在过去的支持中有客户询问关于如何在VLP中添加自己设计的RZ/G2L板子的编译支持,并希望获得样例指导,本文将基于当前最新的VLP3.0.6-update2,将RZ/G2L SMARC EVK虚拟成客户自己的板子oem-rzg2l,一步步指导整个添加过程,并提供完整的sample code。
1. 构建vlp3.0.6-update2的开发环境
mkdir vlp3.0.6-update2
cd vlp3.0.6-update2/
tar xvf ../sdk-flile/vlp3.0.6-update2/RTK0EF0045Z0021AZJ-v3.0.6-update2/rzg_vlp_v3.0.6.tar.gz
patch -p1 < ../../sdk-flile/vlp3.0.6-update2/RTK0EF0045Z0021AZJ-v3.0.6-update2/0001-rz-common-recipes-debian-buster-glibc-update-to-v2.2.patch
patch -p1 < ../../sdk-flile/vlp3.0.6-update2/RTK0EF0045Z0021AZJ-v3.0.6-update2/0001-rz-common-linux-update-linux-kernel-to-the-latest-re.patch
tar xvf ../sdk-flile/vlp3.0.6-update2/RTK0EF0045Z13001ZJ-v1.2.2_EN/meta-rz-features_graphics_v1.2.2.tar.gz
tar xvf ../sdk-flile/vlp3.0.6-update2/RTK0EF0045Z15001ZJ-v1.2.1_EN/meta-rz-features_codec_v1.2.1.tar.gz
至此vlp3.0.6-update2的开发环境构建完毕。
2. 在meta-renesas路径下创建OEM MACHINE的配置文件
cd meta-renesas/
创建oem-rzg2l.conf
cp meta-rzg2l/conf/machine/smarc-rzg2l.conf meta-rzg2l/conf/machine/oem-rzg2l.conf
修改 ./meta-rzg2l/conf/machine/oem-rzg2l.conf:
diff --git a/meta-rzg2l/conf/machine/oem-rzg2l.conf b/meta-
rzg2l/conf/machine/oem-rzg2l.conf
index 49666a8..d78e634 100644
--- a/meta-rzg2l/conf/machine/oem-rzg2l.conf
+++ b/meta-rzg2l/conf/machine/oem-rzg2l.conf
@@ -1,6 +1,6 @@
#@TYPE: Machine
-#@NAME: smarc-rzg2l machine
-#@DESCRIPTION: RZ/G2L SMARC platform
+#@NAME: oem-rzg2l machine
+#@DESCRIPTION: RZ/G2L OEM platform
SOC_FAMILY = "r9a07g044l"
require conf/machine/include/rzg2l-common.inc
@@ -13,8 +13,8 @@ require ${TUNE_CONF}
PREFERRED_PROVIDER_virtual/kernel="linux-renesas"
-UBOOT_CONFIG ??= "smarc-rzg2l"
-UBOOT_CONFIG[smarc-rzg2l] = "smarc-rzg2l_defconfig"
+UBOOT_CONFIG ??= "oem-rzg2l"
+UBOOT_CONFIG[oem-rzg2l] = "oem-rzg2l_defconfig"
EXTRA_IMAGEDEPENDS += " flash-writer"
@@ -25,7 +25,7 @@ PMIC_SUPPORT ?= "1"
# Supported devicetree
KERNEL_DEVICETREE = " \
- renesas/r9a07g044l2-smarc.dtb \
+ renesas/r9a07g044l2-oem.dtb \
"
IMAGE_BOOT_FILES = " \
@@ -37,7 +37,7 @@ IMAGE_BOOT_FILES = " \
bl2_bp-${MACHINE}.srec \
fip-${MACHINE}_pmic.srec \
fip-${MACHINE}.srec \
- Flash_Writer_SCIF_RZG2L_SMARC_PMIC_DDR4_2GB_1PCS.mot \
- Flash_Writer_SCIF_RZG2L_SMARC_DDR4_2GB.mot \
+ Flash_Writer_SCIF_RZG2L_OEM_PMIC_DDR4_2GB_1PCS.mot \
+ Flash_Writer_SCIF_RZG2L_OEM_DDR4_2GB.mot \
"
WIC_INPUT_DEPENDS = "firmware-pack:do_deploy flash-writer:do_deploy"
cp meta-rzg2l/docs/template/conf/smarc-rzg2l/ meta-rzg2l/docs/template/conf/oem-rzg2l
修改./meta-rzg2l/docs/template/conf/oem-rzg2l/site.conf:
-MACHINE ??= "smarc-rzg2l"
+MACHINE ??= "oem-rzg2l"
cp docs/template/conf/smarc-rzg2l docs/template/conf/oem-rzg2l -rf
修改 ./meta-rzg2l/docs/template/conf/oem-rzg2l/site.conf:
-MACHINE ??= "smarc-rzg2l"
+MACHINE ??= "oem-rzg2l"
3. 在README.md文件中添加oem-rzg2l板子的信息
这一步不是必要的,对编译过程没有影响,但是为了方便后续做维护和追踪,还是建议修改:
diff --git a/README.md b/README.md
index 55a1122..7bfc8fd 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Currently the following boards and MPUs are supported:
- Board: HIHOPE-RZG2N / MPU: R8A774B1 (RZG2N)
- Board: HIHOPE-RZG2H / MPU: R8A774E1 (RZG2H)
- Board: RZG2L SMARC Evaluation Kit / MPU: R9A07G044L (RZ/G2L)
+- Board: RZG2L OEM custom board / MPU: R9A07G044L (RZ/G2L)
- Board: RZG2L Development Evaluation Kit / MPU: R9A07G044L (RZ/G2L)
- Board: RZG2LC SMARC Evaluation Kit / MPU: R9A07G044C (RZ/G2LC)
- Board: RZG2LC Development Evaluation Kit / MPU: R9A07G044C (RZ/G2L)
@@ -194,7 +195,7 @@ Currently, there are 2 types of build procedure supported in below description:
|RZ/G2M |rzg2h |hihope-rzg2m |
|RZ/G2N |rzg2h |hihope-rzg2n |
|RZ/G2E |rzg2h |ek874 |
-|RZ/G2L |rzg2l |smarc-rzg2l, rzg2l-dev |
+|RZ/G2L |rzg2l |smarc-rzg2l, rzg2l-dev, oem-rzg2l |
|RZ/G2LC |rzg2l |smarc-rzg2lc, rzg2lc-dev|
|RZ/G2UL |rzg2l |smarc-rzg2ul, rzg2ul-dev|
|RZ/V2L |rzv2l |smarc-rzv2l, rzv2l-dev |
@@ -217,7 +218,7 @@ Currently, there are 2 types of build procedure supported in below description:
* RZ/G2M: hihope-rzg2m
* RZ/G2N: hihope-rzg2n
* RZ/G2E: ek874
-* RZ/G2L: smarc-rzg2l, rzg2l-dev
+* RZ/G2L: smarc-rzg2l, rzg2l-dev, oem-rzg2l
* RZ/G2LC: smarc-rzg2lc, rzg2lc-dev
* RZ/G2UL: smarc-rzg2ul, rzg2ul-dev
* RZ/V2L: smarc-rzv2l, rzv2l-dev
4. 为flash-writer创建客户oem-rzg2l板子的编译支持补丁
git clone https://github.com/renesas-rz/rzg2_flash_writer.git
cd rzg2_flash_writer
git checkout rz_g2l
修改makefile和makefile.linaro为oem-rzg2l板子添加DDR型号的编译支持选择。
diff --git a/makefile b/makefile
index 0d4c834..f6862e1 100644
--- a/makefile
+++ b/makefile
@@ -26,6 +26,24 @@ DEVICE = RZG2L
DDR_TYPE = DDR4
DDR_SIZE = 2GB_1PCS
SWIZZLE = T1BC
+else ifeq ("$(BOARD)", "RZG2L_OEM")
+#--------------------------------------
+# RZ/G2L Oem Custom board
+#--------------------------------------
+FILENAME_ADD = _RZG2L_OEM
+DEVICE = RZG2L
+DDR_TYPE = DDR4
+DDR_SIZE = 2GB
+SWIZZLE = T1C
+else ifeq ("$(BOARD)", "RZG2L_OEM_PMIC")
+#--------------------------------------
+# RZ/G2L Oem PMIC Custom board
+#--------------------------------------
+FILENAME_ADD = _RZG2L_OEM_PMIC
+DEVICE = RZG2L
+DDR_TYPE = DDR4
+DDR_SIZE = 2GB_1PCS
+SWIZZLE = T1BC
else ifeq ("$(BOARD)", "RZG2L_15MMSQ_DEV")
#--------------------------------------
# RZ/G2L 15MMSQ Dev board
diff --git a/makefile.linaro b/makefile.linaro
index 453572f..1a6f61b 100644
--- a/makefile.linaro
+++ b/makefile.linaro
@@ -26,6 +26,24 @@ DEVICE = RZG2L
DDR_TYPE = DDR4
DDR_SIZE = 2GB_1PCS
SWIZZLE = T1BC
+else ifeq ("$(BOARD)", "RZG2L_OEM")
+#--------------------------------------
+# RZ/G2L Oem Custom board
+#--------------------------------------
+FILENAME_ADD = _RZG2L_OEM
+DEVICE = RZG2L
+DDR_TYPE = DDR4
+DDR_SIZE = 2GB
+SWIZZLE = T1C
+else ifeq ("$(BOARD)", "RZG2L_OEM_PMIC")
+#--------------------------------------
+# RZ/G2L Oem PMIC Custom board
+#--------------------------------------
+FILENAME_ADD = _RZG2L_OEM_PMIC
+DEVICE = RZG2L
+DDR_TYPE = DDR4
+DDR_SIZE = 2GB_1PCS
+SWIZZLE = T1BC
else ifeq ("$(BOARD)", "RZG2L_15MMSQ_DEV")
#--------------------------------------
# RZ/G2L 15MMSQ Dev board
--
2.25.1
生成0001-Flash-Writer-add-oem-rzg2l-Custom-board.patch
cp 0001-Flash-Writer-add-oem-rzg2l-Custom-board.patch meta-renesas/meta-rzg2l/recipes-bsp/flash-writer/files/
修改meta-rzg2l/recipes-bsp/flash-writer/flash-writer.bb配方文件,导入0001-Flash-Writer-add-oem-rzg2l-Custom-board.patch,允许选择oem-rzg2l MACHINE时,编译生成客户板子oem-rzg2l的flash-writer固件。
5. 为trusted-firmware-a创建客户oem-rzg2l板子的编译支持补丁
git clone https://github.com/renesas-rz/rzg_trusted-firmware-a
cd rzg_trusted-firmware-a
git checkout v2.9/rzg2
cp plat/renesas/rz/board/smarc_2/ plat/renesas/rz/board/oem_g2l -rf
cp plat/renesas/rz/board/smarc_pmic_2/ plat/renesas/rz/board/oem_pmic_g2l -rf
完成修改后,创建0001-tf-a-add-oem-rzg2l-custom-borad.patch,该补丁支持在trusted-firmware-a中编译出oem-rzg2l板子的固件。
cp 0001-tf-a-add-oem-rzg2l-custom-borad.patch meta-rzg2l/recipes-bsp/trusted-firmware-a/files/
修改meta-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend配方文件,增加选择oem-rzg2l MACHINE时支持0001-tf-a-add-oem-rzg2l-custom-borad.patch的添加和编译:
diff --git a/meta-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend b/meta-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend
index b342698..8cd4c4f 100644
--- a/meta-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend
+++ b/meta-rzg2l/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bbappend
@@ -28,6 +25,10 @@ PMIC_EXTRA_FLAGS_smarc-rzv2l = "BOARD=smarc_pmic_2"
PLATFORM_rzv2l-dev = "v2l"
EXTRA_FLAGS_rzv2l-dev = "BOARD=dev15_4"
+PLATFORM_oem-rzg2l = "g2l"
+EXTRA_FLAGS_oem-rzg2l = "BOARD=oem_g2l"
+PMIC_EXTRA_FLAGS_oem-rzg2l = "BOARD=oem_pmic_g2l"
+
PMIC_BUILD_DIR = "${S}/build_pmic"
FILES_${PN} = "/boot "
Enable trusted-firmware-a recipes build by MACHINE oem-rzg2l:
diff --git a/meta-rz-common/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bb b/meta-rz-common/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bb
index ba16b28..8bd5c0a 100644
--- a/meta-rz-common/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bb
+++ b/meta-rz-common/recipes-bsp/trusted-firmware-a/trusted-firmware-a.bb
@@ -22,7 +22,7 @@ SRCREV = "cc18695622e5637ec70ee3ae8eb5e83b09d13804"
PV = "v2.9+git"
COMPATIBLE_MACHINE_rzg2h = "(ek874|hihope-rzg2m|hihope-rzg2n|hihope-rzg2h)"
-COMPATIBLE_MACHINE_rzg2l = "(smarc-rzg2l|rzg2l-dev|smarc-rzg2lc|rzg2lc-dev|smarc-rzg2ul|rzg2ul-dev|smarc-rzv2l|rzv2l-dev)"
+COMPATIBLE_MACHINE_rzg2l = "(smarc-rzg2l|rzg2l-dev|smarc-rzg2lc|rzg2lc-dev|smarc-rzg2ul|rzg2ul-dev|smarc-rzv2l|rzv2l-dev|oem-rzg2l)"
PLATFORM ?= "rzg"
6. 为u-boot创建客户oem-rzg2l板子的编译支持补丁
cd renesas-u-boot-cip
git checkout v2021.10/rz
cp arch/arm/dts/smarc-rzg2l.dts arch/arm/dts/oem-rzg2l.dts
cp configs/smarc-rzg2l_defconfig configs/oem-rzg2l_defconfig
cp include/configs/smarc-rzg2l.h include/configs/oem-rzg2l.h
完成代码修改,并生成0001-U-Boot-add-oem-rzg2l-custom-board.patch
更多的详细代码修改参见补丁0001-U-Boot-add-oem-rzg2l-custom-board.patch内容。
将补丁拷贝到VLP环境中
cp 0001-U-Boot-add-oem-rzg2l-custom-board.patch meta-rzg2l/recipes-bsp/u-boot/u-boot/
7. 为linux-renesas创建客户oem-rzg2l板子的编译支持补丁
git clone https://github.com/renesas-rz/rz_linux-cip
cd rz_linux-cip
git checkout rz-5.10-cip41
cp arch/arm64/boot/dts/renesas/r9a07g044l2-smarc.dts arch/arm64/boot/dts/renesas/r9a07g044l2-oem.dts
修改arch/arm64/boot/dts/renesas/Makefile
diff --git a/arch/arm64/boot/dts/renesas/Makefile b/arch/arm64/boot/dts/renesas/Makefile
index 0b41c780bb66..f10acb7138af 100644
--- a/arch/arm64/boot/dts/renesas/Makefile
+++ b/arch/arm64/boot/dts/renesas/Makefile
@@ -90,6 +90,7 @@ dtb-$(CONFIG_ARCH_R9A07G043) += r9a07g043u11-dev.dtb
dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044c2-smarc.dtb
dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044c2-dev.dtb
dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044l2-smarc.dtb
+dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044l2-oem.dtb
dtb-$(CONFIG_ARCH_R9A07G044) += r9a07g044l2-dev.dtb
dtb-$(CONFIG_ARCH_R9A07G054) += r9a07g054l2-smarc.dtb
完成代码修改,并生成0001-Kernel-add-oem-rzg2l-custom-board.patch。
更多的详细代码修改参见补丁0001-Kernel-add-oem-rzg2l-custom-board.patch内容。
然后回到vlp3.0.6-update2的开发环境中添加配方文件导入该内核补丁
cd vlp3.0.6-update
mkdir meta-renesas/ meta-rzg2l/recipes-kernel
mkdir meta-renesas/ meta-rzg2l/recipes-kernel/linux
创建linux-renesas_5.10.bbappend配方文件
touch meta-renesas/ meta-rzg2l/recipes-kernel/linux/ linux-renesas_5.10.bbappend
在linux-renesas_5.10.bbappend该配方文件中添加以下内容:
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append = " \
+ file://0001-Kernel-add-RZ-G2L-Low-Cost-Board.patch \
+"
mkdir meta-renesas/meta-rzg2l/recipes-kernel/linux/linux-renesas/
将补丁0001-Kernel-add-oem-rzg2l-custom-board.patch导入VLP中
cp 0001-Kernel-add-oem-rzg2l-custom-board.patch /meta-rzg2l/recipes-kernel/linux
继续修改上一级的配方文件meta-rz-common/recipes-kernel/linux/linux-renesas_5.10.bb修改:
diff --git a/meta-rz-common/recipes-kernel/linux/linux-renesas_5.10.bb b/meta-rz-common/recipes-kernel/linux/linux-renesas_5.10.bb
index cacbe7a..c921e1c 100644
--- a/meta-rz-common/recipes-kernel/linux/linux-renesas_5.10.bb
+++ b/meta-rz-common/recipes-kernel/linux/linux-renesas_5.10.bb
@@ -3,7 +3,7 @@ DESCRIPTION = "Linux kernel for the RZG2 based board"
require recipes-kernel/linux/linux-yocto.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}/:"
-COMPATIBLE_MACHINE_rzg2l = "(smarc-rzg2l|rzg2l-dev|smarc-rzg2lc|rzg2lc-dev|smarc-rzg2ul|rzg2ul-dev|smarc-rzv2l|rzv2l-dev)"
+COMPATIBLE_MACHINE_rzg2l = "(smarc-rzg2l|rzg2l-dev|smarc-rzg2lc|rzg2lc-dev|smarc-rzg2ul|rzg2ul-dev|smarc-rzv2l|rzv2l-dev|oem-rzg2l)"
COMPATIBLE_MACHINE_rzg2h = "(ek874|hihope-rzg2n|hihope-rzg2m|hihope-rzg2h)"
COMPATIBLE_MACHINE_rzfive = "(smarc-rzfive|rzfive-dev)"
COMPATIBLE_MACHINE_rzv2m = "(rzv2m)"
当选择oem-rzg2l MACHINE时,允许该补丁加入编译。
8. 编译针对客户自己定制的板子添加的oem-rzg2l MACHINE的bsp和linux固件
至此,所有关于oem-rzg2l MACHINE的bsp和linux内核补丁及配方文件修改都已完成。
接下来我们来验证一下各个功能模块的编译:
flash_writer的编译
cd vlp3.0.6-update2
TEMPLATECONF=$PWD/meta-renesas/meta-rzg2l/docs/template/conf/ source poky/oe-init-build-env build
cp oss_pkg_rzg_v3.0.6-update2.7z build
cd build
7z x oss_pkg_rzg_v3.0.6-update2.7z
MACHINE=oem-rzg2l bitbake flash-writer
trusted-firmware-a的编译
MACHINE=oem-rzg2l bitbake trusted-firmware-a
u-boot的编译
MACHINE=oem-rzg2l bitbake u-boot
生成bl2和fip文件
MACHINE=oem-rzg2l bitbake firmware-pack
linux-renesas的编译
MACHINE=oem-rzg2l bitbake linux-renesas
根文件系统rootfs的编译
MACHINE=oem-rzg2l bitbake core-image-weston
9. 检查是否已生成我们需要的所有固件:
ls tmp/deploy/images/oem-rzg2l/
烧录
验证结果:
至此,我们完成了在vlp3.0.6-update2中添加oem-rzg2l MACHINE的所有步骤,该修改的全部sample code将通过补丁0001-Add-oem-rzg2l-Virtual-Custom-Board-Build-base-on-VLP.patch给出。如有需要可以联系我们。
如需了解更详细的使用方法请参考如下网站
https://www.renesas.cn/cn/zh/products/microcontrollers-microprocessors/rz-mpus/rzg2l-getting-started
https://jira-gasg.renesas.eu/confluence/display/REN/Renesas+Wiki
如您在使用瑞萨MCU/MPU产品中有任何问题,可识别下方二维码或复制网址到浏览器中打开,进入瑞萨技术论坛寻找答案或获取在线技术支持。
https://community-ja.renesas.com/zh/forums-groups/mcu-mpu/
1
END
1
推荐阅读
RZ/V2L ISP实现方式及功能简介
RZ/G2L Flash Writer指令介绍
RZ/T2x系列的中断重入实现