qnx学习笔记-QNX系统下载graphic镜-卡在Load QNX image from SDMMC...卡住不动

锋影

e-mail 174176320@qq.com


TQE9开发板下载带有图形界面的qnx-ifs系统镜像后总是无法启动,卡在Load QNX image from SDMMC...

分析问题之前,先分析一下sabreARD-graphics.build的启动脚本,镜像文件说明如下:

[html]  view plain  copy
  1. [image=0x10800000]  
  2. # For u-boot, IFS image should be uncompressed  
  3. [virtual=armle-v7,raw] .bootstrap = {  
  4. # For IPL, IFS image should be compressed  
  5. #[virtual=armle-v7,raw +compress] .bootstrap = {  
  6.   
  7.     # Startup parameters:  
  8.     # '-b' -> enable BT (conflicts with SPI NOR and PCIe)  
  9.     # '-m' -> enable d-cache/MMU (improves boot time)  
  10.     # '-W' -> enable watchdog (wdtkick should be uncommented when using this option)  
  11.     # Note:only ONE of below option may be selected for NOR flash  
  12.     # '-n0' -> no NOR Flash (I2C3 enabled)  
  13.     # '-n1' -> parallel NOR Flash (I2C3 disabled)  
  14.     # '-n2' -> SPI NOR Flash (I2C3 disabled)  
  15.     #  
  16.     # '-c' -> CAN startup option (conflicts with Ethernet)  
  17.     # '-s' -> Use SDMA to load IFS  
  18.     # '-r' -> to reserve the top 256M of RAM (0x80000000 -- 0x8FFFFFFF) so that  
  19.     # screen will work properly. There is an issue with the graphics processor  
  20.     # on the i.MX6 Quad Plus  where the code will not run if allocated in this  
  21.     # block of memory. This is an interm fix until the problem is resolved by  
  22.     # NXP.  
  23.     # startup-imx6x-sabreARD -n0 -m -r 0x80000000,256M  
  24.   
  25.     # Otherwise use the following version of startup to access the full range of RAM  
  26.     startup-imx6x-sabreARD -n1 -m -W -s  
  27.     PATH=/proc/boot:/bin:/usr/bin:/opt/bin/sbin:/usr/sbin LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/lib/dll/pci:/opt/lib procnto-smp-instr  
  28. }  
image表示镜像需要加载到的地址,也就是系统会从该地址启动。查看手册virtual属性的配置格式为:virtual=[cpu_name ,]bootfile_name [filter_args ]。

armle-v7:CPU type

raw:Create a binary image with an instruction sequence at its beginning to jump
that when you download a raw image to memory using a bootloader, you can
then instruct it to run right at the beginning of the image, rather than having
to figure out what the actual startup_vaddr is each time you modify the
startup code.

+compress: compress flag.

compress参数会指明要不要对镜像进行压缩。对于u-boot来讲,镜像是不可以被压缩的,否则设备无法启动。默认加载的镜像image地址是0x10800000,如果代码中加载镜像的地址与build中image值不一致,则需要使用-s参数,使用SDMA加载IFS。

分析我单板的问题:无论是否进行压缩,单板始终都无法正常启动,但同样生成的不带graphic的镜像却可以正常启动,经过层层定位分析:问题出现在接口fat_copy_file上,该接口的逻辑实现:如果当前存储数据的块是连续的,则会一次性把连续块上的内容全部读取出来;如果不连续,则只读当前块的内容。问题就是一次性把连续块上的内容都读取出来的时候存在异常,这个也不知道是emmc的问题还是bsp版本实现的问题。当我们强制让emmc分多次将连续块上的内容分多次读取出来的时候,大包便可以启动了。代码如下:

