Bläddra i källkod

fix art-pi smart boot from emmc (#8904)

* fix art-pi smart boot from emmc

* fix art-pi smart boot from emmc

* fix art-pi smart boot from emmc
xiao-mang 1 år sedan
förälder
incheckning
89164b19a8

+ 23 - 4
bsp/nxp/imx/imx6ull-smart/README.md

@@ -30,11 +30,14 @@ ART-pi smart采用了米尔科技的imx6ull核心板,硬件由韦东山团队
 > * [x]  xmake 构建环境
 > * [x]  busybox
 > * [x]  smart-apps
+> * [x]  ash  支持ash开机自启动
+> * [x]  emmc 从emmc启动内核、挂载文件系统
 > 
 > ### 待完善、修复
-> * [ ]  ash  支持ash开机自启动
+
 > * [ ]  网络 以太网网络问题修复
-> * [ ]  emmc 从emmc启动内核、挂载文件系统
+> * [ ]  信号 信号处理问题修复
+
  
 ## 应用编译
 
@@ -64,7 +67,7 @@ scons -j12
 
 ## 启动内核
 
-* 从eMMC中加载运行(目前不推荐)
+* 从eMMC中加载运行
 
 ```bash
 bootcmd=fatload mmc 1:1 0x80001000 /kernel/rtthread.bin; dcache flush; go 0x80001000
@@ -78,8 +81,24 @@ dcache flush
 go 0x80001000
 ```
 
-* 从sd卡启动 (目前推荐)
+* 从sd卡启动
 
 ```bash
 fatload mmc 0:1 0x80001000 rtthread.bin; dcache flush; go 0x80001000
 ```
+
+## 制作从emmc启动所用映像文件
+
+* 在rt-thread/bsp/nxp/imx/imx6ull-smart/emmc下按照emmc.sh内容进行制作,
+  生成物art-pi.img在rt-thread/bsp/nxp/imx/imx6ull-smart/emmc/image/images下
+
+* 使用100ask_imx6ull_flashing_tool.exe工具进行烧写
+
+* 工具获取https://github.com/100askTeam/gui_for_nxp_uuu/blob/master/100ask_imx6ull%E7%83%A7%E5%86%99%E5%B7%A5%E5%85%B7/100ask_imx6ull_flashing_tool.exe
+  
+* 烧写说明:
+  
+  * 在烧写软件的基础版,点击更新uboot![alt text](image-1.png)
+  
+  * 在烧写软件的专业版,烧写制作的映像文件art-pi.img![alt text](image-2.png)
+  

+ 9 - 0
bsp/nxp/imx/imx6ull-smart/applications/mnt.c

@@ -20,6 +20,15 @@ int mnt_init(void)
     rt_thread_mdelay(500);
 
     int part_id = 0;
+    if (dfs_mount("emmc0", "/", "elm", 0, (void *)part_id) != 0)
+    {
+        rt_kprintf("Dir / emmc mount failed!\n");
+        return -1;
+    }
+    else
+    {
+        rt_kprintf("emmc file system initialization done!\n");
+    }
 
     if (dfs_mount("sd0", "/", "elm", 0, (void *)part_id) != 0)
     {

+ 12 - 0
bsp/nxp/imx/imx6ull-smart/emmc.sh

@@ -0,0 +1,12 @@
+sudo mount ./boot.fat ./tmp/
+sudo rm -rf tmp/kernel/*
+sudo cp -rp ../rtthread.bin tmp/kernel/
+sudo cp -rp ../rtthread.elf tmp/kernel/
+sudo cp -rp ../rtthread.img tmp/kernel/
+sudo cp -rp ../rtthread.imx tmp/kernel/
+sudo sync
+sudo umount ./tmp
+sudo cp boot.fat image/input/
+cd image
+rm -rf tmp
+./genimage

BIN
bsp/nxp/imx/imx6ull-smart/emmc/boot.fat


BIN
bsp/nxp/imx/imx6ull-smart/emmc/image/genimage


+ 27 - 0
bsp/nxp/imx/imx6ull-smart/emmc/image/genimage.cfg

@@ -0,0 +1,27 @@
+# Minimal SD card image for the Freescale boards Template
+#
+# We mimic the .sdcard Freescale's image format:
+# * the SD card must have 1 kB free space at the beginning,
+# * U-Boot is dumped as is,
+# * a FAT partition at offset 8 MB is containing zImage/uImage and DTB files
+# * a single root filesystem partition is required (ext2, ext3 or ext4)
+#
+
+
+image  art-pi.img {
+  hdimage {
+	}
+  partition u-boot {
+    in-partition-table = "no"
+    image = "u-boot-dtb.imx"
+    offset = 1024
+    size = 2M
+  }
+
+  partition rootfs {
+    partition-type = 0xc
+    image = "boot.fat"
+    size = 200M
+  }
+
+}

BIN
bsp/nxp/imx/imx6ull-smart/emmc/image/input/boot.fat


BIN
bsp/nxp/imx/imx6ull-smart/image-1.png


BIN
bsp/nxp/imx/imx6ull-smart/image-2.png


+ 3 - 1
bsp/nxp/imx/imx6ull-smart/rtconfig.py

@@ -41,6 +41,7 @@ if PLATFORM == 'gcc':
         CFLAGS   += ' -Os'
         CXXFLAGS += ' -Os'
     CXXFLAGS += ' -Woverloaded-virtual -fno-rtti'
+    MKIMAGE = '-t imximage -b rtthread.bin -o rtthread.imx -g rtthread.img -a 0x80001000'
 
     M_CFLAGS = CFLAGS + ' -mlong-calls -fPIC '
     M_CXXFLAGS = CXXFLAGS + ' -mlong-calls -fPIC'
@@ -49,4 +50,5 @@ if PLATFORM == 'gcc':
     M_POST_ACTION = STRIP + ' -R .hash $TARGET\n' + SIZE + ' $TARGET \n'
 
     DUMP_ACTION = OBJDUMP + ' -D -S $TARGET > rtt.asm\n'
-    POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+    POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n' +\
+              'python3 mkimage.py ' + MKIMAGE + '\n'