300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行

时间:2020-04-05 11:20:01

相关推荐

D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行

前言

最近折腾 D1 哪吒开发板 如何运行 rt-smart,今天重新梳理了一下u-boot 引导 rt-smart 的方法,发现 u-boot 可以使用bootm 引导 rt-smart

操作方法

rt-smart kernel 编译后,运行generateimg.shshell 脚本,生成 rtthread.img 镜像,这个镜像,其实类似于 Linux 的uImagegenerateimg.shshell 脚本内容如下:

#!/bin/shmkimage -A riscv -O linux -T kernel -C none -a 0x45000000 -e 0x45000000 -d rtthread.bin rtthread.img

如果mkimage找不到,ubuntu 安装:apt-get install u-boot-tools即可 把这个 rtthread.img ,替换全志 Tina Linux SDK 中tina-d1-h/out/d1-h-nezha/boot.img即可再使用pack命令打包,打包后的镜像:tina-d1-h/out/d1-h-nezha/tina_d1-h-nezha_uart0.img烧写到 开发板的spi nand flash中,即可引导运行rt-smart

备注

rt-smart 编译并使用 mkimage 打包,生成 rtthread.img,这个镜像就可以直接使用 u-boot bootm 引导这里 把 rtthread.img 替换 boot.img,并使用pack打包,是为了让全志平台烧写工具PhoenixSuit.exe可以正常烧写后面研究 u-boot 通过 tftp 引导 rt-smart,这样就省略了pack过程

启动信息

以下为开发板上电完整的启动信息

