From a120c914bb003646010d1d385be36b5260284132 Mon Sep 17 00:00:00 2001 From: bigmagic Date: Thu, 16 Apr 2020 16:42:07 +0800 Subject: [PATCH] add bsp/raspi4 readme --- bsp/raspberry-pi/raspi3-64/README.md | 2 +- bsp/raspberry-pi/raspi4/Kconfig | 2 +- bsp/raspberry-pi/raspi4/README.md | 89 ++++++++----------- bsp/raspberry-pi/raspi4/rtconfig.py | 2 +- .../{cortex-a57 => cortex-a72}/SConscript | 0 .../{cortex-a57 => cortex-a72}/entry_point.S | 0 .../{cortex-a57 => cortex-a72}/interrupt.c | 0 .../{cortex-a57 => cortex-a72}/interrupt.h | 0 .../{cortex-a57 => cortex-a72}/stack.c | 0 .../aarch64/{cortex-a57 => cortex-a72}/trap.c | 0 10 files changed, 38 insertions(+), 57 deletions(-) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/SConscript (100%) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/entry_point.S (100%) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/interrupt.c (100%) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/interrupt.h (100%) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/stack.c (100%) rename libcpu/aarch64/{cortex-a57 => cortex-a72}/trap.c (100%) diff --git a/bsp/raspberry-pi/raspi3-64/README.md b/bsp/raspberry-pi/raspi3-64/README.md index 28e00f96c0..576b13ed0e 100644 --- a/bsp/raspberry-pi/raspi3-64/README.md +++ b/bsp/raspberry-pi/raspi3-64/README.md @@ -17,7 +17,7 @@ Windows环境下推荐使用[env工具][1]进行编译。 -首先下载Linux上的gcc工具,版本为gcc-arm-8.3选择aarch64-elf就可以。 +首先下载windows上的aarch64的gcc交叉编译工具,版本为gcc-arm-8.3选择aarch64-elf就可以。 将推荐将gcc解压到`\env\tools\gnu_gcc\arm_gcc`目录下。 diff --git a/bsp/raspberry-pi/raspi4/Kconfig b/bsp/raspberry-pi/raspi4/Kconfig index e71ed3d54b..075a5d81aa 100644 --- a/bsp/raspberry-pi/raspi4/Kconfig +++ b/bsp/raspberry-pi/raspi4/Kconfig @@ -20,7 +20,7 @@ source "$PKGS_DIR/Kconfig" config BCM2711_SOC bool - select ARCH_ARM_CORTEX_A57 + select ARCH_ARM_CORTEX_A72 select RT_USING_COMPONENTS_INIT select RT_USING_USER_MAIN select ARCH_CPU_64BIT diff --git a/bsp/raspberry-pi/raspi4/README.md b/bsp/raspberry-pi/raspi4/README.md index 28e00f96c0..1e7411894e 100644 --- a/bsp/raspberry-pi/raspi4/README.md +++ b/bsp/raspberry-pi/raspi4/README.md @@ -1,86 +1,67 @@ -# Raspberry PI 3-64板级支持包说明 +# Raspberry PI 4板级支持包说明 ## 1. 简介 -树莓派由注册于英国的慈善组织“Raspberry Pi 基金会”开发,莓派3有三个发行版本: +树莓派4B的核心处理器为博通BCM2711(四核1.5GHz,Cortex A72架构,树莓派3是四核A53)。LPDDR4内存,由5V/3A USB-C供电或GPIO 5V。 -* B : 4核 Broadcom BCM2837 (ARMv8-A) 1.2GHz,双核VideoCore IV GPU,1GB内存,100 Base-T Ethernet -* B+: 4核 Broadcom BCM2837B0 Cortex-A53 (ARMv8) 1.4GHz, 1GB LPDDR2 SDRAM, GigaE over USB 2.0 -* A+: 4核 Broadcom BCM2837B0 Cortex-A53 (ARMv8) 1.4GHz, 512MB LPDDR2 SDRAM +外设支持上,引入了双频Wi-Fi,蓝牙5.0,千兆网卡,MIPI CSI相机接口,两个USB口,40个扩展帧。 -这份RT-Thread BSP是针对 Raspberry Pi 3 64位模式的一份移植,树莓派价格便宜, 使用者甚众,是研究和运行RT-Thread的可选平台之一。 +这份RT-Thread BSP是针对 Raspberry Pi 4的一份移植,树莓派价格便宜, 使用者甚众,是研究和运行RT-Thread的可选平台之一。 ## 2. 编译说明 -### 2.1 Window上的环境搭建 - -Windows环境下推荐使用[env工具][1]进行编译。 - -首先下载Linux上的gcc工具,版本为gcc-arm-8.3选择aarch64-elf就可以。 - -将推荐将gcc解压到`\env\tools\gnu_gcc\arm_gcc`目录下。 - -接着修改`bsp\raspberry-pi\raspi3-64\rtconfig.py` - -修改路径: - -``` -EXEC_PATH = r'E:/env_released_1.1.2/env/tools/gnu_gcc/arm_gcc/gcc-arm-8.3-2019.03-i686-mingw32-aarch64-elf/bin' -``` - -然后在`bsp\raspberry-pi\raspi3-64\`下输入scons编译即可。 - -### 2.2 Linux上的环境搭建 - Linux下推荐使用[gcc工具][2]。Linux版本下gcc版本可采用`gcc-arm-8.3-2019.03-x86_64-aarch64-elf`。 -直接进入`bsp\raspberry-pi\raspi3-64`,输入scons编译即可。 +将工具链解压到指定目录,并修改当前bsp下的`EXEC_PATH`为自定义gcc目录。 + +``` +PLATFORM = 'gcc' +EXEC_PATH = r'/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/' +``` + +直接进入`bsp\raspberry-pi\raspi4`,输入scons编译即可。 ## 3. 执行 -### 3.1 下载[raspbian镜像][3],生成可以运行的raspbian SD卡 +### 3.1 下载**Raspberry Pi Imager**,生成可以运行的raspbian SD卡 -Windows下,去[etcher.io][4]下载etcher,这是个可以烧写img的工具 +首先下载镜像 -解开下载的镜像文件, linux下使用如下的命令 - -``` -unzip 2018-06-27-raspbian-stretch-lite.zip -``` - -准备一张空SD卡,linux环境下,插入电脑并执行 - -``` -sudo dd if=2018-06-27-raspbian-stretch-lite.img of=/dev/xxx bs=32M conv=fsync -``` - -**注意: /dev/xxx 要换成真实环境中的SD卡所在设置,千万不要弄错。** - -Windows环境下,执行etcher选择解压后的2018-06-27-raspbian-stretch-lite.img文件和SD卡就可以开始烧写了。 - -最后把kernel8.img放入SD boot分区,删除其它 kernel*.img。 +* [Raspberry Pi Imager for Ubuntu](https://downloads.raspberrypi.org/imager/imager_amd64.deb) +* [Raspberry Pi Imager for Windows](https://downloads.raspberrypi.org/imager/imager.exe) +* [Raspberry Pi Imager for macOS](https://downloads.raspberrypi.org/imager/imager.dmg) ### 3.2 准备好串口线 -目前版本是使用raspi3的 GPIO 14, GPIO 15来作路口输出,连线情况如下图所示(图片中的板子是pi2,GPIO引脚是一样的): +目前版本是使用raspi4的 GPIO 14, GPIO 15来作路口输出,连线情况如下图所示: -![raspi2](figures/raspi_uart.png) +![raspi2](../raspi3-32/figures/raspberrypi-console.png) 串口参数: 115200 8N1 ,硬件和软件流控为关。 -按上面的方法做好SD卡后,插入树莓派,通电可以在串口上看到如下所示的输出信息: +### 3.3 程序下载 + +当编译生成了rtthread.bin文件后,我们可以将该文件放到sd卡上,并修改sd卡中的`config.txt`文件如下: + +``` +enable_uart=1 +arm_64bit=1 +kernel=rtthread.bin +``` + +按上面的方法做好SD卡后,插入树莓派4,通电可以在串口上看到如下所示的输出信息: ```text - heap: 0x00020b20 - 0x00400000 +heap: 0x000c9350 - 0x040c9350 \ | / - RT - Thread Operating System - / | \ 3.1.0 build Aug 23 2019 - 2006 - 2019 Copyright by rt-thread team -Hello RT-Thread! -msh > + / | \ 4.0.3 build Apr 16 2020 + 2006 - 2020 Copyright by rt-thread team +Hi, this is RT-Thread!! +msh /> ``` ## 4. 支持情况 diff --git a/bsp/raspberry-pi/raspi4/rtconfig.py b/bsp/raspberry-pi/raspi4/rtconfig.py index 228ec0176a..9265b016be 100644 --- a/bsp/raspberry-pi/raspi4/rtconfig.py +++ b/bsp/raspberry-pi/raspi4/rtconfig.py @@ -2,7 +2,7 @@ import os # toolchains options ARCH ='aarch64' -CPU ='cortex-a57' +CPU ='cortex-a72' CROSS_TOOL ='gcc' if os.getenv('RTT_ROOT'): diff --git a/libcpu/aarch64/cortex-a57/SConscript b/libcpu/aarch64/cortex-a72/SConscript similarity index 100% rename from libcpu/aarch64/cortex-a57/SConscript rename to libcpu/aarch64/cortex-a72/SConscript diff --git a/libcpu/aarch64/cortex-a57/entry_point.S b/libcpu/aarch64/cortex-a72/entry_point.S similarity index 100% rename from libcpu/aarch64/cortex-a57/entry_point.S rename to libcpu/aarch64/cortex-a72/entry_point.S diff --git a/libcpu/aarch64/cortex-a57/interrupt.c b/libcpu/aarch64/cortex-a72/interrupt.c similarity index 100% rename from libcpu/aarch64/cortex-a57/interrupt.c rename to libcpu/aarch64/cortex-a72/interrupt.c diff --git a/libcpu/aarch64/cortex-a57/interrupt.h b/libcpu/aarch64/cortex-a72/interrupt.h similarity index 100% rename from libcpu/aarch64/cortex-a57/interrupt.h rename to libcpu/aarch64/cortex-a72/interrupt.h diff --git a/libcpu/aarch64/cortex-a57/stack.c b/libcpu/aarch64/cortex-a72/stack.c similarity index 100% rename from libcpu/aarch64/cortex-a57/stack.c rename to libcpu/aarch64/cortex-a72/stack.c diff --git a/libcpu/aarch64/cortex-a57/trap.c b/libcpu/aarch64/cortex-a72/trap.c similarity index 100% rename from libcpu/aarch64/cortex-a57/trap.c rename to libcpu/aarch64/cortex-a72/trap.c