> 文档中心 > mangopi R3--Allwinner F1C200S一步到位编译法

mangopi R3--Allwinner F1C200S一步到位编译法

文章目录

  • 前言
    • 介绍
    • 规格
    • 芯片优缺点
  • MangoPi的Buildroot一键编译
    • 第一次编译
    • 应用默认配置
    • 常规编译
      • 如果更改了 DTS 或 kenrel 构建
      • 如果更改了 Uboot,则构建
    • 加快构建进度
    • 固件
    • Windows下失败了,转战Linux下烧录
  • Linux下烧录
    • 使用sunxi-tools
    • 安装putty
    • 擦除
    • 开始烧录

兜兜转转还是玩上了MangoPi-R3!因为是ARM9的芯片内核架构,所以总觉得过时了的,至少也要整个ARM-A7的架构芯片。
在这里插入图片描述

前言

https://mangopi.cc/f1c_mainline
https://wiki.dfrobot.com/MangoPi_R3_SKU_DFR0780

介绍

这款微型开发板专为运行 Linux 而设计。尽管机身很小,但它具有所有重要功能。板载F1C200S作为主控芯片,提供多种常用外设端口:GPIO、I2C&SPI、SDIO、Audio port(record,play), Video(RGB565 Display, touch, DVP), USB Host, OTG等. 此外,板卡内置64MB DDR和板载128MB Nand Flash,全面支持Linux生态,运行完整的Python。

目前该产品是完全开源的,用户可以根据自己的需求编译任意模块。但是,它主要面向 Python 开发人员和高级爱好者,因为它上手有点困难。

规格

芯片型号 F1C100S F1C200S F1C500S F1C600
内存 SIP 32MB DDR1 64MB DDR1 128MB DDR1 256MB DDR1
  • QFN88封装(10x10mm)
  • 板载 128MB Nand Flash
  • ARM926EJ-S内核,420MHz系统时钟默认频率,可超频至700MHz及以上
  • 丰富的 GPIO 引脚
  • 板载 SDIO 接口,用于连接 SD 卡或 SDIO WiFi + BT 模块
  • DVP摄像头接口,支持OV2640、GC0328等摄像头。
  • RGB565显示接口和6线触摸接口
  • 板载麦克风和功率放大器
  • 低功耗
  • 支持完整的Python运行

芯片优缺点

  • 缺点:主频过低,内核太古老(ARM9)
  • 优点:便宜,内置DDR,资料丰富(老芯片的优势)

MangoPi的Buildroot一键编译

地址:https://github.com/mangopi-sbc/buildroot-mangopi-r

安装软件包

sudo apt install rsync wget unzip build-essential git bc swig libncurses-dev libpython3-dev libssl-devsudo apt install python3-distutils

下载BSP包

git clone https://github.com/mangopi-sbc/buildroot-mangopi-r

第一次编译

注意:构建固件不需要 Root 权限。

应用默认配置

注意:应用 defconfig 会将所有 buildroot 配置重置为默认值。

通常,您只需要应用一次。

cd buildroot-mangopi-rmake widora_mangopi_r3_defconfig

常规编译

make -j16

如果更改了 DTS 或 kenrel 构建

./rebuild-kernel.sh

如果更改了 Uboot,则构建

./rebuild-uboot.sh

加快构建进度

在百度云下载离线的 dl
Buildroot 将在编译固件时下载源代码。您可以获取“dl”文件夹的可信存档以加快速度。 https://pan.baidu.com/s/1-5CiMwXMQWjZxsFhsyRC5Q?pwd=1111

.make source

没有搞清楚这里是怎么用的,现在是下载了两个包:

  • buildroot-dl-20220130.zip
  • buildroot-mangopi-r-master.zip
    是不是把buildroot-dl-20220130.zip解压到buildroot-mangopi-r-master目录里面呢?

明白了,把buildroot-dl-20220130.zip解压出来并改名为dl,然后再把dl移动到buildroot-mangopi-r-master.zip解压出来的文件夹目录里面去就行了,编译的好快 啊。

