彩票網(wǎng)站建設(shè)方案看網(wǎng)站時的關(guān)鍵詞
想必RT-Thread系統(tǒng)大家不陌生了,RT-Thread Smart(簡稱 rt-smart)是基于 RT-Thread 操作系統(tǒng)衍生的新分支,面向帶 MMU,中高端應(yīng)用的芯片,例如 ARM Cortex-A 系列芯片,MIPS 芯片,帶 MMU 的 RISC-V 芯片等。rt-smart 在 RT-Thread 操作系統(tǒng)的基礎(chǔ)上啟用獨立、完整的進程方式,同時以混合微內(nèi)核模式執(zhí)行。
官方文檔: https://www.rt-thread.org/document/site/#/rt-thread-version/rt-thread-smart/rt-smart-quickstart/rt-smart-quickstart
內(nèi)核:rt_smart_kernel.bin
硬件:麻雀,MQ1或MQ1W
RT-smart包(自帶編譯器):mango_rtsmart_app.zip
1. 分區(qū)
使用fdisk分區(qū)。
將u盤掛載到ubuntu系統(tǒng)后,筆者設(shè)備路徑是/dev/sdb。使用的32GB TF卡,扇區(qū)大小512字節(jié),根據(jù)說明預(yù)留8M的空閑,那么計算得知分區(qū)扇區(qū)開始于:16384
命令:sudo fdisk /dev/sdb
選:o,n,p,1,16384,回車
Command (m for help): o
Created a new DOS disklabel with disk identifier 0x3668b987.Command (m for help): n
Partition typep primary (0 primary, 0 extended, 4 free)e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62410751, default 2048): 16384
Last sector, +sectors or +size{K,M,G,T,P} (16384-62410751, default 62410751): Created a new partition 1 of type 'Linux' and of size 29.8 GiB.Command (m for help): w
The partition table has been altered.
正確的分區(qū)效果如下:
mango@virtual:/dev$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 29.8 GiB, 31954305024 bytes, 62410752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3668b987Device Boot Start End Sectors Size Id Type
/dev/sdb1 16384 62410751 62394368 29.8G 83 Linux
mango@virtual:/dev$
然后格式化sdb1:
$ sudo mkfs -t fat /dev/sdb1
2. 刷入rt-smart內(nèi)核
$ sudo dd if=rt_smart_kernel.bin of=/dev/sdb bs=1024
2888+1 records in
2888+1 records out
2957313 bytes (3.0 MB, 2.8 MiB) copied, 8.32574 s, 355 kB/s
$ sync
3. 啟動rtt
此時將TF卡放入麻雀,串口0(底部排針的7,8腳),串口波特率500000,然后上電:
[26]HELLO! BOOT0 is starting!
[27]BOOT0 commit : fb73c68
[28]set pll start
[28]periph0 has been enabled
[29]set pll end
[30]board init ok
[30]ZQ value = 0x2f***********
[31]get_pmu_exist() = -1
[32]ddr_efuse_type: 0xa
[33][AUTO DEBUG] single rank and full DQ!
[34]ddr_efuse_type: 0xa
[35][AUTO DEBUG] rank 0 row = 13
[36][AUTO DEBUG] rank 0 bank = 4
[37][AUTO DEBUG] rank 0 page size = 2 KB
[37]DRAM BOOT DRIVE INFO: V0.24
[38]DRAM CLK = 528 MHz
[39]DRAM Type = 2 (2:DDR2,3:DDR3)
[40]DRAMC read ODT off.
[40]DRAM ODT off.
[41]ddr_efuse_type: 0xa
[42]DRAM SIZE =64 M
[44]DRAM simple test OK.
[45]dram size =64
[45]card no is 0
[45]sdcard 0 line count 4
[46][mmc]: mmc driver ver 2021-04-2 16:45
[52][mmc]: Wrong media type 0x0
[53][mmc]: ***Try SD card 0***
[60][mmc]: HSSDR52/SDR25 4 bit
[61][mmc]: 50000000 Hz
[61][mmc]: 30474 MB
[62][mmc]: ***SD/MMC 0 init OK!!!***
[98]Loading boot-pkg Succeed(index=0).
[99]*******************TOC1 Item Message*************************
[100]Entry_name = opensbi
[101]Entry_data_offset = 0x600
[102]Entry_data_len = 0x188e0
[103]encrypt = 0x0
[103]Entry_type = 0x0
[104]run_addr = 0x40000000
[105]index = 0x0
[105]Entry_end = 0x3b454949
[106]*************************************************************
[108]*******************TOC1 Item Message*************************
[109]Entry_name = dtb
[110]Entry_data_offset = 0x19000
[111]Entry_data_len = 0x7475
[111]encrypt = 0x0
[112]Entry_type = 0x0
[113]run_addr = 0x40200000
[114]index = 0x0
[114]Entry_end = 0x3b454949
[115]*************************************************************
[117]*******************TOC1 Item Message*************************
[118]Entry_name = kernel
[119]Entry_data_offset = 0x20600
[120]Entry_data_len = 0xa6cf0
[120]encrypt = 0x0
[121]Entry_type = 0x0
[122]run_addr = 0x40400000
[123]index = 0x0
[123]Entry_end = 0x3b454949
[124]*************************************************************
[126]Jump to second Boot.OpenSBI v0.9-165-gefbc2b8____ _____ ____ _____/ __ \ / ____| _ \_ _|| | | |_ __ ___ _ __ | (___ | |_) || || | | | '_ \ / _ \ '_ \ \___ \| _ < | || |__| | |_) | __/ | | |____) | |_) || |_\____/| .__/ \___|_| |_|_____/|____/_____|| ||_|Platform Name : Allwinner D1 NeZha
Platform Features : medeleg
Platform HART Count : 1
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 24000000Hz
Platform Console Device : uart8250
Platform HSM Device : ---
Platform Reboot Device : sunxi-wdt-reset
Platform Shutdown Device : ---
Firmware Base : 0x40000000
Firmware Size : 248 KB
Runtime SBI Version : 0.3Domain0 Name : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00 : 0x0000000014008000-0x000000001400bfff (I)
Domain0 Region01 : 0x0000000014000000-0x0000000014007fff (I)
Domain0 Region02 : 0x0000000040000000-0x000000004003ffff ()
Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000040400000
Domain0 Next Arg1 : 0x0000000040200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yesBoot HART ID : 0
Boot HART Domain : root
Boot HART ISA : rv64imafdcvsux
Boot HART Features : scounteren,mcounteren,mcountinhibit,time
Boot HART PMP Count : 16
Boot HART PMP Granularity : 2048
Boot HART PMP Address Bits: 38
Boot HART MHPM Count : 0
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b1ff
heap: [0x404fbdf4 - 0x41cfbdf4]
[I/I2C] I2C bus [i2c2] registered\ | /
- RT - Thread Smart Operating System/ | \ 5.0.0 build Dec 31 20212006 - 2020 Copyright by rt-thread team
lwIP-2.1.2 initialized!
SDC:hal_sdc_create host:000000004051bdf8 id:0
SDC:Not implement __mci_restore_io,798
SDC:Not imp hal_sdc_init,2218
SDC:hal_sdc_init,2251 no imp
SDC:hal_sdc_init,2259 no imp
SDC:SDC Host Capability:0x3820f Ocr avail:0x3f0000
SDC:SDC cd_mode:2 present_val:0
SDC:SDC id:0 dma_use:1 present:1driver version SD/MMC/SDIO Host Controller Driver(v0.27 2021-04-30 16:50) init ok.
card_detect insert
SD:mmc_card_create card:000000004052e1a8 id:0
SDC:Not implement __mci_restore_io,798
SDC:SDC clock=400000 kHz,src:0, n:1, m:14
SDC:SDC clock=400000 kHz,src:0, n:1, m:14
SD:***** Try sd *****
SD:card ocr: ffffffffc0ff8000
SD:Card CID number:55
SD:card raw cid:
SD:card raw csd:
SD:card raw scr:
SD:card raw SD status:
SDC:SDC clock=50000000 kHz,src:1, n:0, m:5
SD:card is switched to high speed mode, clk:50000 KHz
SD:Set bus width type: 2
SD:
============= card information ==============
SD:Card Type : SDHC
SD:Card Spec Ver : 5.0
SD:Card RCA : 0x0001
SD:Card OCR : 0x40ff8000
SD: vol_window : 0x00ff8000
SD: to_1v8_acpt : 0
SD: high_capac : 0
SD:Card CSD :
SD: speed : 50000 KHz
SD: cmd class : 0x5b5
SD: capacity : 30474MB
SD:Card CUR_STA :
SD: speed_mode : HS: 50 MHz
SD: bus_width : 2
SD: speed_class : 10
SD:=============================================
SD:***** sd init ok *****
Initial card success
[I/sal.skt] Socket Abstraction Layer initialize success.
file system initialization done!
gt9xx_probe
Hello RISC-V
msh />[D/TOUCH.gt9xx] 39 31 31 0 0
[I/TOUCH.gt9xx] Found chip gt911
[I/TOUCH.gt9xx] GT9xx Config version: 0x00
[I/TOUCH.gt9xx] GT9xx Sensor id: 0xFFmsh />
4. 運行應(yīng)用程序
祭出祖?zhèn)鱤ello程序:根據(jù)說明自行編譯,輸出為:hello.elf 文件,直接
拷貝到TF卡的文件系統(tǒng)中
然后重新將tf卡放進麻雀,開機啟動:
msh />ls
Directory /:
System Volume Information<DIR>
etc <DIR>
hello.elf 237512
vi.elf 398544
msh />
msh />./hello.elf
msh />hello world!
至此,吊炸天的hello程序就運行起來了!
5. 擴展之編譯
- 請在Linux下使用此開發(fā)環(huán)境包(已經(jīng)自帶64位Linux系統(tǒng)的編譯器環(huán)境),如果要在Windows下使用,請自行配置安裝編譯在tools目錄下,然后參照smart-env.sh里的腳本配置好環(huán)境變量。
- 在Linux下使用步驟:
- 首先執(zhí)行
source smart-env.sh riscv64
,也可以根據(jù)自己的環(huán)境稍作修改。 - 進入userapp目錄進行應(yīng)用編譯,例如編譯自帶的hello應(yīng)用程序,只需要執(zhí)行
scons --app=hello
。 - 編譯好的應(yīng)用程序會生成在root/bin目錄下,將其拷貝到SD卡中(注意是8M偏移的起始分區(qū)),然后進入rt-smart系統(tǒng)中,啟動掛載成功后即可運行。
- 首先執(zhí)行