首页专栏详情
打赏
从放弃到入门[四]:让Hi3516EV200跑起来
易百纳技术社区 codinglab 2020-09-20 00:22:59

从放弃到入门[四]:让Hi3516EV200跑起来

Notes:小A已经将SDK版本升级到 Hi3516EV200R001C01SPC012 啦,后续所有的内容都基于此版本。是的,没错! 小A就是这么个”喜新厌旧“的人。

经过前面几篇系列文章,我们已经掌握了SDK包的完整编译和几种常见的烧写方法,那么下面是时候让板子完整跑起来了。我们都知道作为一个嵌入式系统,必不可少的三个基础就是bootloader,kernel,rootfs,而这三个在完整编译SDK个时候都已经生成了。我们这就来试一下看看默认的编译结果能否直接使用。

一:原材料

小系统组件的各个生成结果存放在 Hi3516EV200_SDK_V1.0.1.2/osdrv/pub/hi3516ev200_spi_image_uclibc/ 目录下,我们来看看都有什么

➜  hi3516ev200_spi_image_uclibc tree
.
├── rootfs_hi3516ev200_128k.jffs2
├── rootfs_hi3516ev200_256k.jffs2
├── rootfs_hi3516ev200_2k_128k_32M.ubifs
├── rootfs_hi3516ev200_2k_24bit.yaffs2
├── rootfs_hi3516ev200_2k_4bit.yaffs2
├── rootfs_hi3516ev200_4k_24bit.yaffs2
├── rootfs_hi3516ev200_4k_256k_50M.ubifs
├── rootfs_hi3516ev200_4k_4bit.yaffs2
├── rootfs_hi3516ev200_64k.jffs2
├── u-boot-hi3516ev200.bin
└── uImage_hi3516ev200

0 directories, 11 files

从上面我们可以看到有1个u-boot镜像,1个kernel镜像,以及若干个rootfs镜像,那么这么多个rootfs镜像我们怎么选择呢,先按下不表,等下再说。

二:信息采集

首先我们先确认下u-boot有没有问题。烧录uboot后直接启动,能够看到

这说明uboot自身启动基本没什么大问题了,从打印中我们可以关注到以下两点:

  • 是从SPI Nand falsh启动的,flash型号为"W25N01GV",基本参数:
FlashSize:128MB
BlockSize:128KB
PageSize:2KB
EccType:4bit

我们在前面说了有多个rootfs镜像待我们选用,首先我们根据nand类型选用yaffs2格式的rootfs。对于yaffs2的镜像,其命名规则为 rootfs_CPU_PageSize_EccType.yaffs2,所以我们先选用的个rootfs镜像为 rootfs_hi3516ev200_2k_4bit.yaffs2

  • 目前uboot下的环境变量有问题,CRC校验不通过,所以使用的是默认环境变量。如下

从这里我们看到默认的环境变量大小为256KB,这里也许有人要问小A,为什么打印出来的大小要比256KB小4个字节呢?很简单,环境变量分区的前4个字节用来保存CRC校验值的。另外这里的bootargs不完整,bootcmd也有问题。

三:在错误的边缘疯狂试探

基于以上问题,我们参考文档《xxxxxLinux SDK 安装以及升级使用说明》先对分区做出如下定义,并烧录

| 1M   | 4M     | 123M   |
|------|--------|--------|
| boot | kernel | rootfs |

烧录完重启依然卡在uboot下面,无法完成kernel的引导,这时候我们需要参考着设置环境变量并重启开发板。

setenv bootargs 'mem=32M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=yaffs2 rw mtdparts=hinand:1M(boot),4M(kernel),123M(rootfs)'
setenv bootcmd 'nand read 0x42000000 0x100000 0x400000;bootm 0x42000000'
saveenv
reset

重启后我们可以看到

resetting ...

System startup

Uncompress Ok!

U-Boot 2016.11 (Sep 19 2020 - 17:44:50 +0800)hi3516ev200