最终编译完成了。

INFO: hdimage(sysimage-sdcard.img): adding partition 'u-boot' (in MBR) from 'u-boot-sunxi-with-spl.bin' ...INFO: hdimage(sysimage-sdcard.img): adding partition 'boot' (in MBR) from 'bootfs.vfat' ...INFO: hdimage(sysimage-sdcard.img): adding partition 'rootfs' (in MBR) from 'rootfs.ext4' ...INFO: hdimage(sysimage-sdcard.img): writing MBRboard/allwinner/generic/genimage-nor.cfg:33: no sub-section title/index for 'config'INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"" (stderr):INFO: cmd: "rm -rf "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"/*" (stderr):INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"" (stderr):INFO: cmd: "cp -a "/tmp/tmp.kqghzcncg8" "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root"" (stderr):INFO: cmd: "find '/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/tmp/tmp.kqghzcncg8/{}' '/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root/{}'" (stderr):INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/images"" (stderr):INFO: flash(sysimage-nor.img): writing image partition 'u-boot' (0x80000@0x0)INFO: flash(sysimage-nor.img): writing image partition 'splash' (0x80000@0x80000)INFO: flash(sysimage-nor.img): writing image partition 'kernel' (0x500000@0x100000)INFO: flash(sysimage-nor.img): writing image partition 'rom' (0xa00000@0x600000)board/allwinner/generic/genimage-nand.cfg:39: no sub-section title/index for 'config'INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"" (stderr):INFO: cmd: "rm -rf "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"/*" (stderr):INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp"" (stderr):INFO: cmd: "cp -a "/tmp/tmp.cjWlxAkEjg" "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root"" (stderr):INFO: cmd: "find '/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root' -depth -type d -printf '%P\0' | xargs -0 -I {} touch -r '/tmp/tmp.cjWlxAkEjg/{}' '/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/build/genimage.tmp/root/{}'" (stderr):INFO: cmd: "mkdir -p "/home/liefyuan/Liefyuan/mangopi-r/buildroot-mangopi-r-master/output/images"" (stderr):INFO: flash(sysimage-nand.img): writing image partition 'u-boot' (0x80000@0x0)INFO: flash(sysimage-nand.img): writing image partition 'splash' (0x80000@0x80000)INFO: flash(sysimage-nand.img): writing image partition 'kernel' (0x500000@0x100000)INFO: flash(sysimage-nand.img): writing image partition 'rom' (0x7700000@0x600000)real20m23.669suser93m8.759ssys31m2.006s

编译出来的文件:buildroot-mangopi-r-master/output/images

一步到位,所有版本都编译出来了(牛逼!):

bootfs.vfat     rootfs.ext4 sysimage-sdcard.imgdevicetree.dtb  rootfs.squashfs    u-boot.binkernel.itb      rootfs.tar  u-boot-sunxi-with-nand-spl.binrootfs.cpio     splash.bmp  u-boot-sunxi-with-spl.binrootfs.cpio.gz  sysimage-nand.img  zImagerootfs.ext2     sysimage-nor.img

刷固件

指导说明文档:https://github.com/mangopi-sbc/buildroot-mangopi-r/blob/master/flashutils/README.md

Windows下失败了,转战Linux下烧录

Linux下烧录

使用sunxi-tools

sunxi-tools 是全志 SoC(全志科技开发的智能应用处理器 SoC)ARM 设备的命令行工具集合。

设置和安装 sunxi-tools

安装依赖包

sudo apt install pkg-config zlib1g-dev libusb-dev libusb-1.0-0-dev

下载代码

git clone https://github.com/Icenowy/sunxi-tools.git -b f1c100s-spiflash

编译安装

cd sunxi-toolsmake sudo make install

什么是dfu? 设备固件升级(DFU)是一种独立于分销商和设备的机制,用于通过其制造商提供的改进版本来升级USB设备的固件,从而提供(例如)一种部署固件错误的方法修复。在固件升级操作过程中,USB 设备将有效地改变其工作模式,从而成为 PROM 编程器。按照官方 DFU 规范,任何类型的 USB 设备都可以实现此功能。DFU 还允许用户自由使用备份固件来刷新 USB 设备。结果之一是刷新的 USB 设备可以充当多种设备类型。

