乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      uboot_mt7620對SPI flash操作的分析

       mrjbydd 2014-01-13

      接上篇文章,AR9331系統(tǒng)與mt7620系統(tǒng)對flash的劃分是不一樣的,AR系統(tǒng)劃分為Flash(可能是作為NAND來處理),而mt7620(mips)系統(tǒng)則劃分的比較明確,用的是SPI_FLASH。

      在uboot的啟動(dòng)界面上,可以看到這樣一些信息:

      1. Please choose the operation:   
      2.    1: Load system code to SDRAM via TFTP.   
      3.    2: Load system code then write to Flash via TFTP.   
      4.    3: Boot system code via Flash (default).  
      5.    4: Entr boot command line interface.  
      6.    7: Load Boot Loader code then write to Flash via Serial.   
      7.    9: Load Boot Loader code then write to Flash via TFTP.   

      于是,
      1. grep 'write to Flash via TFTP' -r .  
      找到:
      1. ./lib_mips/board.c: printf("   %d: Load system code then write to Flash via TFTP. \n", SEL_LOAD_LINUX_WRITE_FLASH);  
      2. ./lib_mips/board.c: printf("   %d: Load Boot Loader code then write to Flash via TFTP. \n", SEL_LOAD_BOOT_WRITE_FLASH);  
      3. ./lib_mips/board.c:         printf("   \n%d: System Load Linux Kernel then write to Flash via TFTP. \n", SEL_LOAD_LINUX_WRITE_FLASH);  
      4. ./lib_mips/board.c:         printf("   \n%d: System Load Boot Loader then write to Flash via TFTP. (.bin)\n", SEL_LOAD_BOOT_WRITE_FLASH);  
      打開board.c一看究竟。
      1. void OperationSelect(void)  
      2. {  
      3.     printf("\nPlease choose the operation: \n");  
      4.     printf("   %d: Load system code then write to Flash via Serial. \n", SEL_LOAD_LINUX_WRITE_FLASH_BY_SERIAL);  
      5.     printf("   %d: Load system code to SDRAM via TFTP. \n", SEL_LOAD_LINUX_SDRAM);  
      6.     printf("   %d: Load system code then write to Flash via TFTP. \n", SEL_LOAD_LINUX_WRITE_FLASH);  
      7.     printf("   %d: Boot system code via Flash (default).\n", SEL_BOOT_FLASH);  
      8. #ifdef RALINK_CMDLINE  
      9.     printf("   %d: Entr boot command line interface.\n", SEL_ENTER_CLI);  
      10. #endif // RALINK_CMDLINE //  
      11.   
      12. #if defined(ASUS_RTN14U)  
      13.     printf("   %d: Load Boot Loader code to SDRAM via Serial. \n", SEL_LOAD_BOOT_SDRAM_VIA_SERIAL);  
      14. #endif    
      15. #ifdef RALINK_UPGRADE_BY_SERIAL  
      16.     printf("   %d: Load Boot Loader code then write to Flash via Serial. \n", SEL_LOAD_BOOT_WRITE_FLASH_BY_SERIAL);  
      17. #endif // RALINK_UPGRADE_BY_SERIAL //  
      18.   
      19. #if defined(ASUS_RTN14U)  
      20.     printf("   %d: Load Boot Loader code to SDRAM via TFTP. \n", SEL_LOAD_BOOT_SDRAM);  
      21. #endif  
      22.     printf("   %d: Load Boot Loader code then write to Flash via TFTP. \n", SEL_LOAD_BOOT_WRITE_FLASH);  
      23. }  
      調(diào)用層次為:【./cpu/ralink_soc/start.S: la t9, board_init_r】→【board_init_r】→【OperationSelect】
      1.         case '2':  
      2.             printf("   \n%d: System Load Linux Kernel then write to Flash via TFTP. \n", SEL_LOAD_LINUX_WRITE_FLASH);  
      3.             printf(" Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)\n");  
      4.             confirm = getc();  
      5.             if (confirm != 'y' && confirm != 'Y') {  
      6.                 printf(" Operation terminated\n");  
      7.                 break;  
      8.             }  
      9.             tftp_config(SEL_LOAD_LINUX_WRITE_FLASH, argv);  
      10.             argc= 3;  
      11.             setenv("autostart""no");  
      12.             do_tftpb(cmdtp, 0, argc, argv);  
      13.   
      14. #if defined (CFG_ENV_IS_IN_NAND)  
      15.             if (1) {  
      16.                 unsigned int load_address = simple_strtoul(argv[1], NULL, 16);  
      17.                 ranand_erase_write((u8 *)load_address, CFG_KERN_ADDR-CFG_FLASH_BASE, NetBootFileXferSize);  
      18.             }  
      19. #elif defined (CFG_ENV_IS_IN_SPI)  
      20.             if (1) {  
      21.                 unsigned int load_address = simple_strtoul(argv[1], NULL, 16);  
      22.                 raspi_erase_write((u8 *)load_address, CFG_KERN_ADDR-CFG_FLASH_BASE, NetBootFileXferSize);  
      23.             }  
      24. #else //CFG_ENV_IS_IN_FLASH  
      25. #if (defined (ON_BOARD_8M_FLASH_COMPONENT) || defined (ON_BOARD_16M_FLASH_COMPONENT)) && (defined (RT2880_ASIC_BOARD) || defined (RT2880_FPGA_BOARD) || defined (RT3052_MP1))  
      26.             //erase linux  
      27.             if (NetBootFileXferSize <= (0x400000 - (CFG_BOOTLOADER_SIZE + CFG_CONFIG_SIZE + CFG_FACTORY_SIZE))) {  
      28.                 e_end = CFG_KERN_ADDR + NetBootFileXferSize;  
      29.                 if (0 != get_addr_boundary(&e_end))  
      30.                     break;  
      31.                 printf("Erase linux kernel block !!\n");  
      32.                 printf("From 0x%X To 0x%X\n", CFG_KERN_ADDR, e_end);  
      33.                 flash_sect_erase(CFG_KERN_ADDR, e_end);  
      34.             }  
      35.             else if (NetBootFileXferSize <= CFG_KERN_SIZE) {  
      36.                 e_end = PHYS_FLASH_2 + NetBootFileXferSize - (0x400000 - (CFG_BOOTLOADER_SIZE + CFG_CONFIG_SIZE + CFG_FACTORY_SIZE));  
      37.                 if (0 != get_addr_boundary(&e_end))  
      38.                     break;  
      39.                 printf("Erase linux kernel block !!\n");  
      40.                 printf("From 0x%X To 0x%X\n", CFG_KERN_ADDR, CFG_FLASH_BASE+0x3FFFFF);  
      41.                 flash_sect_erase(CFG_KERN_ADDR, CFG_FLASH_BASE+0x3FFFFF);  
      42.                 printf("Erase linux file system block !!\n");  
      43.                 printf("From 0x%X To 0x%X\n", PHYS_FLASH_2, e_end);  
      44.                 flash_sect_erase(PHYS_FLASH_2, e_end);  
      45.             }  
      46. #else  
      47.             if (NetBootFileXferSize <= (bd->bi_flashsize - (CFG_BOOTLOADER_SIZE + CFG_CONFIG_SIZE + CFG_FACTORY_SIZE))) {  
      48.                 e_end = CFG_KERN_ADDR + NetBootFileXferSize;  
      49.                 if (0 != get_addr_boundary(&e_end))  
      50.                     break;  
      51.                 printf("Erase linux kernel block !!\n");  
      52.                 printf("From 0x%X To 0x%X\n", CFG_KERN_ADDR, e_end);  
      53.                 flash_sect_erase(CFG_KERN_ADDR, e_end);  
      54.             }  
      55. #endif  
      56.             else {  
      57.                 printf("***********************************\n");  
      58.                 printf("The Linux Image size is too big !! \n");  
      59.                 printf("***********************************\n");  
      60.                 break;  
      61.             }  
      62.   
      63.             //cp.linux  
      64.             argc = 4;  
      65.             argv[0]= "cp.linux";  
      66.             do_mem_cp(cmdtp, 0, argc, argv);  
      67. #endif //CFG_ENV_IS_IN_FLASH  
      68.   
      69. #ifdef DUAL_IMAGE_SUPPORT  
      70.             /* Don't do anything to the firmware upgraded in Uboot, since it may be used for testing */  
      71.             setenv("Image1Stable""1");  
      72.             saveenv();  
      73. #endif  
      74.   
      75.             //bootm bc050000  
      76.             argc= 2;  
      77.             sprintf(addr_str, "0x%X", CFG_KERN_ADDR);  
      78.             argv[1] = &addr_str[0];  
      79.             do_bootm(cmdtp, 0, argc, argv);              
      80.             break;  

      調(diào)用的是 raspi_erase_write 方法來對spi flash進(jìn)行擦除和寫入。

        本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多