Relocation Offset is: 03734000
Relocating to 43f34000, new gd at 43e93ef0, sp at 43e93ed0
SPI Nor:  Boot Media isn't SPI Nor
NAND:  hifmc_ip_ver_check(44): Check Flash Memory Controller v100 ...hifmc_ip_ver_check(50):  Found
SPI Nand ID Table Version 2.7
SPI Nand(cs 0) ID: 0xef 0xaa 0x21 Name:"W25N01GV"
Block:128KB Page:2KB OOB:64B ECC:4bit/512
Chipsize:128 MiB
MMC:
In:    serial
Out:   serial
Err:   serial
Net:   eth0
Warning: eth0 (eth0) using random MAC address - 9e:fb:d3:16:95:d5

Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x400000
 4194304 bytes read: OK
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-4.9.37
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3397596 Bytes = 3.2 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Loading Kernel Image ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.9.37 (aiden@svr2004) (gcc version 6.3.0 (HC&C V1R3C00SPC200B005_20190606) ) #1 Sat Sep 19 17:47:48 CST 2020
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
CPU: div instructions available: patching division code
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt:Machine model: Hisilicon HI3516EV200 DEMO Board
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
Kernel command line: mem=32M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=yaffs2 rw mtdparts=hinand:1M(boot),4M(kernel),123M(rootfs)
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 25428K/32768K available (5042K kernel code, 181K rwdata, 1260K rodata, 176K init, 249K bss, 7340K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
    lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc04f4cd8   (5044 kB)
      .init : 0xc0632000 - 0xc065e000   ( 176 kB)
      .data : 0xc065e000 - 0xc068b460   ( 182 kB)
       .bss : 0xc068d000 - 0xc06cb448   ( 250 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:16 nr_irqs:16 16
Gic dist init...
arm_arch_timer: Architected cp15 timer(s) running at 50.00MHz (phys).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb8812736b, max_idle_ns: 440795202655 ns
sched_clock: 56 bits at 50MHz, resolution 20ns, wraps every 4398046511100ns
Switching to timer-based delay loop, resolution 20ns
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.00 BogoMIPS (lpj=500000)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x40008200 - 0x40008258
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
Serial: AMBA PL011 UART driver
12040000.uart: ttyAMA0 at MMIO 0x12040000 (irq = 20, base_baud = 0) is a PL011 rev2
console [ttyAMA0] enabled
SCSI subsystem initialized
ssp-pl022 12070000.spi: ARM PL022 driver, device ID: 0x00800022
ssp-pl022 12070000.spi: mapped registers from 0x12070000 to c2867000
ssp-pl022 12071000.spi: ARM PL022 driver, device ID: 0x00800022
ssp-pl022 12071000.spi: mapped registers from 0x12071000 to c286b000
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Linux video capture interface: v2.00
clocksource: Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
workingset: timestamp_bits=30 max_order=13 bucket_order=0
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
jffs2: version 2.2 (NAND) (ZLIB) (RTIME) (c) 2001-2006 Red Hat, Inc.
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered (default)
io scheduler cfq registered
pl061_gpio 120b0000.gpio_chip: PL061 GPIO chip @0x120b0000 registered
pl061_gpio 120b1000.gpio_chip: PL061 GPIO chip @0x120b1000 registered
pl061_gpio 120b2000.gpio_chip: PL061 GPIO chip @0x120b2000 registered
pl061_gpio 120b4000.gpio_chip: PL061 GPIO chip @0x120b4000 registered
pl061_gpio 120b5000.gpio_chip: PL061 GPIO chip @0x120b5000 registered
pl061_gpio 120b6000.gpio_chip: PL061 GPIO chip @0x120b6000 registered
pl061_gpio 120b7000.gpio_chip: PL061 GPIO chip @0x120b7000 registered
pl061_gpio 120b8000.gpio_chip: PL061 GPIO chip @0x120b8000 registered
brd: module loaded
hisi-sfc hisi_spi_nor.0: SPI Nor ID Table Version 1.2
hisi-sfc hisi_spi_nor.0: unrecognized Manufacturer ID
hisi-sfc hisi_spi_nor.0: spi nor register fail!
hisi-sfc: probe of hisi_spi_nor.0 failed with error -2
SPI Nand ID Table Version 2.7
SPI Nand(cs 0) ID: 0xef 0xaa 0x21
nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
nand: Winbond W25N01GV
nand: 128MiB, SLC, page size: 2048
Nand(Auto): OOB:64B
ECC:4bit/512 nand:  ECC provided by Flash Memory Controller
3 cmdlinepart partitions found on MTD device hinand
Creating 3 MTD partitions on "hinand":
0x000000000000-0x000000100000 : "boot"
0x000000100000-0x000000500000 : "kernel"
0x000000500000-0x000008000000 : "rootfs"
FEPHY:addr=1, la_am=0xc, ldo_am=0x4, r_tuning=0x20
libphy: hisi_femac_mii_bus: probed
libphy: Fixed MDIO Bus: probed
Generic PHY 10041100.mdio:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=10041100.mdio:01, irq=-1)
phy_id=0x20669903, phy_mode=mii
hisi-femac 10040000.ethernet: using random MAC address 2e:34:30:3d:a3:8d
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
xhci-hcd xhci-hcd.0.auto: hcc params 0x0220fe6c hci version 0x110 quirks 0x20010010
xhci-hcd xhci-hcd.0.auto: irq 114, io mem 0x10030000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
hub 2-0:1.0: USB hub found
hub 2-0:1.0: hub can't support USB3.0
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
hibvt_rtc 120e0000.rtc: rtc core: registered 120e0000.rtc as rtc0
hibvt_rtc 120e0000.rtc: RTC driver for hibvt enabled
i2c /dev entries driver
hibvt-i2c 12060000.i2c: hibvt-i2c0@100000hz registered
hibvt-i2c 12061000.i2c: hibvt-i2c1@100000hz registered
hibvt-i2c 12062000.i2c: hibvt-i2c2@100000hz registered
uvcvideo: Unable to create debugfs directory
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on 10010000.sdhci [10010000.sdhci] using ADMA in legacy mode
mmc1: SDHCI controller on 10020000.sdhci [10020000.sdhci] using ADMA in legacy mode
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
Key type dns_resolver registered
hibvt_rtc 120e0000.rtc: setting system clock to 1970-01-01 00:06:11 UTC (371)
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
devtmpfs: mounted
Freeing unused kernel memory: 176K (c0632000 - c065e000)
This architecture does not have kernel memory protection.
random: init: uninitialized urandom read (4 bytes read)

            _ _ _ _ _ _ _ _ _ _ _ _
            \  _  _   _  _ _ ___
            / /__/ \ |_/
           / __   /  -  _ ___
          / /  / /  / /
  _ _ _ _/ /  /  \_/  \_ ______
___________\___\__________________

[RCS]: /etc/init.d/S00devs
mknod: /dev/console: File exists
mknod: /dev/ttyAMA0: File exists
mknod: /dev/null: File exists
[RCS]: /etc/init.d/S01udev
udevd[613]: starting eudev-3.2.7
[RCS]: /etc/init.d/S80network
Auto login as root ...
Jan  1 00:06:12 login[857]: root login on 'ttyS000'
Welcome to HiLinux.
None of nfsroot found in cmdline.
~ #

四:HappyEnding

通过摸索和试探,在不看代码的情况下,我们终于将Hi3516EV200嵌入式小系统正常跑起来啦,可以进行普通的嵌入式平台开发了。下一步,小A会先去看看海思的小系统组件都有哪些特别的节目,暂时先不着急研究海思平台的特性(音视频采集,编解码和输出),毕竟小A是个喜欢折腾的。


声明:本文内容由易百纳平台入驻作者撰写,文章观点仅代表作者本人,不代表易百纳立场。如有内容侵权或者其他问题,请联系本站进行删除。

6271
4
4
打赏
共1人已赏
评论
8个
内容存在敏感词
  • 易百纳技术社区
    一个爱徒步的~IT民工

    搞一个鸿蒙玩玩

  • 易百纳技术社区
    手机抵押 https://www.iyakj.com/

    点赞点赞

  • 易百纳技术社区

    学习了。多谢。

  • 易百纳技术社区

    学习了。

  • 易百纳技术社区

    你好,是否可以分享下你的SDK?

  • 易百纳技术社区

    学到了

  • 易百纳技术社区
    致力于打造一流的高端智能传感器品牌

    可以的

  • 易百纳技术社区

    可以的可以的

相关专栏
打赏作者
易百纳技术社区
codinglab
您的支持将鼓励我继续创作!
打赏金额:
¥1 易百纳技术社区
¥5 易百纳技术社区
¥10 易百纳技术社区
¥50 易百纳技术社区
¥100 易百纳技术社区
支付方式:
微信支付
支付宝支付
易百纳技术社区 微信支付
易百纳技术社区
打赏成功!

感谢您的打赏,如若您也想被打赏,可前往 发表专栏 哦~

审核成功

发布时间设置
发布时间:
是否关联周任务-专栏模块

审核失败

失败原因
备注
Loading...
易百纳技术社区
确定要删除此文章、专栏、评论吗?
确定
取消
易百纳技术社区
易百纳技术社区
在专栏模块发布专栏,可获得其他E友的打赏
易百纳技术社区
回答悬赏问答,被题主采纳后即可获得悬赏金
易百纳技术社区
在上传资料时,有价值的资料可设置为付费资源
易百纳技术社区
达到一定金额,收益即可提现~
收益也可用来充值ebc,下载资料、兑换礼品更容易
易百纳技术社区
活动规则
  • 1.周任务为周期性任务,每周周一00:00刷新,上周完成的任务不会累计到本周,本周需要从头开始任务,当前任务完成后才可以完成下一个任务
  • 2.发布的专栏与资料需要与平台的板块有相关性,禁止注水,专栏/资料任务以审核通过的篇数为准
  • 3.任务完成后,现金奖励直接打款到微信账户;EBC/收益将自动发放到个人账户,可前往“我的钱包”查看;其他奖励请联系客服兑换
  • 4.每周最后三个任务将会有以下奖品掉落:社区热卖开发板、小米音响、视频年度会员、京东卡、华为手机等等
易百纳技术社区
升级提醒
易百纳技术社区

恭喜您由入门

社区送出礼品一份

请填写您的收件地址,礼品将在3个工作日寄出

易百纳技术社区