什么是 dfu-util? dfu-util 是一个实现 USB DFU(通用串行总线设备固件升级)协议的主机 (PC) 程序。DFU 会将固件下载到通过 USB 连接的设备,或从设备下载固件。其应用范围从微控制器板等小型设备到手机设备。使用 dfu-util,您可以从支持 DFU 的设备下载/上传固件。

通过 apt-get 安装 dfu-util

sudo apt install dfu-util

安装putty

putty 是一个 Telnet、SSH 和串口连接软件。

安装串口工具putty

sudo apt-get install putty

打开串口调试软件putty

默认安装的情况下,putty被添加到/usr/bin目录下,所以可以直接在终端使用putty命令打开。

在ubuntu上找串口号

dmesg | grep tty
liefyuan@ubuntu:~/Liefyuan/myGit$ dmesg | grep tty[    0.004000] console [tty0] enabled[    1.247164] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A[25931.988675] usb 2-2.2: ch341-uart converter now attached to ttyUSB0

由此可知,板子的串口是ttyUSB0

一般串口的名字在dev下,如果没有外接串口卡,默认是dev。

使用命令ls /dev/ttyUSB0查看是否存在

liefyuan@ubuntu:~/Liefyuan/myGit$ ls /dev/ttyUSB0/dev/ttyUSB0

如果结果存在,则串口地址为/dev/ttyUSB0

在putty中填入串口,然后打开串口格式化

序列号:填写对应的序列号
速度:填写115200
在这里插入图片描述

打开有问题时记得加sudo putty

擦除

putty打开以后,就进入固件位置:
同时按下tiny200的开机键和rst键,然后松开

此时运行.\fel-uboot.sh脚本
在这里插入图片描述
putty里面就有打印数据了

然后等待操作完成后,在putty里面输入命令:mtd erase spi-nand0,格式化。

U-Boot SPL 2020.07 (Feb 16 2022 - 01:28:19 +0000)DRAM: 64 MiBTrying to boot from FELU-Boot 2020.07 (Feb 16 2022 - 01:28:19 +0000) Allwinner TechnologyCPU:   Allwinner F Series (SUNIV)Model: Allwinner F1C100s Generic DeviceDRAM:  64 MiBMMC:   mmc@1c0f000: 0, mmc@1c10000: 1Setting up a 800x480 lcd console (overscan 0x0)In:    serialOut:   vgaErr:   vgaAllwinner mUSB OTG (Peripheral)Hit any key to stop autoboot:  0Card did not respond to voltage select!Card did not respond to voltage select!unrecognized JEDEC id bytes: ff, c8, 51Failed to initialize SPI flash at 0:0 (error -2)List of MTD devices:* spi-nand0  - device: spi-nand@1  - parent: spi@1c05000  - driver: spi_nand  - type: NAND flash  - block size: 0x20000 bytes  - min I/O: 0x800 bytes  - OOB size: 128 bytes  - OOB available: 4 bytes  - 0x000000000000-0x000008000000 : "spi-nand0"=========================Boot Device: felBoot Slot 0: emptyBoot Slot 1: spi-nand=========================Booting from FEL...DFU waiting on SPI-NAND...musb-hdrc: peripheral reset irq lost!=> mtd erase spi-nand0Erasing 0x00000000 ... 0x07ffffff (1024 eraseblock(s))=> 

添加文件权限
使用ll命令查看文件权限。

如果文件没有执行权限,则需要添加权限,通过以下命令添加权限。

chmod +x fel-uboot.shchmod +x dfu-nand-ubifs.sh

开始烧录

输入固件文件夹

按下开发板子上的 boot 按钮和 rst 按钮,然后松开rst按钮并运行以下命令。

sudo ./fel-uboot.sh && ./dfu-nand-ubifs.sh

开始烧录啦,挺壮观的!

素描网