版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
NUC980U-Bootv2016_11使用手TheinformationdescribedinthisistheexclusiveinlectualpropertyofNuvotonTechnologyCorporationandshallnotbereproducedwithoutpermissionfromNuvoton.NuvotonisprovidingthisonlyforreferencepurposesofNUC980microprocessorbasedsystemNuvotonassumesnoresponsibilityforerrorsorAlldataandspecificationsaresubjecttochangewithoutForadditionalinformationorquestions,pleasecontact:NuvotonTechnology内U-Boot使用说 配 架 编译U- 新增SPINOR配置并移除NAND配 新增SPI配置(NAND也使能 新增SPINAND配 U-Boot命 环境变 mkimage工 Watchdog 网络测试环 加快SPIflash开机速 NANDflash相关Power-on U-BootU-Boot是一个主要用于嵌入式系统的启动加载程序,可以支持多种不同的计算器系统结构,包括ARM、MIPS、x86与68K。这也是一套在GNU通用公共证之下发布的自由软体。U-Boot支持下列功能:网络:TFTP,BOOTP,串口:s-record,binary(viaFlash管理:抹除,读Flash型别SPIflashNAND内存工具:读,写,,比交互式s:命令,NUC980U-Bootv2016.11U-Boot是可配置的,U-Bootv2016.11来产生不同的配置,第二个方式是透过选单来配置。NUC980配置文件位于nuc980_evb.h中的各项定义#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:环境变量在NANDflashCONFIG_ENV_IS_IN_SPI_FLASH:环境变量在NANDflashCONFIG_ENV_IS_IN_MMC:环境变量在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:启动YAFFS2CONFIG_YAFFS2YAFFS2CONFIG_SYS_MAX_NAND_DEVICE:NANDCONFIG_SYS_NAND_BASENANDcontrollerbase:::CONFIG_ENV_RANGE:定义环境变量的范围,范围是CONFIG_ENV_OFFSET到CONFIG_ENV_OFFSET+CONFIG_ENV_RANGE.(当遇到环境变量的block是坏块时,U-Boot会将环境变量存到下一个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”来进行选单配#U-Boot apiarchCPUNUC980CPUNUC980common:U-Boot命令以及一些各平台共同的源代码doc:README文件drivers:放置驱动程序源代码NUC980的驱动程序源代码也是放在 下,例如Ethernet驱动程序就放examples放置一些范例mips.ldsMIPSfs:存放各种文件系统.例如:FAT,include存放头文件以及配置文件NUC980lib:放置各种函式库LicensesGPLnet:存放网络相关的源代码.例如:tftp.c,post:hotkey的平台post_hotkeys_pressed:test存放一些测试程序细节请参考test/READMEtools:存放一些工具,mkimage就是一个产生图像文件的工具的objectcode.##make##make#MainU-BootSPLU-MainU-BootU-SPLU-BootMainU-BootNANDflashDDRSPLU-BootNANDbootSPIboot或eMMCbootMainU-MainU-Boot和SPLU-Boot会分别产生在根 MainU-Boot的会产生在根u-boot-Elf执行档(可透过GDB或IDEu-boot.binbinaryfileNu-WriterNAND/SPIflash、eMMC中u-boot.mapSPLU-Boot的会产生在 splu-boot-spl-Elf执行档(可透过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默认的配置是支持NAND不支持SPI。如果要开启SPI配置并移除NAND配置,请修改include/configs/nuc980_evb.h,然后透过“make 修改include/configs/nuc980_evb.h,打开定义“CONFIG_SYS_USE_SPIFLASH”并关掉定义“CONFIG_SYS_USE_NANDFLASH”,并将环境变量改为存放在SPIflash。#define#define/*#defineCONFIG_SYS_USE_NANDFLASH/*#defineCONFIG_ENV_IS_IN_NAND*/#define透过 config”,禁能SPL->->SPL/TPL[]NUC980SPI透过 config”,使能NUC980SPI驱动并选择SPI运作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)SPIFlash透过“makeconfig”,使能SPIFlash接口支持,以及存取超过SPIFlash16Mbytes位址。同时请根据开发板上的SPIFlash厂牌开启相关的支持,下面的范例是开发板上的SPIflash厂牌是华邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport WinbondSPIflashsupportsf/spinand透过 ->->Commandline[]nand[*][*]SPI(NAND也使能NUC980默认的配置是不支持SPI。如果要开启SPI配置,请修改include/configs/nuc980_evb.h,然后透过 修改修改include/configs/nuc980_evb.h,打开定义 “CONFIG_SYS_USE_SPIFLASH”,并将环境变量改为存放在SPIflash。#define#define/*#defineCONFIG_ENV_IS_IN_NAND*/#defineNUC980SPI透过 config”,使能NUC980SPI驱动并选择SPI运作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)sf/spi透过 config”,使能sf/spi命令->->Commandline[*]sf[*]SPIFlash透过“makeconfig”,使能SPIFlash接口支持,以及存取超过SPIFlash16Mbytes位址。同时请根据开发板上的SPIFlash厂牌开启相关的支持,下面的范例是开发板上的SPIflash厂牌是华邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport WinbondSPIflashsupportSPINAND 默认的配置是不支 SPI。如果要开 配置,请修include/configs/nuc980_evb.h,然后透过 修改修改include/configs/nuc980_evb.h,打开定义 “CONFIG_SYS_USE_SPIFLASH”,并将环境变量改为存放在SPIflash。#define#define/*#defineCONFIG_ENV_IS_IN_NAND*/#define #ifdef#ifdef#define #define#defineNUC980SPI透过 config”,使能NUC980SPI驱动并选择SPI运作在Quad或正常模式->->Device->SPI[*]NUC980SPISelectNUC980SPIinQuadmodeorNormalmode(Quadmode)sf/spi透过 config”,使能sf/spi命令->->Commandline->Deviceaccess[*][*][*]SPINANDFlash透过“makeconfig”,使能SPIFlash接口支持,以及存取超过SPIFlash16Mbytes位址。同时始能SPINANDFlash并根据开发板上的SPINANDFlash厂牌开启相关的支持,下面的范例是开发板上的SPINANDflash厂牌是华邦。->->Device->SPIFlash[*]LegacySPIFlashInterface SPIflashBank/Extendedaddressregistersupport SPINANDflashsupportSelectSPINANDFlash(WinbondSPINANDflashsupport)U-BootU-boot提供一个功能强大令行接口,透过串口连接到PC端的终端机程序.输入"help"就会列出目前U-Boot支持令:U-Boot>U-Boot>0-donothing,1-donothing,?-aliasfor-printorsetaddressbdinfo-printBoardInfo-bootdefault,i.e.,run -bootdefault,i.e.,run…大部分令不需要输入完整令名称,只令前几个字母和其令可区分即可,例如elp可以输入h即可.大部分的Bt命令中的参数是6进位例外因历史包袱,sleep10进位Bootm因为Linux内核图像文件会在网络、NAND、SPI、USB、MMC等媒介,透过这些媒介相关令将Linux内核到DDR之后,再透过bootm命令完成Linux内核的开机。因此,bootmmkimageLinuxbootm命令,go(1.7.2章节会介绍“非”mkimageLinuxbootm命令的格式如下U-Boot>U-Boot>helpbootm-bootapplicationimagefrombootm[addr[arg-bootapplicationimagestoredinpassingarguments'arg...';whenbootingaLinuxkernel,'arg'canbetheaddressofaninitrdimage下面的范例是假设已经将Linux内核到DDR0x7fc0的地址,这时我们可以透过bootm命令来启动Linux内核。U-Boot>U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryEntryVerifyingChecksum...OKXIPKernelImage...OKStartingkernelGoU-Boot>U-Boot>helpgo-startapplicationataddressgoaddr[arg-startapplicationataddress'addr'passing'arg'asarguments下面这个范例是执行一个已经到DDR0x100000地址的程序U-Boot>U-Boot>go##StartingapplicationatoICMPECHO_REQUESThostU-Boot>U-Boot>-sendICMPECHO_REQUESTtonetwork在使用这个命令之前IP下面这个例子,将环境变量ipaddr设为01,然后一台IP地址为U-Boot>U-Boot>setenvipaddrUsingemachost00isalive透过TFTP协议图像文U-Boot>U-Boot>helptftpboot-bootimagevianetworkusingTFTPtftpboot[loadAddress][[hostIPaddr:]bootfilename]在使用这个命令之前IPserverIP地址给环境变量下面这个范例是透过TFTP协议完成Linux内核开机.首先,将NUC980IP地址设为01,TFTPserver的IP地址设为00.然后透过TFTP协议将Linux内核图像文件到0x7fc0,最后以bootm命令完成Linux内核开机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协议从网络图像文U-Boot>U-Boot>helpdhcp-bootimagevianetworkusingDHCP/TFTPdhcp[loadAddress][[hostIPaddr:]bootfilename]下面这个范例是透过DHCP协议将Linux内核到0x7fc0这个地址.然后再透过bootm命令完成Linux内核开机.使用dhcp命令并不需要先设定ipaddr环境变量,因为DHCPserver会指定一个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协议从网络图像文U-Boot>U-Boot>helpbootp-bootimagevianetworkusingBOOTP/TFTPbootp[loadAddress][[hostIPaddr:]bootfilename]下面这个范例是透过BOOTP协议将Linux内核到0x7fc0这个地址.然后再透过bootm命令完成Linux内核开机.使用dhcp命令并不需要先设定ipaddr环境变量,因为DHCPserver会指定一个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相关令,包括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-下面这个范例是将Linux内核的图像文件写入NANDflash.Linux内核图像文件已事先放到DDR0x500000这个地址,大小为0x190580bytes.把他写到NANDflash偏移量0x200000的地址.然后再把Linux内核图像文件从NANDflash读回到DDR0x7FC0的地址.最后再透过bootm命令来完成Linux内核的开机.U-Boot>U-Boot>nandwrite0x5000000x200000NANDwrite:device0offset0x200000,size0x190580byteswritten:OKU-Boot>nandread0x7FC00x200000NANDread:device0offset0x200000,size0x190580bytesread:OKU-Boot>bootm##BootingkernelfromLegacyImageat007FC0ImageImage ARMLinuxKernelImageDataDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...LoadingKernelImage...Startingkernel机命令格式如下:U-Boot>U-Boot>helpnboot-bootfromNANDnboot[partition]|[[[loadAddr]dev]offset]nbootLinuxNANDflash0x200000这个位址到DDR0x7fc0的地址.再透过bootm命令完成Linux内核的开机.U-Boot>U-Boot>nboot0x7fc00Loadingfromnand0,offset0x200000ImageName:Image ARMLinuxKernelImageDataBytes=1.6LoadAddress:EntryEntryU-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...XIPKernelImage...StartingkernelSPIflashU-Boot支持SPIflash相关令,包括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-要注意的一点是sfread/write/erase/update之前sfprobe这个命令sf命令可以指定SPI的速度,下面这个范例是将SPI时钟设为18MHz.U-Boot>U-Boot>sfprobe下面这个范例是将Linux内核的图像文件从SPIflash到DDR.首先,透过“sfprobe”命令设定SPI时钟为18MHz.然后用“sfread”命令将一个大小为0x190580位的Linux内核图像文件从SPIflash偏移量0x200000的地址到DDR0x7FC0的地址.最后再透过bootm命令来完成Linux内核的开机.U-Boot>U-Boot>sfprobeSF:DetectedEN25QH16-104HIPwithpagesize64KiB,total16MiBU-Boot>sfread0x7FC00x2000000x190580U-Boot>bootm##BootingkernelfromLegacyImageat007FC0ImageImage ARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...LoadingKernelImage...Startingkernelmd:显示内存内容U-Boot>U-Boot>helpmdmd-memorymd[.b,.w,.l]address[#ofobjects]0x100000x100ff的内存内容U-Boot>md:::: : : :::: mwU-Boot>U-Boot>helpmwmw-memorywritemw[.b,.w,.l]addressvalue[count]4word00x10000这个地址U-Boot>U-Boot>mw0x100000U-md0x10000地址的内容4wordU-Boot>::e:ee:ee.!...c..!...:eB..:e:e:ee:ee: eeeee.0eeeeeeeU-U-cmp:比对内存U-Boot>U-Boot>helpcmp-memorycmp[.b,.w,.l]addr1addr2count0x80000x9000的内容64U-Boot>U-Boot>cmp0x80000x9000wordat(0xe321f0d3)!=wordatTotalof0word(s)weretheU-mtest:内存读写测试U-Boot>U-Boot>helpmtest-simpleRAMread/writemtest[start[end[pattern[iterations]]]]0xa000000xb00000,0x5a5a5a5a,测试次数为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'个block到内存地址usbwrite:将内存地址`addr'的内容写到USB装置的第`blk#'block,长度为`cnt'个block.下面这个范例对USB装置编号0的第2个block做写入动作,写入的内容是内存地址0x10000的内容,长度为1个block.然后再对USB装置编号0的第2个block做动作,1个block到内存地址0x20000.最后用cmp命令来比对内存地址0x10000和0x20000的内容,比对长度为1个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内核图像文件写到USB装置.usbwrite命令是以block为单位,写入的地址也是block编号.而usbboot会从startblock(sector)开始Linux内核图像文件,因此,须知道start(sector)的编号.这可透过usbpart命令显示出USB装置编号0的分区表.U-Boot>U-Boot>usbPartitionMapforUSBdevice0- PartitionType:StartNumSectors11dfc1dfb-010bU-U-由上图可看出startsector(block)编号是369(0x171),因此,我们透过usbwrite命令将Linux内核图像文件写到USB装置编号0的第#369(0x171)个block.Linux内核图像文件大小有几个block,算法如下.Linux内核图像文件已事先透过TFTP或ICE到内存地址0x200000的地方,而Linux内 /512=3202.75,因此,总共需要3203(0xc83)个block来存放Linux内核图像文件.U-Boot>U-Boot>usbwrite0x2000001f80USBwrite:device0block#8064,count3203...3203blockswrite:OK现在,Linux内核图像文件已存放在USB装置编号0的第#369(0x171)block,因此,我们可以透过usbboot命令将Linux内核图像文件从USB装置中到DDR.最后再透过bootm命令完成Linux内核开机.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命令,可以透过文件系统(filesystem)来存取USB装置中的.下面这个范例用fatls命令来列出USB装置中有那些文件案,在透过fatload命令将从USB装置中到DDR,最后再以bootm命令完成Linux内核开机.U-Boot>U-Boot>fatlsusb1file(s),0U-U-Boot>fatloadusb0:10x7fc0vmlinux.ubreadingvmlinux.ubbytesreadin90ms(17.4U-Boot>bootm##BootingkernelfromLegacyImageat00007fc0ImageImageARMLinuxKernelImageDataBytes=1.6LoadAddress:00007FC0EntryPoint:VerifyingChecksum...XIPXIPKernelImage...Startingkernel环境变量相关setenvU-Boot>U-Boot>helpsetenv-setenvironmentsetenv[-f]namevalue[forcibly]setenvironmentvariable'name'to'value...'setenv[-f]name[forcibly]deleteenvironmentvariableU-ipaddr设置为echoipaddr的设置U-Boot>U-Boot>setenvipaddr01U-Boot>echo$ipaddrU-saveenv:将环境变量到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当中以下两个定义#define#define#defineSDport0,eMMCNAND果SDport0和eMMC都打开,mmcdevice编号如下:device0SDport0device编号2是eMMCeMMCSDport0)(nuc980_evb.h),关掉CONFIG_NUC980_SD_PORT0的定义。mmclist看到的结果如下U-Boot>U-Boot>mmcmmc:U-U-device编号0mmcdevdevicedevice0SDportmmcerase来抹除SD卡的block0x30和0x31,然后从DDR0x8000的地址拷贝数据到SD卡的block0x30和0x31,之后再SD卡的block0x30和0x31到DDR0x500000,最后比对DDR0x8000和0x500000的数据来确认读写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来抹除eMMC卡的block1024到2047,然后从DDR0x8000的地址拷贝数据到eMMC卡的block1024到2047,之后再eMMC卡的block1024到2047到DDR0x500000,最后比对DDR0x8000和0x500000的数据来确认读写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,再经由bootm命令完成Linuxkernel开机。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-第一分区:名称为u-boot,起始位置为0x0,大小为0x200000.第二分区:名称为kernel,起始位置为0x200000,大小为0x .第三分区:名称为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文件系统中 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文件系统内容,一个挂载点就是一个 区,上述的范例nand就是一个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读一个/将读到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:将环境变量在NANDCONFIG_ENV_IS_IN_SPI_FLASH:将环境变量在SPICONFIG_ENV_IS_IN_MMC:将环境变量在环境变量在flash的偏移量和保留给环境变量的空间大小则由配置文件(nuc980_evb.h)中以下两CONFIG_ENV_OFFSET:环境变量在flash的偏移量:当flash中不存在环境变量时,U-BootU-BootConsolebaudratebps.baudratenuc980_evb.h这是开机延迟的秒数.在这段延迟时间内,按下任何按键将会U-Boot去执行bootcmd中令脚本.bootdelay数值来自于nuc980_evb.h中的CONFIG_BOOTDELAYinterfaceactive,nuc980ethernetdevicenameemac,ethact只能设为Ethernetmacaddress.ethaddrnuc980_evb.hstderrstdinstdout每当U-Boot开机后,U-Boot会自动地执行bootcmd中令 .下面这个范例是将bootcmd令设为从SPIflash偏移量0x200000的地方 DDR0x7fc0的地址,并完成Linux内核开机.最后,记得将环境变量到SPIU-Boot>U-Boot>setenvbootcmdsfp
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年建筑施工《春节节后复工复产》工作实施方案 (汇编3份)
- 小学一年级人教新课标数学100以内加法和减法练习试卷
- 小学数学一年级上册20以内口算题卡
- 小学六年级上册数学青岛版5第五单元分数混合运算质量检测试题
- 如何预防手足口病
- 命题作文“一路有你”写作导引及佳作
- 红叶高考语文阅读理解
- 情侣餐销售工作总结
- 财务部年终工作总结精细化成本控制
- 运输物流行业销售工作总结
- 患者转诊记录单
- 美好生活“油”此而来-暨南大学中国大学mooc课后章节答案期末考试题库2023年
- 买卖合同纠纷案民事判决书
- 神经内科应急预案完整版
- 2023零售药店医保培训试题及答案篇
- UCC3895芯片内部原理解析
- 混凝土设计的各种表格
- 保安员培训教学大纲
- 广东省高等学校“千百十工程”第六批继续培养对象和第
- 【企业杜邦分析国内外文献综述6000字】
- taft波完整版可编辑
评论
0/150
提交评论