Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
rt-smart
D1 哪吒开发板 rt-smart 使用u-boot bootm 引导运行
发布于 2022-06-18 11:20:29 浏览:2458
订阅该版
[tocm] [D1 哪吒开发板 上电记录](https://club.rt-thread.org/ask/article/a3f6964bd395b220.html) [D1 哪吒开发板 rt-smart 烧写与运行](https://club.rt-thread.org/ask/article/5710c99a2ad53529.html) ## 前言 - 最近折腾 D1 哪吒开发板 如何运行 `rt-smart`,今天重新梳理了一下u-boot 引导 rt-smart 的方法,发现 u-boot 可以使用bootm 正常引导 `rt-smart` ## 操作方法 - 哪吒d1-h的 `rt-smart` BSP [https://gitee.com/zhangsz0516/allwinner_d1s](https://gitee.com/zhangsz0516/allwinner_d1s) 编译后,运行 `generateimg.sh` shell 脚本,生成 rtthread.img 镜像,这个镜像,其实类似于 Linux 的uImage - `generateimg.sh` shell 脚本内容如下: ```bash #!/bin/sh mkimage -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` 即可 ![2022-06-18_104251.png](https://oss-club.rt-thread.org/uploads/20220618/dff4806463fc312bf759c4b63255619e.png "2022-06-18_104251.png") - 把这个 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` ![2022-06-18_104446.png](https://oss-club.rt-thread.org/uploads/20220618/830a9839194303f57238599b7296d830.png "2022-06-18_104446.png") ## 备注 - rt-smart 编译并使用 mkimage 打包,生成 rtthread.img,这个镜像就可以直接使用 u-boot bootm 引导 - 这里 把 rtthread.img 替换 boot.img,并使用 `pack` 打包,是为了让全志平台烧写工具`PhoenixSuit.exe` 可以正常烧写 - 后面研究 u-boot 通过 tftp 引导 rt-smart,这样就省略了 `pack` 过程 ## 启动信息 - 以下为开发板上电完整的启动信息 ```c [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 Platform Platform HART Features : RV64ACDFIMSUVX Platform Max HARTs : 1 Current Hart : 0 Firmware Base : 0x41fc0400 Firmware Size : 75 KB Runtime SBI Version : 0.2 MIDELEG : 0x0000000000000222 MEDELEG : 0x000000000000b1ff PMP0 : 0x0000000041fc0000-0x0000000041fdffff (A) PMP1 : 0x0000000040000000-0x000000007fffffff (A,R,W,X) PMP2 : 0x0000000080000000-0x00000000bfffffff (A,R,W,X) PMP3 : 0x0000000000020000-0x0000000000027fff (A, U-Boot 2018.05-g24521d6 (Feb 11 2022 - 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 = 0 sspi->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 fail device nand0
, # parts = 4 #: name size offset mask_flags 0: boot0 0x00100000 0x00000000 1 1: uboot 0x00300000 0x00100000 1 2: secure_storage 0x00100000 0x00400000 1 3: sys 0x0fb00000 0x00500000 0 active partition: nand0,0 - (boot0) 0x00100000 @ 0x00000000 defaults: mtdids : nand0=nand mtdparts: 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_init request 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 finish partno erro : can't find partition bootloader 54 bytes read in 0 ms [01.451]bmp_name=bootlogo.bmp size 3072054 3072054 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 bad partno erro : can't find partition private [01.703]update bootcmd [01.715]change working_fdt 0x7eaa6da0 to 0x7ea86da0 No reserved memory region found in source FDT [01.742]update dts noncached_alloc(): addr = 0x7eb1c1c0 noncached_alloc(): addr = 0x7eb44980 noncached_alloc(): addr = 0x7eac8a40 noncached_alloc(): addr = 0x7ef2d040 phy_mode=rgmii, phy_interface=7 gmac: *** using ephy_clk *** eth0 Warning: eth0 (eth0) using random MAC address - 2e:17:cd:95:95:03 Hit any key to stop autoboot: 0 dsp0:gpio init config fail dsp0:sharespace config fail dsp0 version is r528-tina-v1.0.0-release-37-g735b6b4-dirty DSP0 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 KiB Load Address: 45000000 Entry Point: 45000000 Verifying Checksum ... OK [01.861] Starting kernel ... heap: [0x45077bb0 - 0x48277bb0] \ | / - RT - Thread Smart Operating System / | \ 5.0.0 build Jun 18 2022 2006 - 2020 Copyright by rt-thread team file system initialization done! Hello RISC-V allwinner_d1-h board with rt-smart msh />main : ok main : ok ``` ## 小结 - scons 生成后的产物,跟 make 生成的产物一样,都是可执行的文件,但是不能直接在 nand flash 上启动,需要通过u-boot,读取到 RAM中执行 - `mkimage` 打包后的 镜像文件,在原 固件上增加了 64字节的 `header` 镜像信息,可以使用 bootm 引导,传递一些 固件相关的信息等 ![2022-06-18_105625.png](https://oss-club.rt-thread.org/uploads/20220618/70e0b82f6d1126041bcde8bfb8efdf36.png "2022-06-18_105625.png") - 通过以上的操作,全志 Tina Linux SDK 中的代码,如u-boot 基本上不需要更改 - `rootfs` 分区好像rt-smart暂时没有用的,为了减少`pack` 后的镜像体积,可以 把 `rootfs` 这个分区先注释掉,修改方法为:`tina-d1-h/device/config/chips/d1-h/configs/nezha/sys_partition.fex`文件,注释掉 `rootfs` 分区 ![2022-06-18_110032.png](https://oss-club.rt-thread.org/uploads/20220618/d57a3b2d927138300592b3821b262ed6.png "2022-06-18_110032.png") - windows 下 使用 全志平台烧写工具`PhoenixSuit.exe` 进行烧写,这里烧写到 spi nand flash 中,方法为 打开 `PhoenixSuit.exe`,选择 烧写的文件,如:`tina_d1-h-nezha_uart0.img`,此时开发板断电,按住【FEL】按键不放,USB 线插入 【OTG】的那个 USB 口,烧写工具:`PhoenixSuit.exe` 会自动进入烧写状态,此时就可以松开【FEL】按键 ![2022-06-18_110526.png](https://oss-club.rt-thread.org/uploads/20220618/9ab76461f1b671ba0e6b7dfb4ee6e078.png.webp "2022-06-18_110526.png") - 按住【FEL】按键,并且插入 USB 【OTG】后,进入烧写模式 ![2022-06-18_110813.png](https://oss-club.rt-thread.org/uploads/20220618/f583a47a1e9ee54be8510d0d070bb21a.png.webp "2022-06-18_110813.png") - 此时松开【FEL】按键,等待烧写完成,烧写过程,串口有打印信息 ![2022-06-18_110925.png](https://oss-club.rt-thread.org/uploads/20220618/47fd473d2fb416908894fb05ea6a83ad.png.webp "2022-06-18_110925.png")
1
条评论
默认排序
按发布时间排序
登录
注册新账号
关于作者
张世争
学以致用
文章
131
回答
813
被采纳
177
关注TA
发私信
相关文章
1
rt-smart发布时间
2
rt-smart qemu-vexpress-a9 编译报错
3
rt-smart分支编译rasp4-32bsp报错
4
rt-smart qemu-vexpress-a9 win10编译脚本问题
5
rt-smart qemu-vexpress-a9 linux 下crtl+c
6
rt-smart + pthread 编译报错
7
rt-smart的rt_channel实现问题
8
关于rt-smart的musl-libc
9
RT-Smart Windows 编译 qemu-vexpress-a9 出错
10
用户程序在RT-Smart存在的方式
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
DMA
USB
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
cubemx
WIZnet_W5500
ota在线升级
PWM
BSP
flash
freemodbus
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
GD32
flashDB
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
keil_MDK
ulog
SFUD
msh
C++_cpp
MicroPython
本月问答贡献
RTT_逍遥
8
个答案
2
次被采纳
三世执戟
7
个答案
1
次被采纳
KunYi
6
个答案
1
次被采纳
winfeng
2
个答案
1
次被采纳
chenyaxing
2
个答案
1
次被采纳
本月文章贡献
出出啊
1
篇文章
4
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
投诉
建议
回到
底部