鸣涧 发表于 2022-5-6 23:11:03

Uboot 命令TFTP下载RT-Smart系统镜像并烧写到emmc

Uboot 命令TFTP 下载RT-Smart系统镜像并烧写到emmc



上回说到Windows下通过 UbootTFTP 方式下载和启动rt-smart 内核, 其实只是通过TFTP下载rt-smart 内核到内存,启动开发板,并不是下载到emmc(ROM),怎么烧写emmc呢? 下面讲解


准备


[*]    设置TFTP服务
[*]    设置开板板IP
[*]    设置服务器TFTP

请到上回Windows下通过 UbootTFTP 方式下载和启动rt-smart 内核

下载系统镜像
=> tftp emmc.img
Using ethernet@02188000 device
TFTP from server 192.168.0.26; our IP address is 192.168.0.100
Filename 'emmc.img'.
Load address: 0x80800000
Loading: #################################################################
         #################################################################
         .......
         ####################
         1.6 MiB/s
done
Bytes transferred = 69207040 (4200400 hex)
提示下载启始地址0x80800000,大小69207040Bytes /512Bytes/blk = 135170 转换为16进制 0x21002

写入emmmc

按上面计算写emmc命令为mmc write 0x80800000 0 21002
=> mmc write 0x80800000 0 21002

MMC write: dev # 1, block # 0, count 135170 ... 135170 blocks written: OK
注:从内存地址0x80800000开始 写到emmc0blk开始写 135170(x21002) blks(块) 



 这时看uboot环境还是之前的,这内存的,boo可以直接启动

设置uboot环境变量并保存:
第二次不了,环境变量,是新系统镜像的,所以要重新设置一下setenv bootcmd "fatload mmc 1:1 0x80001000 /kernel/rtthread.bin; dcache flush; go 0x80001000"
saveenv

RT-Smart系统命令:
boot

执行结果:
=> setenv bootcmd "fatload mmc 1:1 0x80001000 /kernel/rtthread.bin; dcache flush; go 0x80001000"
=> saveenv
Saving Environment to MMC...
Writing to MMC(1)... done
=> boot
reading /kernel/rtthread.bin
1182208 bytes read in 52 ms (21.7 MiB/s)
## Starting application at 0x80001000 ...

\ | /
- RT -   Thread Smart Operating System
/ | \   5.0.0 build Dec 23 2021
2006 - 2020 Copyright by rt-thread team
lwIP-2.1.2 initialized!
E/drv.enet: emac device init success

I/I2C: I2C bus registered
I/I2C: I2C bus registered
E/drv.enet:
PHY Link down, please check the cable connection and link partner setting.

I/SDIO: emmc card capacity 3817472 KB.
found part, begin: 2098176, size: 128.0MB
found part, begin: 136315904, size: 128.0MB
I/touch: rt_touch init success
I/gt911: touch device gt911 init success
I/sal.skt: Socket Abstraction Layer initialize success.
emmc file system initialization done!
Dir / sd0 mount failed!
E/: The wifi Stage 1 status 0 0 0 1
I/WLAN.dev: wlan init success
I/WLAN.lwip: eth device init ok name:w0
I/WLAN.dev: wlan init success
I/WLAN.lwip: eth device init ok name:w1

rw007sn:
rw007 ver:

D/drv.enet: enet1 link up

W/WLAN.mgnt: F:rt_wlan_connect L:1091 not find ap! ssid:rt-thread
hello rt-smart!
/sd/wifi.sh wi-fi configuration file not exist in sd card!
I/mcf.link.tcp: TCPServer Waiting for client on port 5555...

I/mcf.link: MCF link port(3) register successfully.
msh /> I/mcf.trans: MCF(V0.1.0) initialized successfully.
I/urpc: uRPC(V0.1.0) initialize successfully.
I/mcf.trans: MCF protocol started successfully.



内核成功启动,试试命令
msh />
msh />ls
Directory /:
kernel            <DIR>
root                <DIR>
sd                  <DIR>
msh />
RT-Thread shell commands:
reboot         - reboot system
cpu_usage      - display cpu usage
dbg            - dbg
memcheck         - check memory data
memtrace         - dump memory trace information
gic_dump         - show gic status
list_page      - show page info
list_fd          - list file descriptor
lsof             - list open files
mount            - mount<device><mountpoint><fstype>
unmount          - unmount the mountpoint
hello            - say hello world
clear            - clear the terminal screen
version          - show RT-Thread version information
list_thread      - list thread
list_sem         - list semaphore in system
list_event       - list event in system
list_mutex       - list mutex in system
list_mailbox   - list mail box in system
list_msgqueue    - list message queue in system
list_memheap   - list memory heap in system
list_mempool   - list memory pool in system
list_timer       - list timer in system
list_device      - list device in system
list             - list all symbol in system
help             - RT-Thread shell help.
ps               - List threads in the system.
free             - Show the memory usage in the system.
ls               - List information about the FILEs.
cp               - Copy SOURCE to DEST.
mv               - Rename SOURCE to DEST.
cat            - Concatenate FILE(s)
rm               - Remove(unlink) the FILE(s).
cd               - Change the shell working directory.
pwd            - Print the name of the current working directory.
mkdir            - Create the DIRECTORY.
mkfs             - format disk with file system
df               - disk free
echo             - echo string to file
set            - set or show environment variable
list_channel   - list IPC channel information
list_process   - list process
kill             - send a signal to a process
killall          - kill processes by name
list_shm         - show share memory info
sys_log          - sys_log 1(enable)/0(disable)
ifconfig         - list the information of all network interfaces
ping             - ping network host
dns            - list and set the information of dns
netstat          - list the information of TCP / IP
pwm_enable       - pwm_enable pwm1 1
pwm_disable      - pwm_disable pwm1 1
pwm_set          - pwm_set pwm1 1 100 50
date             - get date and time or set
wifi             - wifi command.

msh />

nice成功了

鸣涧 发表于 2022-5-10 21:33:48

设置uboot启动延时
setenv bootdelay 0

fannifu 发表于 2022-5-12 21:16:09

本帖最后由 fannifu 于 2022-5-12 23:45 编辑

dhcp 下截 emmc.img 烧录
dhcp 0x80800000 192.168.0.38:emmc.img

fannifu 发表于 2022-5-12 23:46:59

烧录
mmc write 0x80800000 0 41AA

fannifu 发表于 2022-5-12 23:58:47

烧写uboot
mmc write 0x80800000 1 3fe
页: [1]
查看完整版本: Uboot 命令TFTP下载RT-Smart系统镜像并烧写到emmc