[205]HELLO! BOOT0 is starting![208]BOOT0 commit : 88480af[210]set pll start[212]fix vccio detect value:0xc0[215]periph0 has been enabled[218]set pll end[220][pmu]: bus read error[222]board init ok[224]get_pmu_exist() = -1[227]DRAM BOOT DRIVE INFO: V0.33[230]DRAM CLK = 792 MHz[232]DRAM Type = 3 (2:DDR2,3:DDR3)[235]DRAMC ZQ value: 0x7b7bfb[238]DRAM ODT value: 0x42.[241]ddr_efuse_type: 0x0[244]DRAM SIZE =1024 M[246]dram_tpr4:0x0[247]PLL_DDR_CTRL_REG:0xf8004100[250]DRAM_CLK_REG:0xc0000000[253][TIMING DEBUG] MR2= 0x18[257]DRAM simple test OK.[260]dram size =1024[262]spinand UBOOT_START_BLK_NUM 8 UBOOT_LAST_BLK_NUM 32[267]block from 8 to 32[325]Check is correct.[327]dma 0x301a8 int is not used yet[331]dma 0x301a8 int is free, you do not need to free it again[336]Entry_name = opensbi[339]Entry_name = u-boot[343]Entry_name = dtb[345]Jump to second Boot.OpenSBI auto-t113-linux-V0.8-2-g053d088_________ ____ _____/ __ \ / ____| _ \_ _|| | | |_ __ ___ _ __ | (___ | |_) || || | | | '_ \ / _ \ '_ \ \___ \| _ < | || |__| | |_) | __/ | | |____) | |_) || |_\____/| .__/ \___|_| |_|_____/|____/_____|| ||_|Platform Name: T-HEAD Xuantie PlatformPlatform HART Features : RV64ACDFIMSUVXPlatform Max HARTs: 1Current Hart : 0Firmware Base: 0x41fc0400Firmware Size: 75 KBRuntime SBI Version : 0.2MIDELEG : 0x0000000000000222MEDELEG : 0x000000000000b1ffPMP0 : 0x0000000041fc0000-0x0000000041fdffff (A)PMP1 : 0x0000000040000000-0x000000007fffffff (A,R,W,X)PMP2 : 0x0000000080000000-0x00000000bfffffff (A,R,W,X)PMP3 : 0x0000000000020000-0x0000000000027fff (A,U-Boot .05-g24521d6 (Feb 11 - 08:52:39 +0000) Allwinner Technology[00.430]DRAM: 1 GiB[00.433]Relocation Offset is: 3dee7000[00.437]secure enable bit: 0[00.439]CPU=1008 MHz,PLL6=600 Mhz,AHB=200 Mhz, APB1=100Mhz MBus=300Mhz[00.446]flash init start[00.448]workmode = 0,storage type = 0sspi->base_addr = 0x4025000, the SPI control register:[VER] 0x4025000 = 0x00010001, [GCR] 0x4025004 = 0x00000083, [TCR] 0x4025008 = 0x00000184[ICR] 0x4025010 = 0x00000f00, [ISR] 0x4025014 = 0x00000032, [FCR] 0x4025018 = 0x00200020[FSR] 0x402501c = 0x00000000, [WCR] 0x4025020 = 0x00000000, [CCR] 0x4025024 = 0x00000002[SDC] 0x4025028 = 0x00002000, [BCR] 0x4025030 = 0x00000000, [TCR] 0x4025034 = 0x00000000[BCC] 0x4025038 = 0x20000000, [DMA] 0x4025088 = 0x000000e5[00.495]sunxi-spinand-phy: not detect any munufacture from id table[00.502]sunxi-spinand-phy: get spi-nand Model from fdt fail[00.507]sunxi-spinand-phy: get phy info from fdt faildevice nand0 <nand>, # parts = 4#: namesizeoffsetmask_flags0: boot00x001000000x0000000011: uboot0x003000000x0010000012: secure_storage0x001000000x0040000013: sys 0x0fb000000x005000000active partition: nand0,0 - (boot0) 0x00100000 @ 0x00000000defaults:mtdids : nand0=nandmtdparts: mtdparts=nand:1024k@0(boot0)ro,3072k@1048576(uboot)ro,1024k@4194304(secure_storage)ro,-(sys)[00.842]ubi0: attaching mtd4[01.044]ubi0: scanning is finished[01.052]ubi0: attached mtd4 (name "sys", size 251 MiB)[01.056]ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 258048 bytes[01.063]ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 2048[01.069]ubi0: VID header offset: 2048 (aligned 2048), data offset: 4096[01.075]ubi0: good PEBs: 1004, bad PEBs: 0, corrupted PEBs: 0[01.081]ubi0: user volume: 9, internal volumes: 1, max. volumes count: 128[01.087]ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0[01.095]ubi0: available PEBs: 0, total reserved PEBs: 1004, PEBs reserved for bad PEB handling: 40[01.104]sunxi flash init ok[01.106]line:703 init_clocks[01.109]drv_disp_initrequest pwm success, pwm2:pwm2:0x2000c00.[01.126]drv_disp_init finish[01.129]boot_gui_init:start[01.132]set disp.dev2_output_type fail. using defval=0[01.158]boot_gui_init:finish[01.392]LCD open finishpartno erro : can't find partition bootloader54 bytes read in 0 ms[01.451]bmp_name=bootlogo.bmp size 30720543072054 bytes read in 65 ms (45.1 MiB/s)[01.647]Loading Environment from SUNXI_FLASH... OK[01.669]out of usb burn from boot: not need burn key[01.674]Item0 (Map) magic is badpartno erro : can't find partition private[01.703]update bootcmd[01.715]change working_fdt 0x7eaa6da0 to 0x7ea86da0No reserved memory region found in source FDT[01.742]update dtsnoncached_alloc(): addr = 0x7eb1c1c0noncached_alloc(): addr = 0x7eb44980noncached_alloc(): addr = 0x7eac8a40noncached_alloc(): addr = 0x7ef2d040phy_mode=rgmii, phy_interface=7gmac: *** using ephy_clk ***eth0Warning: eth0 (eth0) using random MAC address - 2e:17:cd:95:95:03Hit any key to stop autoboot: 0 dsp0:gpio init config faildsp0:sharespace config faildsp0 version is r528-tina-v1.0.0-release-37-g735b6b4-dirtyDSP0 start ok, img length 254860, booting from 0x400660[01.832]no vendor_boot partition is found## Booting kernel from Legacy Image at 45000000 ...Image Name: Image Type: RISC-V Linux Kernel Image (uncompressed)Data Size: 249576 Bytes = 243.7 KiBLoad Address: 45000000Entry Point: 45000000Verifying Checksum ... OK[01.861]Starting kernel ...heap: [0x45077bb0 - 0x48277bb0]\ | /- RT -Thread Smart Operating System/ | \5.0.0 build Jun 18 - Copyright by rt-thread teamfile system initialization done!Hello RISC-Vallwinner_d1-h board with rt-smartmsh />main : okmain : ok

小结

scons 生成后的产物,跟 make 生成的产物一样,都是可执行的文件,但是不能直接在 nand flash 上启动,需要通过u-boot,读取到 RAM中执行mkimage打包后的 镜像文件,在原 固件上增加了 64字节的header镜像信息,可以使用 bootm 引导,传递一些 固件相关的信息等 通过以上的操作,全志 Tina Linux SDK 中的代码,如u-boot 基本上不需要更改,rootfs分区好像rt-smart暂时没有用的,为了减少pack后的体积,可以 把rootfs这个分区先注释掉,修改方法为:tina-d1-h/device/config/chips/d1-h/configs/nezha/sys_partition.fex文件,注释掉 rootfs 分区 windows 下 使用 全志平台烧写工具PhoenixSuit.exe进行烧写,这里烧写到 spi nand flash 中,方法为 打开PhoenixSuit.exe,选择 烧写的文件,如:tina_d1-h-nezha_uart0.img,此时开发板断电,按住【FEL】按键不放,USB 线插入 【OTG】的那个 USB 口,烧写工具:PhoenixSuit.exe会自动进入烧写状态,此时就可以松开【FEL】按键 按住【FEL】按键,并且插入 USB 【OTG】后,进入烧写模式 此时松开【FEL】按键,等待烧写完成,烧写过程,串口有打印信息

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。