[html]  view plain  copy
  1. /*  copy a file from to a memory location */  
  2. static int  
  3. fat_copy_file(unsigned cluster, unsigned size, unsigned char *buf)  
  4. {  
  5.   #if 1  
  6.     int        result, txf;  
  7.     unsigned   prev_c, next_c, curr_c;  
  8.     int     sz  = (int)size;  
  9.     int     cbytes = fs_info.cluster_size*SECTOR_SIZE;  
  10.     int actual_len = 0;  
  11.   
  12.     if(sdmmc_debug > 1)  
  13.     {  
  14.          ser_putstr((char *)"fat_copy_file: cs 0x");  
  15.          ser_puthex(fs_info.cluster_size);  
  16.          ser_putstr((char *)" size 0x");  
  17.          ser_puthex(sz);  
  18.          ser_putstr((char *)"type 0x");  
  19.          ser_puthex(fs_info.fat_type );  
  20.          ser_putstr((char *)"\n");  
  21.     }  
  22.   
  23. #if 1  
  24.     cache_valid = 1;  
  25. #endif  
  26.     g_fat_sector = -1;  
  27.       
  28.     /*  
  29.     *Note that this impl assume the following:  
  30.     * 1) The max DMA transfer size is bigger than the max consolidate transfer size  
  31.     * Otherwise, we need to break down into smaller transfer.  
  32.     * 2) we always do at least one whole cluster transfer. This might overwrite the client buffer, but  
  33.     * since this is purely used for IPL, we don't care about that now.  
  34.     */  
  35.     curr_c = cluster;  
  36.     while(sz>0){  
  37.         txf = cbytes;  
  38.         prev_c = curr_c;  
  39.         while(sz>txf){  
  40.            //try consolidate contigus entry;  
  41.             next_c = fat_get_fat_entry(curr_c);  
  42.             if(next_c == (curr_c+1)  && txf > 20*SECTOR_SIZE){  
  43.                 txf +=cbytes;  
  44.                 curr_c = next_c;  
  45.             }else{  
  46.                 curr_c = next_c;  
  47.                 break;  
  48.             }  
  49.         }  
  50.         if(sdmmc_debug > 4)  
  51.         {  
  52.             ser_putstr((char *)"blkcnt 0x");  
  53.             ser_puthex(txf/SECTOR_SIZE);  
  54.             ser_putstr((char *)" p 0x");  
  55.             ser_puthex(prev_c);  
  56.             ser_putstr((char *)" n 0x");  
  57.             ser_puthex(curr_c);  
  58.             ser_putstr((char *)"\n");  
  59.         }  
  60.         //read the contig cluster out  
  61.         resultread_fsector(cluster2fsector(prev_c), buf, txf/SECTOR_SIZE) ;  
  62.         if (result != SDMMC_OK)  
  63.            return result;  
  64.         sz     -txf;  
  65.         buf  += txf;  
  66.         actual_len += txf;  
  67.     }  
  68. #else  
  69.   
  70.   int     sz  = (int)size;  
  71.   
  72.     while(!end_of_file(cluster) && (sz > 0)) {  
  73.         int txf = MIN(sz, fs_info.cluster_size * SECTOR_SIZE);  
  74.   
  75.         if (SDMMC_OK != read_cluster(cluster, buf, txf)) {  
  76.             ser_putstr("      Error - read_clust(): clust buf txf = ");  
  77.             ser_puthex((unsigned int)clust); ser_putstr(" ");  
  78.             ser_puthex((unsigned int)buf); ser_putstr(" ");  
  79.             ser_puthex((unsigned int)txf); ser_putstr("\n");  
  80.             return SDMMC_ERROR;  
  81.         }  
  82.         ser_putstr((char *)"cluster %x");  
  83.         ser_puthex(cluster);  
  84.         ser_putstr((char *)"\n");  
  85.   
  86.         sz   -txf;  
  87.         buf  += txf;  
  88.         cluster = fat_get_fat_entry(cluster);  
  89.     }  
  90. #endif  
  91.   
  92.     if(sdmmc_debug > 0)  
  93.     {  
  94.         ser_putstr("Actual read fs size = 0x");  
  95.         ser_puthex(actual_len);  
  96.         ser_putstr("\n");  
  97.     }  
  98.     return SDMMC_OK;  
  99. }  

即将连续块上超过10M的数据的分多次读写。这样修改完成之后,镜像可以正常启动。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值