版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
NUC980U-Bootv2016_11使用手TheinformationdescribedinthisistheexclusiveinlectualpropertyofNuvotonTechnologyCorporationandshallnotbereproducedwithoutpermissionfromNuvoton.NuvotonisprovidingthisonlyforreferencepurposesofNUC980microprocessorbasedsystemNuvotonassumesnoresponsibilityforerrorsorAlldataandspecificationsaresubjecttochangewithoutForadditionalinformationorquestions,pleasecontact:NuvotonTechnology內(nèi)U-Boot使用說(shuō) 配 架 編譯U- 新增SPINOR配置并移除NAND配 新增SPI配置(NAND也使能 新增SPINAND配 U-Boot命 環(huán)境變 mkimage工 Watchdog 網(wǎng)絡(luò)測(cè)試環(huán) 加快SPIflash開機(jī)速 NANDflash相關(guān)Power-on U-BootU-Boot是一個(gè)主要用于嵌入式系統(tǒng)的啟動(dòng)加載程序,可以支持多種不同的計(jì)算器系統(tǒng)結(jié)構(gòu),包括ARM、MIPS、x86與68K。這也是一套在GNU通用公共證之下發(fā)布的自由軟體。U-Boot支持下列功能:網(wǎng)絡(luò):TFTP,BOOTP,串口:s-record,binary(viaFlash管理:抹除,讀Flash型別SPIflashNAND內(nèi)存工具:讀,寫,,比交互式s:命令,NUC980U-Bootv2016.11U-Boot是可配置的,U-Bootv2016.11來(lái)產(chǎn)生不同的配置,第二個(gè)方式是透過選單來(lái)配置。NUC980配置文件位于nuc980_evb.h中的各項(xiàng)定義#define#define/*12MHzcrystal#define#define#define#define#define#undef#undef#define1/*enablepassingof#defineCONFIG_SETUP_MEMORY_TAGS#define #defineCONFIG_SETUP_MEMORY_TAGSEXT_CLK外部晶振頻率,timerCONFIG_SYS_TEXT_BASEU-Boot:efineCONFIG_SYS_USE_SPIFLASH#defineCONFIG_SYS_USE_NANDFLASHefineCONFIG_SYS_USE_SPIFLASH#defineCONFIG_SYS_USE_NANDFLASH#define//#define//#define#define#define#define{115200,57600,/*kernelsize02#define#defineCONFIG_NUC980_EMAC0#defineCONFIG_NUC980_ETH#define1#define#define16//defaultis4,setto16#defineCONFIG_SYS_USE_SPIFLASHSPICONFIG_SYS_USE_NANDFLASHNANDCONFIG_ENV_IS_IN_NAND:環(huán)境變量在NANDflashCONFIG_ENV_IS_IN_SPI_FLASH:環(huán)境變量在NANDflashCONFIG_ENV_IS_IN_MMC:環(huán)境變量在eMMCCONFIG_HW_WATCHDOGwatchdogtimer(CONFIG_NUC980_WATCHDOG需:定義::CONFIG_NUC980_EMAC0:NUC980CONFIG_NUC980_EMAC1:NUC980CONFIG_NUC980_ETH:NUC980:CONFIG_ETHADDRMACCONFIG_SYS_RX_ETH_BUFFER:RxFrameDescriptorsCONFIG_SYS_DCACHE_OFF:D*BOOTP#define1#define1#define#define1#define1#defineCONFIG_BOOTP_SERVERIP/*tftpserveripnotoverruledbydhcp #defineCONFIG_CMD_NAND_YAFFS2#define1#define111111111#define#defineCONFIG_ENV_RANGE0x80000~0x100000*/(4*CONFIG_ENV_SECT_SIZE)/*Envrange#defineimage*//*OffsettoRAMU-#define#define/*baseaddressforuboot*/(CONFIG_SYS_SDRAM_BASE+NUBload- NUBstart- (500*/*SizeofRAMU-/*NANDchippage/*NANDchipblock(128*/*NANDchippageperblockcount#define #endif#endifCONFIG_NAND_NUC980NUC980NANDCONFIG_CMD_NANDnandCONFIG_MTD_DEVICEMTDCONFIG_MTD_PARTITIONS:MTDCONFIG_CMD_UBICONFIG_CMD_UBIFSUBIFS:CONFIG_RBTREEUBICONFIG_LZOUBIMTDIDS_DEFAULTMTD名稱:CONFIG_CMD_NAND_YAFFS2:啟動(dòng)YAFFS2CONFIG_YAFFS2YAFFS2CONFIG_SYS_MAX_NAND_DEVICE:NANDCONFIG_SYS_NAND_BASENANDcontrollerbase:::CONFIG_ENV_RANGE:定義環(huán)境變量的范圍,范圍是CONFIG_ENV_OFFSET到CONFIG_ENV_OFFSET+CONFIG_ENV_RANGE.(當(dāng)遇到環(huán)境變量的block是壞塊時(shí),U-Boot會(huì)將環(huán)境變量存到下一個(gè)block):放在CONFIG_SYS_UBOOT_SIZEU-Boot(codedata::CONFIG_SYS_NAND_PAGE_SIZE:NANDflashpageCONFIG_SYS_NAND_BLOCK_SIZENANDflashblockCONFIG_SYS_NAND_PAGE_COUNTNANDflashblock/*SPIflashtestcode*//*SPIflashtestcode*/#ifdefCONFIG_SYS_USE_SPIFLASH#define1#define #ifdefCONFIG_CMD_SFSPIflashsf::CONFIG_ENV_SECT_SIZEsector"U-Boot>(CONFIG_SYS_CBSIZEsizeof(CONFIG_SYS_PROMPT)+#define #define #define#define ">:::/*/*FollowingblockisforMMCsupport#define#defineCONFIG_CMD_FAT#defineCONFIG_CMD_FAT#defineCONFIG_DOS_PARTITION/*#defineCONFIG_NUC980_EMMC/*Don'tenableandNAND(CONFIG_NAND_NUC980)atthesametime!*/#ifdefCONFIG_ENV_IS_IN_MMC#define #define#define#define#defineCONFIG_NUC980_MMC:NUC980CONFIG_CMD_FATFATCONFIG_DOS_PARTITIONDOSCONFIG_NUC980_EMMC:CONFIG_SYS_MMC_ENV_DEVMMC::CONFIG_ENV_SECT_SIZEeMMC/*/*FollowingblockisforEHCIsupport*/#if1#defineCONFIG_CMD_USB#defineCONFIG_CMD_FAT#defineCONFIG_USB_STORAGE#defineCONFIG_USB_EHCI#defineCONFIG_USB_EHCI_NUC980#defineCONFIG_EHCI_HCD_INIT_AFTER_RESET#defineCONFIG_DOS_PARTITIONCONFIG_CMD_USBUSBCONFIG_CMD_FATFATCONFIG_USB_STORAGE:支持USB系CONFIG_USB_EHCIUSBCONFIG_USB_EHCI_NUC980:支持NUC980USBCONFIG_DOS_PARTITIONDOS#define#define*Sizeofmalloc()#define#define /*regularstackCONFIG_NUC980_GPIO:GPIO:U-Bootv2016.11支持透過命令“ config”來(lái)進(jìn)行選單配#U-Boot apiarchCPUNUC980CPUNUC980common:U-Boot命令以及一些各平臺(tái)共同的源代碼doc:README文件drivers:放置驅(qū)動(dòng)程序源代碼NUC980的驅(qū)動(dòng)程序源代碼也是放在 下,例如Ethernet驅(qū)動(dòng)程序就放examples放置一些范例mips.ldsMIPSfs:存放各種文件系統(tǒng).例如:FAT,include存放頭文件以及配置文件NUC980lib:放置各種函式庫(kù)LicensesGPLnet:存放網(wǎng)絡(luò)相關(guān)的源代碼.例如:tftp.c,post:hotkey的平臺(tái)post_hotkeys_pressed:test存放一些測(cè)試程序細(xì)節(jié)請(qǐng)參考test/READMEtools:存放一些工具,mkimage就是一個(gè)產(chǎn)生圖像文件的工具的objectcode.##make##make#MainU-BootSPLU-MainU-BootU-SPLU-BootMainU-BootNANDflashDDRSPLU-BootNANDbootSPIboot或eMMCbootMainU-MainU-Boot和SPLU-Boot會(huì)分別產(chǎn)生在根 MainU-Boot的會(huì)產(chǎn)生在根u-boot-Elf執(zhí)行檔(可透過GDB或IDEu-boot.binbinaryfileNu-WriterNAND/SPIflash、eMMC中u-boot.mapSPLU-Boot的會(huì)產(chǎn)生在 splu-boot-spl-Elf執(zhí)行檔(可透過GDB或IDEu-boot-spl.binbinaryfileNu-WriterNANDflash中u-boot-spl.mapMainU-BootMainU-Boot#define#define 上面的例子,U-BootNANDBootinclude/configs/nuc980_evb.h#define#define (CONFIG_SYS_SDRAM_BASE+CONFIG_SYS_PHY_UBOOT_BASECONFIG_SYS_TEXT_BASESPLU-BootSPLU-Boot0x2000x200#define#define NUC980默認(rèn)的配置是支持NAND不支持SPI。如果要開啟SPI配置并移除NAND配置,請(qǐng)修改include/configs/nuc980_evb.h,然后透過“make 修改include/configs/nuc980_evb.h,打開定義“CONFIG_SYS_USE_SPIFLASH”并關(guān)掉定義“CONFIG_SYS_USE_NANDFLASH”,并將環(huán)境變量改為存放在SPIflash。#define#define/*#defineCONFIG_SYS_USE_NANDFLASH/*#defineCONFIG_ENV_IS_IN_NAND*/#define透過 config”,禁能SPL->->SPL/TPL[]NUC980SPI透過 config”,使能NUC980SPI驅(qū)動(dòng)并選擇SPI運(yùn)作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)SPIFlash透過“makeconfig”,使能SPIFlash接口支持,以及存取超過SPIFlash16Mbytes位址。同時(shí)請(qǐng)根據(jù)開發(fā)板上的SPIFlash廠牌開啟相關(guān)的支持,下面的范例是開發(fā)板上的SPIflash廠牌是華邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport WinbondSPIflashsupportsf/spinand透過 ->->Commandline[]nand[*][*]SPI(NAND也使能NUC980默認(rèn)的配置是不支持SPI。如果要開啟SPI配置,請(qǐng)修改include/configs/nuc980_evb.h,然后透過 修改修改include/configs/nuc980_evb.h,打開定義 “CONFIG_SYS_USE_SPIFLASH”,并將環(huán)境變量改為存放在SPIflash。#define#define/*#defineCONFIG_ENV_IS_IN_NAND*/#defineNUC980SPI透過 config”,使能NUC980SPI驅(qū)動(dòng)并選擇SPI運(yùn)作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)sf/spi透過 config”,使能sf/spi命令->->Commandline[*]sf[*]SPIFlash透過“makeconfig”,使能SPIFlash接口支持,以及存取超過SPIFlash16Mbytes位址。同時(shí)請(qǐng)根據(jù)開發(fā)板上的SPIFlash廠牌開啟相關(guān)的支持,下面的范例是開發(fā)板上的SPIflash廠牌是華邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport WinbondSPIflashsupportSPINAND 默認(rèn)的配置是不支 SPI。如果要開 配置,請(qǐng)修include/configs/nuc980_evb.h,然后透過 修改修改include/configs/nuc980_evb.h,打開定義 “CONFIG_SYS_USE_SPIFLASH”,并將環(huán)境變量改為存放在SPIflash。#define#define/*#defineCONFIG_ENV_IS_IN_NAND*/#define #ifdef#ifdef#define #define#defineNUC980SPI透過 config”,使能NUC980SPI驅(qū)動(dòng)并選擇SPI運(yùn)作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)sf/spi透過 config”,使能sf/spi命令->->Commandline->Deviceaccess[*][*][*]SPINANDFlash透過“makeconfig”,使能SPIFlash接口支持,以及存取超過SPIFlash16Mbytes位址。同時(shí)始能SPINANDFlash并根據(jù)開發(fā)板上的SPINANDFlash廠牌開啟相關(guān)的支持,下面的范例是開發(fā)板上的SPINANDflash廠牌是華邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport SPINANDflashsupportSelectSPINANDFlash(WinbondSPINANDflashsupport)U-BootU-boot提供一個(gè)功能強(qiáng)大令行接口,透過串口連接到PC端的終端機(jī)程序.輸入"help"就會(huì)列出目前U-Boot支持令:U-Boot>U-Boot>0-donothing,1-donothing,?-aliasfor-printorsetaddressbdinfo-printBoardInfo-bootdefault,i.e.,run -bootdefault,i.e.,run…大部分令不需要輸入完整令名稱,只令前幾個(gè)字母和其令可區(qū)分即可,例如elp可以輸入h即可.大部分的Bt命令中的參數(shù)是6進(jìn)位例外因歷史包袱,sleep10進(jìn)位Bootm因?yàn)長(zhǎng)inux內(nèi)核圖像文件會(huì)在網(wǎng)絡(luò)、NAND、SPI、USB、MMC等媒介,透過這些媒介相關(guān)令將Linux內(nèi)核到DDR之后,再透過bootm命令完成Linux內(nèi)核的開機(jī)。因此,bootmmkimageLinuxbootm命令,go(1.7.2章節(jié)會(huì)介紹“非”mkimageLinuxbootm命令的格式如下U-Boot>U-Boot>helpbootm-bootapplicationimagefrombootm[addr[arg-bootapplicationimagestoredinpassingarguments'arg...';whenbootingaLinuxkernel,'arg'canbetheaddressofaninitrdimage下面的范例是假設(shè)已經(jīng)將Linux內(nèi)核到DDR0x7fc0的地址,這時(shí)我們可以透過bootm命令來(lái)啟動(dòng)Linux內(nèi)核。U-Boot>U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryEntryVerifyingChecksum...OKXIPKernelImage...OKStartingkernelGoU-Boot>U-Boot>helpgo-startapplicationataddressgoaddr[arg-startapplicationataddress'addr'passing'arg'asarguments下面這個(gè)范例是執(zhí)行一個(gè)已經(jīng)到DDR0x100000地址的程序U-Boot>U-Boot>go##StartingapplicationatoICMPECHO_REQUESThostU-Boot>U-Boot>-sendICMPECHO_REQUESTtonetwork在使用這個(gè)命令之前IP下面這個(gè)例子,將環(huán)境變量ipaddr設(shè)為01,然后一臺(tái)IP地址為U-Boot>U-Boot>setenvipaddrUsingemachost00isalive透過TFTP協(xié)議圖像文U-Boot>U-Boot>helptftpboot-bootimagevianetworkusingTFTPtftpboot[loadAddress][[hostIPaddr:]bootfilename]在使用這個(gè)命令之前IPserverIP地址給環(huán)境變量下面這個(gè)范例是透過TFTP協(xié)議完成Linux內(nèi)核開機(jī).首先,將NUC980IP地址設(shè)為01,TFTPserver的IP地址設(shè)為00.然后透過TFTP協(xié)議將Linux內(nèi)核圖像文件到0x7fc0,最后以bootm命令完成Linux內(nèi)核開機(jī)U-Boot>U-Boot>setenvipaddrU-Boot>setenvserverip00U-Boot>tftp0x7fc0vmlinux.ubUsingUsingemacTFTPfromserver00;ourIPaddressis01Filename'vmlinux.ub'.Loadaddress:Loading:*#################################################################Bytestransferred(190580U-Boot>bootm##BootingkernelfromLegacyImageat007FC0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...LoadingKernelImage...Startingkernel透過DHCP協(xié)議從網(wǎng)絡(luò)圖像文U-Boot>U-Boot>helpdhcp-bootimagevianetworkusingDHCP/TFTPdhcp[loadAddress][[hostIPaddr:]bootfilename]下面這個(gè)范例是透過DHCP協(xié)議將Linux內(nèi)核到0x7fc0這個(gè)地址.然后再透過bootm命令完成Linux內(nèi)核開機(jī).使用dhcp命令并不需要先設(shè)定ipaddr環(huán)境變量,因?yàn)镈HCPserver會(huì)指定一個(gè)IP地址給你.U-Boot>U-Boot>dhcp0x7fc0vmlinux.ubBOOTPbroadcast1***UnhandledDHCPOptioninOFFER/ACK:***UnhandledDHCPOptioninOFFER/ACK:7DHCPclientboundtoaddress02UsingemacdeviceTFTPfromserver00;ourIPaddressis02;sendingthroughgateway00Filename'vmlinux.ub'.Loadaddress:0x7fc0Loading:*#################################################################1Bytestransferred(190580U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryVerifyingVerifyingChecksum...OKXIPKernelImage...OKStartingkernel透過BOOTP協(xié)議從網(wǎng)絡(luò)圖像文U-Boot>U-Boot>helpbootp-bootimagevianetworkusingBOOTP/TFTPbootp[loadAddress][[hostIPaddr:]bootfilename]下面這個(gè)范例是透過BOOTP協(xié)議將Linux內(nèi)核到0x7fc0這個(gè)地址.然后再透過bootm命令完成Linux內(nèi)核開機(jī).使用dhcp命令并不需要先設(shè)定ipaddr環(huán)境變量,因?yàn)镈HCPserver會(huì)指定一個(gè)IP地址給你.BOOTPbroadcast1***UnhandledDHCPOptioninOFFER/ACK:***UnhandledDHCPOptioninOFFER/ACK:7DHCPclientboundtoaddress02UsingemacdeviceTFTPfromserver00;ourIPaddressis02;sendingthroughgateway00Filename'vmlinux.ub'.Loadaddress:0x7fc0 Bytestransferred(190580U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...XIPKernelImage...StartingkernelNandflashnand:NANDSub-U-Boot支持NANDflash相關(guān)令,包括nandinfo/device/erase/read/write.命令的U-Boot>helpnandnandU-Boot>helpnandnand-NANDsub-systemnandinfo-showavailableNANDnanddevice[dev]-showorsetcurrentdevicenandread-addroff|partitionsizenandwrite-addroff|partitionread/write'size'bytesstartingatoffsetto/fromto/frommemoryaddress'addr',badnandread.raw-addroff|partition[count]nandwrite.raw-addroff|partitionUseread.raw/write.rawtoavoidECCandaccesstheflashas-nanderase[.spread][clean]offsize-erase'size'bytesfromoffset'off'With'.spread',eraseenoughforgivenfilesize,otherwise,'size'includesskippedbadnanderase.part[clean]partition-eraseentiremtdpartition'nanderase.chip[clean]-eraseentirechip'nandbad-showbadblocksnanddump[.oob]off-dumppagenandscrub[-y]offsize|scrub.partpartition|scrub.chipreallycleanNANDerasingbadblocks(UNSAFE)nandmarkbadoff[...]-markbadblock(s)atoffset(UNSAFE)nandbiterroff-makeabiterroratoffset(UNSAFE)U-U-Boot>nandDevice0:nand0,sectorsize128Device0:nand0,U-Boot>nandDevice0:nand0,sectorsize128Device0:nand0,sectorsize128PagebOOBbEraseU-Boot>bPagePage2048OOB64Erase 131072U-nanderase.chipNAND裝置U-Boot>U-Boot>nandNANDerase.chip:device0whole99%complete.Erasingat0x7fe0000--100%complete.U-下面這個(gè)范例是將Linux內(nèi)核的圖像文件寫入NANDflash.Linux內(nèi)核圖像文件已事先放到DDR0x500000這個(gè)地址,大小為0x190580bytes.把他寫到NANDflash偏移量0x200000的地址.然后再把Linux內(nèi)核圖像文件從NANDflash讀回到DDR0x7FC0的地址.最后再透過bootm命令來(lái)完成Linux內(nèi)核的開機(jī).U-Boot>U-Boot>nandwrite0x5000000x200000NANDwrite:device0offset0x200000,size0x190580byteswritten:OKU-Boot>nandread0x7FC00x200000NANDread:device0offset0x200000,size0x190580bytesread:OKU-Boot>bootm##BootingkernelfromLegacyImageat007FC0ImageImage ARMLinuxKernelImageDataDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...LoadingKernelImage...Startingkernel機(jī)命令格式如下:U-Boot>U-Boot>helpnboot-bootfromNANDnboot[partition]|[[[loadAddr]dev]offset]nbootLinuxNANDflash0x200000這個(gè)位址到DDR0x7fc0的地址.再透過bootm命令完成Linux內(nèi)核的開機(jī).U-Boot>U-Boot>nboot0x7fc00Loadingfromnand0,offset0x200000ImageName:Image ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryEntryU-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...XIPKernelImage...StartingkernelSPIflashU-Boot支持SPIflash相關(guān)令,包括sfprobe/read/write/erase/update.命令的格式如下U-Boot>U-Boot>helpsf-SPIflashsub-sfprobe[[bus:]cs][hz][mode]-initflashdeviceongivenSPIbusandchipsfreadaddroffsetlenat`addr'-read`len'bytesstartingat`offset'tosfwriteaddroffsetlen-write`len'bytesfrommemoryat`addr'toflashat`offset'sferaseoffset`len'toblock-erase`len'bytesfrom`offset'`+len'roundsfupdateaddroffsetlen-eraseandwrite`len'bytesfrommemoryat`addr'toflashat`offset'U-U-要注意的一點(diǎn)是sfread/write/erase/update之前sfprobe這個(gè)命令sf命令可以指定SPI的速度,下面這個(gè)范例是將SPI時(shí)鐘設(shè)為18MHz.U-Boot>U-Boot>sfprobe下面這個(gè)范例是將Linux內(nèi)核的圖像文件從SPIflash到DDR.首先,透過“sfprobe”命令設(shè)定SPI時(shí)鐘為18MHz.然后用“sfread”命令將一個(gè)大小為0x190580位的Linux內(nèi)核圖像文件從SPIflash偏移量0x200000的地址到DDR0x7FC0的地址.最后再透過bootm命令來(lái)完成Linux內(nèi)核的開機(jī).U-Boot>U-Boot>sfprobeSF:DetectedEN25QH16-104HIPwithpagesize64KiB,total16MiBU-Boot>sfread0x7FC00x2000000x190580U-Boot>bootm##BootingkernelfromLegacyImageat007FC0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...LoadingKernelImage...Startingkernelmd:顯示內(nèi)存內(nèi)容U-Boot>U-Boot>helpmdmd-memorymd[.b,.w,.l]address[#ofobjects]0x100000x100ff的內(nèi)存內(nèi)容U-Boot>md:::: : : :::: mwU-Boot>U-Boot>helpmwmw-memorywritemw[.b,.w,.l]addressvalue[count]4word00x10000這個(gè)地址U-Boot>U-Boot>mw0x100000U-md0x10000地址的內(nèi)容4wordU-Boot>::e:ee:ee.!...c..!...:eB..:e:e:ee:ee: eeeee.0eeeeeeeU-U-cmp:比對(duì)內(nèi)存U-Boot>U-Boot>helpcmp-memorycmp[.b,.w,.l]addr1addr2count0x80000x9000的內(nèi)容64U-Boot>U-Boot>cmp0x80000x9000wordat(0xe321f0d3)!=wordatTotalof0word(s)weretheU-mtest:內(nèi)存讀寫測(cè)試U-Boot>U-Boot>helpmtest-simpleRAMread/writemtest[start[end[pattern[iterations]]]]0xa000000xb00000,0x5a5a5a5a,測(cè)試次數(shù)為0x20(32)次.U-Boot>U-Boot>mtest0xa000000xb000005a5a5a5aTesting00a00000...32PatternA5A5A5A5Reading...Testediteration(s)with0U-USBusb:USBsub-usb:usb:USBsub-U-Boot>helpusbusb-USBsub-systemusbstart-start(scan)USBcontrollerusbreset-reset(rescan)USBcontrollerusbstop[f]-stopUSB[f]=forcestopusbtree-showUSBdevicetreeusbinfo[dev]-showavailableUSBusbstorage-showdetailsofUSBstorageusbdev[dev]-showorsetcurrentUSBstorageusbpart[dev]-printpartitiontableofoneorallUSBstoragedevicesusbreadaddrblk#cnt-read`cnt'blocksstartingatblock`blk#'tomemoryaddressusbwriteaddrblk#cnt-write`cnt'blocksstartingatblock`blk#'frommemoryaddress`addr'U-usbU-Boot>usbreset(Re)startUSB...U-Boot>usbreset(Re)startUSB... USBEHCIscanningbus0fordevices...2USBDevice(s)scanningusbforstoragedevices...1StorageDevice(s)U-usbU-Boot>usbstart(Re)startUSB...U-Boot>usbstart(Re)startUSB... USBEHCIscanningbus0fordevices...2USBDevice(s)scanningusbforstoragedevices...1StorageDevice(s)U-usbUSBdevice1Hub(480Mb/s,|u-bootEHCIHost||+-2MassStorage(480Mb/s,KingstonDT101IIU-usbU-Boot>U-Boot>usb1:1:Hub,USBRevisionu-bootEHCIHostClass:PacketSize:64Configurations:Vendor:0x0000Product0x0000Version1.0Configuration:1Interfaces:1SelfPowered0mAInterface:0AlternateSetting0,Endpoints:ClassEndpoint1InInterruptMaxPacket8Interval2:MassStorage,USBRevision-KingstonDT101IIClass:(fromInterface)MassPacketSize:64Configurations:Vendor:0x0951Product0x1613Version1.0Configuration:1Interfaces:1BusPowered200mAInterface:0AlternateSetting0,Endpoints:ClassMassStorage,Transp.SCSI,BulkEndpoint1InBulkMaxPacketEndpoint2OutBulkMaxPacketU-usbU-Boot>U-Boot>usbDevice0:Vendor:KingstonRev:PMAPProd:DT101IIType:RemovableHardDiskCapacity:3875.0MB=3.7GBxU-usbU-Boot>U-Boot>usbUSBdevice0:Vendor:KingstonRev:PMAPProd:DT101Type:RemovableHardCapacity:3875.0MB=3.7GBxU-usbU-Boot>U-Boot>usbPartitionMapforUSBdevice0- PartitionType:StartNumSectors11dfc1dfb-010bU-usbread:從USB裝置的第`blk#'開始`cnt'個(gè)block到內(nèi)存地址usbwrite:將內(nèi)存地址`addr'的內(nèi)容寫到USB裝置的第`blk#'block,長(zhǎng)度為`cnt'個(gè)block.下面這個(gè)范例對(duì)USB裝置編號(hào)0的第2個(gè)block做寫入動(dòng)作,寫入的內(nèi)容是內(nèi)存地址0x10000的內(nèi)容,長(zhǎng)度為1個(gè)block.然后再對(duì)USB裝置編號(hào)0的第2個(gè)block做動(dòng)作,1個(gè)block到內(nèi)存地址0x20000.最后用cmp命令來(lái)比對(duì)內(nèi)存地址0x10000和0x20000的內(nèi)容,比對(duì)長(zhǎng)度為1個(gè)block(512bytes).U-Boot>U-Boot>usbwrite0x100002USBUSBwrite:device0block#2,count1...1blockswrite:OKU-Boot>usbread0x2000021USBread:device0block#2,count1...1blocksread:OKU-Boot>cmp0x100000x20000Totalof128word(s)werethesameusbboot:USBU-Boot>helpusbU-Boot>helpusbbootusbboot-bootfromUSBdeviceusbbootloadAddrdev:part在使用usbboot命令之前,必須先透過usbwrite命令將Linux內(nèi)核圖像文件寫到USB裝置.usbwrite命令是以block為單位,寫入的地址也是block編號(hào).而usbboot會(huì)從startblock(sector)開始Linux內(nèi)核圖像文件,因此,須知道start(sector)的編號(hào).這可透過usbpart命令顯示出USB裝置編號(hào)0的分區(qū)表.U-Boot>U-Boot>usbPartitionMapforUSBdevice0- PartitionType:StartNumSectors11dfc1dfb-010bU-U-由上圖可看出startsector(block)編號(hào)是369(0x171),因此,我們透過usbwrite命令將Linux內(nèi)核圖像文件寫到USB裝置編號(hào)0的第#369(0x171)個(gè)block.Linux內(nèi)核圖像文件大小有幾個(gè)block,算法如下.Linux內(nèi)核圖像文件已事先透過TFTP或ICE到內(nèi)存地址0x200000的地方,而Linux內(nèi) /512=3202.75,因此,總共需要3203(0xc83)個(gè)block來(lái)存放Linux內(nèi)核圖像文件.U-Boot>U-Boot>usbwrite0x2000001f80USBwrite:device0block#8064,count3203...3203blockswrite:OK現(xiàn)在,Linux內(nèi)核圖像文件已存放在USB裝置編號(hào)0的第#369(0x171)block,因此,我們可以透過usbboot命令將Linux內(nèi)核圖像文件從USB裝置中到DDR.最后再透過bootm命令完成Linux內(nèi)核開機(jī).U-Boot>U-Boot>usbboot0x7fc0Loadingfromusbdevice0,partition1:Name:usbda1Type:U-ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryEntryVerifyingChecksum...OKXIPKernelImage...OKStartingkernel除了以block為單位的存取方式,U-Boot還支持fatls和fatload命令,可以透過文件系統(tǒng)(filesystem)來(lái)存取USB裝置中的.下面這個(gè)范例用fatls命令來(lái)列出USB裝置中有那些文件案,在透過fatload命令將從USB裝置中到DDR,最后再以bootm命令完成Linux內(nèi)核開機(jī).U-Boot>U-Boot>fatlsusb1file(s),0U-U-Boot>fatloadusb0:10x7fc0vmlinux.ubreadingvmlinux.ubbytesreadin90ms(17.4U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImageARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...XIPXIPKernelImage...Startingkernel環(huán)境變量相關(guān)setenvU-Boot>U-Boot>helpsetenv-setenvironmentsetenv[-f]namevalue[forcibly]setenvironmentvariable'name'to'value...'setenv[-f]name[forcibly]deleteenvironmentvariableU-ipaddr設(shè)置為echoipaddr的設(shè)置U-Boot>U-Boot>setenvipaddr01U-Boot>echo$ipaddrU-saveenv:將環(huán)境變量到flash中U-Boot>U-Boot>helpsaveenv-saveenvironmentvariablestopersistentU-U-Boot>U-Boot>helpenv-environmenthandlingenvdefault[-f]-a-[forcibly]resetdefaultenvdefault[-f]var[...]-[forcibly]resetvariable(s)totheirdefaultenvdelete[-f]var[...]-[forcibly]deletevariable(s)enveditname-editenvironmentvariableenvexport[-t|-b|-c][-ssize]addr[var...]-exportenvironmentenvimport[-d][-t|-b|-c]addr[size]-importenvironmentenvprint[-a|name...]-printenvrunvar[...]-runcommandsinanenvironmentvariableenvsave-saveenvironmentenvset[-f]name[argU-MMCmmc:MMCsub-U-BootMMCread/write/erase/list/devU-Boot>U-Boot>helpmmc-MMCsubmmcreadaddrblk#cntmmcwriteaddrblk#cntmmceraseblk#cntmmcmmcpart-listsavailablepartitiononcurrentmmcmmcdev[dev][part]-showorsetcurrentmmcdevice[partition]mmclist-listsavailabledevicesU-mmclistmmcmmc:0mmc:U-NUC980支持的mmcdeviceSDport0和mmcdevice(nuc980_evb.h當(dāng)中以下兩個(gè)定義#define#define#defineSDport0,eMMCNAND果SDport0和eMMC都打開,mmcdevice編號(hào)如下:device0SDport0device編號(hào)2是eMMCeMMCSDport0)(nuc980_evb.h),關(guān)掉CONFIG_NUC980_SD_PORT0的定義。mmclist看到的結(jié)果如下U-Boot>U-Boot>mmcmmc:U-U-device編號(hào)0mmcdevdevicedevice0SDportmmcerase來(lái)抹除SD卡的block0x30和0x31,然后從DDR0x8000的地址拷貝數(shù)據(jù)到SD卡的block0x30和0x31,之后再SD卡的block0x30和0x31到DDR0x500000,最后比對(duì)DDR0x8000和0x500000的數(shù)據(jù)來(lái)確認(rèn)讀寫SD卡的正確性。U-Boot>U-Boot>mmcdev0mmc0iscurrentdeviceU-Boot>mmcerase0x30MMCerase:dev#0,block#48,count2...2blockserase:OKU-Boot>mmcwrite0x80000x302MMCwrite:dev#0,block#48,count2...2blockswrite:OKU-Boot>mmcread0x5000000x302MMCread:dev#0,block#48,count2...2blocksread:OKU-Boot>cmp.b0x80000x5000000x400Totalof1024byte(s)weretheU-mmcdevdevicedevice1mmcerase來(lái)抹除eMMC卡的block1024到2047,然后從DDR0x8000的地址拷貝數(shù)據(jù)到eMMC卡的block1024到2047,之后再eMMC卡的block1024到2047到DDR0x500000,最后比對(duì)DDR0x8000和0x500000的數(shù)據(jù)來(lái)確認(rèn)讀寫eMMC卡的正確性。U-Boot>U-Boot>mmcdevmmc1(part0)iscurrentdeviceU-Boot>mmcerase0x400MMCerase:dev#1,block#1024,count1024...1024blockserase:U-Boot>U-Boot>mmcwrite0x80000x400MMCwrite:dev#1,block#1024,count1024...1024blockswrite:OKU-Boot>mmcread0x5000000x4000x400MMCread:dev#1,block#1024,count1024...1024blocksread:OKU-Boot>cmp.b0x80000x5000000x4000Totalof16384byte(s)weretheU-mmcSD/eMMCfatlsfatload卡中的下面的范例是先以fatls命令行出SDport0中的,然后透過flatload命令將SD卡中的Linuxkernel圖像文件(vmlinux.ub)到DDR0x7fc0,再經(jīng)由bootm命令完成Linuxkernel開機(jī)。U-Boot>U-Boot>fatlsmmc 2file(s),0U-Boot>fatloadmmc00x7fc0vmlinux.ubreadingvmlinux.ubbytesreadin301ms(5.2U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadLoadAddress:00007FC0EntryPoint:VerifyingChecksum...OKXIPKernelImage...OKStartingkernelMTDmtdparts:defineflash/nandU-BootMTDpartitionadd/del/listU-BBoot>U-BBoot>helpmtdparts-defineflash/nandlistpartitiontablemtdpartsdelallmtdpartsdelpart-iddeletepartition(e.g.part-id=nand0,1)mtdpartsadd<mtd-dev><size>[@<offset>][<name>][ro]addpartitionmtdpartsdefaultresetpartitiontabletothiscommandusesthreeenvironmentvariables:'partition'-keepscurrentpartitionidentifier-partition-partition<dev-<dev-mtddevicenumber,<mtd-uniquedevicetagusedbylinuxkerneltofindmtddevicepartition:=<part-<part-id>:=<dev-'mtdids'-linuxkernelmtddeviceid<->partition:=<part-<part-id>:=<dev-'mtdids'-linuxkernelmtddeviceid<->u-bootdeviceidmapmtdparts=mtdparts=<mtd-def>[;<mtd-<mtd- :=<mtd-id>:<part-def>[,<part-<mtd- :=uniquedevicetagusedbylinuxkerneltofindmtddevice<part-def>:=<size>[@<offset>][<name>][<ro-:=standardlinuxmemsizeOR'-'todenoteallremaining :=partitionstartoffsetwithinthe:='('NAME<ro-flag>:=whensetto'ro'makespartitionread-only(notused,passedtoU-第一分區(qū):名稱為u-boot,起始位置為0x0,大小為0x200000.第二分區(qū):名稱為kernel,起始位置為0x200000,大小為0x .第三分區(qū):名稱為user,起始位置為0x ,大小為剩余空間.#define#defineMTDIDS_DEFAULT#defineMTDPARTS_DEFAULT“mtdparts=nand0:0x200000@0x0(u- U-Boot>devicenand0U-Boot>devicenand0<nand0>,#parts=activepartition:nand0,0-(u-boot)@mtdids:mtdparts:mtdparts=nand0:0x100000@0x0(u-boot),0xU-000UBIubi:ubiU-BootUBIinfo/create/read/writeU-Boot>helpubiubiU-Boot>helpubiubi-ubicommandsubipart[part]-Showorsetcurrentpartition(withoptionalVIDheaderoffset)ubiinfo[l[ayout]]-Displayvolumeandubilayoutinformationubicreate[vol]volume[size][type]-createvolumenamewithsizeubiwrite[vol]addressvolumesize-Writevolumefromaddresswithsizeubiread[vol]addressvolume[size]-Readvolumetoaddresswithsizeubiremove[vol]volume-Removevolumevolume:characternamesize:volume:characternamesize:specifiedinbytestype:s[tatic]ord[ynamic]U-ubipartU-Boot>U-Boot>ubipartCreating1MTDpartitionson"nand0":0x000001500000-0x000008000000:UBI:attachingmtd1toUBI:physicaleraseblock131072bytes(128UBI:logicaleraseblock126976UBI:smallestflashI/OUBI:VIDheader2048(alignedUBI:dataUBI:attachedmtd1toUBI:MTDdeviceUBI:MTDdevice107UBI:numberofgoodUBI:numberofbad1UBI:max.allowedUBI:wear-levelingUBI:numberofinternalvolumes:UBI:numberofuser1UBI:availableUBI:totalnumberPEBs:UBI:numberofforbadPEBhandling:UBI:max/meanerasecounter:U-U-ubiinfoubiU-Boot>U-Boot>ubiinfoUBI:volumeinformationUBI:0 UBI:1UBI:0UBI:3UBI:9UBI:usable_leb_sizeUBI:UBI:UBI: UBI:0UBI:0UBI:UBI:volumeinformationUBI: UBI:1UBI:0UBI:3UBI:UBI:usable_leb_sizeUBI:2200layoutU-ubifsmountubifsU-Boot>helpubifsmountubifsmountU-Boot>helpubifsmountubifsmount-mountUBIFSvolumeubifsmount<volume--mount'volume-name'volumeU-Boot>ubifsmountubi0:nandflashUBIFS:mountedUBIdevice0,volume0,nameUBIFS:mountedread-UBIFS:filesystembytes(101060KiB,98MiB,815UBIFS:journalbytes(5084KiB,4MiB,41UBIFS:mediaw4/r0(latestisUBIFS:defaultcompressor:forbytes(4994ubifsls列出ubifs文件系統(tǒng)中 U-Boot>U-Boot>helpubifsls-listfilesinadirectoryubifsls--listfilesina'directory'(default160ThuJan0100:08:091980U-ubifsumountubifsU-Boot>U-Boot>helpubifsumount-unmountUBIFSvolume-unmountcurrentU-Boot>UnmountingUBIFSvolumenandflash!YAFFS2yaffs:yaffsU-BootYAFFSmount/list/mkdir/rmdir/rd/wrU-Boot>U-Boot>ydevconfig-configureyaffsmountpointydevls-listyaffsmountpoints-yaffsymkdir-YAFFSymount-mount-YAFFS-readfilefrom-readfiletomemoryfrom-YAFFSyrmdir-YAFFSytraceytrace-show/setyaffstraceyumount-unmount-writefileto-writefilefrommemorytoydevconfigYAFFSU-Boot>U-Boot>Badarguments:ydevconfigmount_ptmtd_devstart_blockend_blockU-Boot>ydevconfignand00xb00x3ffConfiguresyaffsmountnand:dev0startblock176,endblock1023usinginbandtagsydevlsYAFFSU-Boot>U-Boot> 00x000b00x003ffusinginbandtags,notymountU-Boot>U-Boot>Badarguments:ymountmount_ptU-Boot>ymountnandMountingyaffs2mountpointU-Boot>00x000b00x003ffusinginbandtags,freeyls顯示YAFFS文件系統(tǒng)內(nèi)容,一個(gè)掛載點(diǎn)就是一個(gè) 區(qū),上述的范例nand就是一個(gè)U-Boot>U-Boot>Badarguments:yls[-l]U-Boot>yls-lnand2ymkdirU-Boot>U-Boot>ymkdirU-Boot>yls-l 2U-Boot>yrmdirU-Boot>yls-l 2ywr/ywrm寫一 /將一塊memory存U-Boot>U-Boot>ywrnand/wr.bin0x55Writingvalue(55)100timestonand/wr.bin...doneU-Boot>ywrmnand/wrm.bin0xe000000x1000U-Boot>yls-l 259regular 258regular2yrd/yrdm讀一個(gè)/將讀到U-Boot>U-Boot>yrdnand/wr.binReadingfilenand/wr.binU-Boot>yrdmnand/wrm.binCopynand/wrm.bintoyrmU-Boot>yls-l 259regular 258regularU-Boot>2U-Boot>-lregular 2yumountU-Boot>U-Boot>yumountUnmountingyaffs2mountpointnandU-Boot>ydevls00x000b00x003ffusinginbandtags,notNANDflash、SPIflasheMMC(nuc980_evb.h中以下CONFIG_ENV_IS_IN_NAND:將環(huán)境變量在NANDCONFIG_ENV_IS_IN_SPI_FLASH:將環(huán)境變量在SPICONFIG_ENV_IS_IN_MMC:將環(huán)境變量在環(huán)境變量在flash的偏移量和保留給環(huán)境變量的空間大小則由配置文件(nuc980_evb.h)中以下兩CONFIG_ENV_OFFSET:環(huán)境變量在flash的偏移量:當(dāng)flash中不存在環(huán)境變量時(shí),U-BootU-BootConsolebaudratebps.baudratenuc980_evb.h這是開機(jī)延遲的秒數(shù).在這段延遲時(shí)間內(nèi),按下任何按鍵將會(huì)U-Boot去執(zhí)行bootcmd中令腳本.bootdelay數(shù)值來(lái)自于nuc980_evb.h中的CONFIG_BOOTDELAYinterfaceactive,nuc980ethernetdevicenameemac,ethact只能設(shè)為Ethernetmacaddress.ethaddrnuc980_evb.hstderrstdinstdout每當(dāng)U-Boot開機(jī)后,U-Boot會(huì)自動(dòng)地執(zhí)行bootcmd中令 .下面這個(gè)范例是將bootcmd令設(shè)為從SPIflash偏移量0x200000的地方 DDR0x7fc0的地址,并完成Linux內(nèi)核開機(jī).最后,記得將環(huán)境變量到SPIU-Boot>U-Boot>setenvbootcmdsfp
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 商務(wù)接待用車:汽車租賃合同
- 醫(yī)療機(jī)構(gòu)麻醉科醫(yī)師聘用協(xié)議
- 圖書館管理員聘用合同樣本
- 鐵路線路新建爆破工程合同
- 污水處理廠環(huán)保設(shè)施技術(shù)升級(jí)合同
- 水電站建設(shè)河道施工合同
- 網(wǎng)絡(luò)安全工程師聘用合同
- 辦公大樓鋼結(jié)構(gòu)施工承包合同
- 幼教中心綠化養(yǎng)護(hù)合同
- 電影院入口廣告牌施工合同
- 【MOOC】勞動(dòng)與社會(huì)保障法學(xué)-西南政法大學(xué) 中國(guó)大學(xué)慕課MOOC答案
- 西安電子科技大學(xué)《人工智能概論》2021-2022學(xué)年第一學(xué)期期末試卷
- 2024年建設(shè)銀行個(gè)人住房貸款標(biāo)準(zhǔn)協(xié)議模板一
- 大學(xué)生職業(yè)規(guī)劃采訪稿
- 中國(guó)血管性認(rèn)知障礙診治指南(2024版)解讀
- 2024年度防水材料品牌推廣與銷售合同2篇
- 商務(wù)風(fēng)2025個(gè)人年終工作總結(jié)個(gè)人工作計(jì)劃個(gè)人工作匯報(bào)課件模板
- 聯(lián)通公司個(gè)人先進(jìn)事跡2篇
- 《雙贏談判全攻略》課件
- 第四章 光(大單元整體說(shuō)課稿)高二物理同步備課系列(人教版2019選擇性必修第一冊(cè))
- 2024-2030年中國(guó)蠔殼粉市場(chǎng)競(jìng)爭(zhēng)戰(zhàn)略及投資風(fēng)險(xiǎn)分析報(bào)告
評(píng)論
0/150
提交評(píng)論