1*4882a593SmuzhiyunSummary 2*4882a593Smuzhiyun======= 3*4882a593SmuzhiyunThe README is for the boot procedure used for various DA850 (or compatible 4*4882a593Smuzhiyunparts such as the AM1808) based boards. 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunIn the context of U-Boot, the board is booted in three stages. The initial 7*4882a593Smuzhiyunbootloader which executes upon reset is the ROM Boot Loader (RBL) and sits 8*4882a593Smuzhiyunin the internal ROM. The RBL initializes the internal memory and then 9*4882a593Smuzhiyundepending on the exact board and pin configurations will initialize another 10*4882a593Smuzhiyuncontroller (such as SPI or NAND) to continue the boot process by loading 11*4882a593Smuzhiyunthe secondary program loader (SPL). The SPL will initialize the system 12*4882a593Smuzhiyunfurther (some clocks, SDRAM) and then load the full u-boot from a 13*4882a593Smuzhiyunpredefined location in persistent storage to DDR and jumps to the u-boot 14*4882a593Smuzhiyunentry point. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunAIS is an image format defined by TI for the images that are to be loaded 17*4882a593Smuzhiyunto memory by the RBL. The image is divided into a series of sections and 18*4882a593Smuzhiyunthe image's entry point is specified. Each section comes with meta data 19*4882a593Smuzhiyunlike the target address the section is to be copied to and the size of the 20*4882a593Smuzhiyunsection, which is used by the RBL to load the image. At the end of the 21*4882a593Smuzhiyunimage the RBL jumps to the image entry point. The AIS format allows for 22*4882a593Smuzhiyunother things such as programming the clocks and SDRAM if the header is 23*4882a593Smuzhiyunprogrammed for it. We do not take advantage of this and instead use SPL as 24*4882a593Smuzhiyunit allows for additional flexibility (run-time detect of board revision, 25*4882a593Smuzhiyunloading the next image from a different media, etc). 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun 28*4882a593SmuzhiyunCompilation 29*4882a593Smuzhiyun=========== 30*4882a593SmuzhiyunThe exact build target you need will depend on the board you have. For 31*4882a593SmuzhiyunLogic PD boards, or other boards which store the ethernet MAC address at 32*4882a593Smuzhiyunthe end of SPI flash, run 'make da850evm'. For boards which store the 33*4882a593Smuzhiyunethernet MAC address in the i2c EEPROM located at 0x50, run 34*4882a593Smuzhiyun'make da850_am18xxevm'. Once this build completes you will have a 35*4882a593Smuzhiyunu-boot.ais file that needs to be written to the correct persistent 36*4882a593Smuzhiyunstorage. 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunFlashing the images to SPI 40*4882a593Smuzhiyun========================== 41*4882a593SmuzhiyunThe AIS image can be written to SPI flash using the following commands. 42*4882a593SmuzhiyunAssuming that the network is configured and enabled and the u-boot.ais file 43*4882a593Smuzhiyunis tftp'able. 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunU-Boot > sf probe 0 46*4882a593SmuzhiyunU-Boot > sf erase 0 +320000 47*4882a593SmuzhiyunU-Boot > tftp u-boot.ais 48*4882a593SmuzhiyunU-Boot > sf write c0700000 0 $filesize 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunFlashing the images to NAND 51*4882a593Smuzhiyun=========================== 52*4882a593SmuzhiyunThe AIS image can be written to NAND using the u-boot "nand" commands. 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunExample: 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunOMAPL138_LCDK requires the AIS image to be written to the second block of 57*4882a593Smuzhiyunthe NAND flash. 58*4882a593Smuzhiyun 59*4882a593SmuzhiyunFrom the "nand info" command we see that the second block would start at 60*4882a593Smuzhiyunoffset 0x20000: 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun U-Boot > nand info 63*4882a593Smuzhiyun sector size 128 KiB (0x20000) 64*4882a593Smuzhiyun Page size 2048 b 65*4882a593Smuzhiyun 66*4882a593SmuzhiyunFrom the tftp command we see that we need to copy 0x74908 bytes from 67*4882a593Smuzhiyunmemory address 0xc0700000 (0x75000 if we align a page of 2048): 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun U-Boot > tftp u-boot.ais 70*4882a593Smuzhiyun Load address: 0xc0700000 71*4882a593Smuzhiyun Bytes transferred = 477448 (74908 hex) 72*4882a593Smuzhiyun 73*4882a593SmuzhiyunThe commands to write the image from memory to NAND would be: 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun U-Boot > nand erase 0x20000 0x75000 76*4882a593Smuzhiyun U-Boot > nand write 0xc0700000 0x20000 0x75000 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunAlternatively, MTD partitions may be defined. Using "mtdparts" to 79*4882a593Smuzhiyunconveniently have a bootloader partition starting at the second block 80*4882a593Smuzhiyun(offset 0x20000): 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun setenv mtdids nand0=davinci_nand.0 83*4882a593Smuzhiyun setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader) 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunIn this case the commands would be simplified to: 86*4882a593Smuzhiyun 87*4882a593Smuzhiyun U-Boot > tftp u-boot.ais 88*4882a593Smuzhiyun U-Boot > nand erase.part bootloader 89*4882a593Smuzhiyun U-Boot > nand write 0xc0700000 bootloader 90*4882a593Smuzhiyun 91*4882a593SmuzhiyunFlashing the images to MMC 92*4882a593Smuzhiyun========================== 93*4882a593SmuzhiyunIf the boot pins are set to boot from mmc, the RBL will try to load the 94*4882a593Smuzhiyunnext boot stage form the first couple of sectors of an external mmc card. 95*4882a593SmuzhiyunAs sector 0 is usually used for storing the partition information, the 96*4882a593SmuzhiyunAIS image should be written at least after the first sector, but before the 97*4882a593Smuzhiyunfirst partition begins. (e.g: make sure to leave at least 500KB of unallocated 98*4882a593Smuzhiyunspace at the start of the mmc when creating the partitions) 99*4882a593Smuzhiyun 100*4882a593SmuzhiyunCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is used by SPL, and should 101*4882a593Smuzhiyunpoint to the sector were the u-boot image is located. (eg. After SPL) 102*4882a593Smuzhiyun 103*4882a593SmuzhiyunThere are 2 ways to copy the AIS image to the mmc card: 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun 1 - Using the TI tool "uflash" 106*4882a593Smuzhiyun $ uflash -d /dev/mmcblk0 -b ./u-boot.ais -p OMAPL138 -vv 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun 2 - using the "dd" command 109*4882a593Smuzhiyun $ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync 110*4882a593Smuzhiyun 111*4882a593Smuzhiyunuflash writes the AIS image at offset 117. For compatibility with uflash, 112*4882a593SmuzhiyunCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is set to take into account this 113*4882a593Smuzhiyunoffset, and the dd command is adjusted accordingly. 114*4882a593Smuzhiyun 115*4882a593SmuzhiyunRecovery 116*4882a593Smuzhiyun======== 117*4882a593Smuzhiyun 118*4882a593SmuzhiyunIn the case of a "bricked" board, you need to use the TI tools found 119*4882a593Smuzhiyunhere[1] to write the u-boot.ais file. An example of recovering to the SPI 120*4882a593Smuzhiyunflash of an AM1808 would be: 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \ 123*4882a593Smuzhiyun -flash_noubl /path/to/u-boot.ais 124*4882a593Smuzhiyun 125*4882a593SmuzhiyunFor other target types and flash locations: 126*4882a593Smuzhiyun 127*4882a593Smuzhiyun$ mono sfh_OMAP-L138.exe -h 128*4882a593Smuzhiyun 129*4882a593SmuzhiyunLinks 130*4882a593Smuzhiyun===== 131*4882a593Smuzhiyun[1] 132*4882a593Smuzhiyun http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L138 133