195a372b8STom RiniSummary 295a372b8STom Rini======= 395a372b8STom RiniThe README is for the boot procedure used for various DA850 (or compatible 495a372b8STom Riniparts such as the AM1808) based boards. 595a372b8STom Rini 695a372b8STom RiniIn the context of U-Boot, the board is booted in three stages. The initial 795a372b8STom Rinibootloader which executes upon reset is the ROM Boot Loader (RBL) and sits 895a372b8STom Riniin the internal ROM. The RBL initializes the internal memory and then 995a372b8STom Rinidepending on the exact board and pin configurations will initialize another 1095a372b8STom Rinicontroller (such as SPI or NAND) to continue the boot process by loading 1195a372b8STom Rinithe secondary program loader (SPL). The SPL will initialize the system 1295a372b8STom Rinifurther (some clocks, SDRAM) and then load the full u-boot from a 1395a372b8STom Rinipredefined location in persistent storage to DDR and jumps to the u-boot 1495a372b8STom Rinientry point. 1595a372b8STom Rini 1695a372b8STom RiniAIS is an image format defined by TI for the images that are to be loaded 1795a372b8STom Rinito memory by the RBL. The image is divided into a series of sections and 1895a372b8STom Rinithe image's entry point is specified. Each section comes with meta data 1995a372b8STom Rinilike the target address the section is to be copied to and the size of the 2095a372b8STom Rinisection, which is used by the RBL to load the image. At the end of the 2195a372b8STom Riniimage the RBL jumps to the image entry point. The AIS format allows for 2295a372b8STom Riniother things such as programming the clocks and SDRAM if the header is 2395a372b8STom Riniprogrammed for it. We do not take advantage of this and instead use SPL as 2495a372b8STom Riniit allows for additional flexibility (run-time detect of board revision, 2595a372b8STom Riniloading the next image from a different media, etc). 2695a372b8STom Rini 2795a372b8STom Rini 2895a372b8STom RiniCompilation 2995a372b8STom Rini=========== 3095a372b8STom RiniThe exact build target you need will depend on the board you have. For 3195a372b8STom RiniLogic PD boards, or other boards which store the ethernet MAC address at 3295a372b8STom Rinithe end of SPI flash, run 'make da850evm'. For boards which store the 3395a372b8STom Riniethernet MAC address in the i2c EEPROM located at 0x50, run 3495a372b8STom Rini'make da850_am18xxevm'. Once this build completes you will have a 3595a372b8STom Riniu-boot.ais file that needs to be written to the correct persistent 3695a372b8STom Rinistorage. 3795a372b8STom Rini 3895a372b8STom Rini 3995a372b8STom RiniFlashing the images to SPI 4095a372b8STom Rini========================== 4195a372b8STom RiniThe AIS image can be written to SPI flash using the following commands. 4295a372b8STom RiniAssuming that the network is configured and enabled and the u-boot.ais file 4395a372b8STom Riniis tftp'able. 4495a372b8STom Rini 4595a372b8STom RiniU-Boot > sf probe 0 4695a372b8STom RiniU-Boot > sf erase 0 +320000 4795a372b8STom RiniU-Boot > tftp u-boot.ais 4895a372b8STom RiniU-Boot > sf write c0700000 0 $filesize 4995a372b8STom Rini 50daa483deSahaslam@baylibre.comFlashing the images to NAND 51daa483deSahaslam@baylibre.com=========================== 52daa483deSahaslam@baylibre.comThe AIS image can be written to NAND using the u-boot "nand" commands. 53daa483deSahaslam@baylibre.com 54daa483deSahaslam@baylibre.comExample: 55daa483deSahaslam@baylibre.com 56daa483deSahaslam@baylibre.comOMAPL138_LCDK requires the AIS image to be written to the second block of 57daa483deSahaslam@baylibre.comthe NAND flash. 58daa483deSahaslam@baylibre.com 59daa483deSahaslam@baylibre.comFrom the "nand info" command we see that the second block would start at 60daa483deSahaslam@baylibre.comoffset 0x20000: 61daa483deSahaslam@baylibre.com 62daa483deSahaslam@baylibre.com U-Boot > nand info 63daa483deSahaslam@baylibre.com sector size 128 KiB (0x20000) 64daa483deSahaslam@baylibre.com Page size 2048 b 65daa483deSahaslam@baylibre.com 66daa483deSahaslam@baylibre.comFrom the tftp command we see that we need to copy 0x74908 bytes from 67daa483deSahaslam@baylibre.commemory address 0xc0700000 (0x75000 if we align a page of 2048): 68daa483deSahaslam@baylibre.com 69daa483deSahaslam@baylibre.com U-Boot > tftp u-boot.ais 70daa483deSahaslam@baylibre.com Load address: 0xc0700000 71daa483deSahaslam@baylibre.com Bytes transferred = 477448 (74908 hex) 72daa483deSahaslam@baylibre.com 73daa483deSahaslam@baylibre.comThe commands to write the image from memory to NAND would be: 74daa483deSahaslam@baylibre.com 75daa483deSahaslam@baylibre.com U-Boot > nand erase 0x20000 0x75000 76daa483deSahaslam@baylibre.com U-Boot > nand write 0xc0700000 0x20000 0x75000 77daa483deSahaslam@baylibre.com 78daa483deSahaslam@baylibre.comAlternatively, MTD partitions may be defined. Using "mtdparts" to 79daa483deSahaslam@baylibre.comconveniently have a bootloader partition starting at the second block 80daa483deSahaslam@baylibre.com(offset 0x20000): 81daa483deSahaslam@baylibre.com 82daa483deSahaslam@baylibre.com setenv mtdids nand0=davinci_nand.0 83daa483deSahaslam@baylibre.com setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader) 84daa483deSahaslam@baylibre.com 85daa483deSahaslam@baylibre.comIn this case the commands would be simplified to: 86daa483deSahaslam@baylibre.com 87daa483deSahaslam@baylibre.com U-Boot > tftp u-boot.ais 88daa483deSahaslam@baylibre.com U-Boot > nand erase.part bootloader 89daa483deSahaslam@baylibre.com U-Boot > nand write 0xc0700000 bootloader 90daa483deSahaslam@baylibre.com 914aac44beSahaslam@baylibre.comFlashing the images to MMC 924aac44beSahaslam@baylibre.com========================== 934aac44beSahaslam@baylibre.comIf the boot pins are set to boot from mmc, the RBL will try to load the 944aac44beSahaslam@baylibre.comnext boot stage form the first couple of sectors of an external mmc card. 954aac44beSahaslam@baylibre.comAs sector 0 is usually used for storing the partition information, the 964aac44beSahaslam@baylibre.comAIS image should be written at least after the first sector, but before the 974aac44beSahaslam@baylibre.comfirst partition begins. (e.g: make sure to leave at least 500KB of unallocated 984aac44beSahaslam@baylibre.comspace at the start of the mmc when creating the partitions) 994aac44beSahaslam@baylibre.com 1004aac44beSahaslam@baylibre.comCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is used by SPL, and should 1014aac44beSahaslam@baylibre.compoint to the sector were the u-boot image is located. (eg. After SPL) 1024aac44beSahaslam@baylibre.com 1034aac44beSahaslam@baylibre.comThere are 2 ways to copy the AIS image to the mmc card: 1044aac44beSahaslam@baylibre.com 1054aac44beSahaslam@baylibre.com 1 - Using the TI tool "uflash" 1064aac44beSahaslam@baylibre.com $ uflash -d /dev/mmcblk0 -b ./u-boot.ais -p OMAPL138 -vv 1074aac44beSahaslam@baylibre.com 1084aac44beSahaslam@baylibre.com 2 - using the "dd" command 1094aac44beSahaslam@baylibre.com $ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync 1104aac44beSahaslam@baylibre.com 1114aac44beSahaslam@baylibre.comuflash writes the AIS image at offset 117. For compatibility with uflash, 1124aac44beSahaslam@baylibre.comCONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is set to take into account this 1134aac44beSahaslam@baylibre.comoffset, and the dd command is adjusted accordingly. 11495a372b8STom Rini 115*09d84117SAdam FordFlashing the images to NOR 116*09d84117SAdam Ford========================== 117*09d84117SAdam FordNOR Flash is XIP (execute-in-place), so no AIS (or SPL) is needed. The 118*09d84117SAdam Fordu-boot.bin is directy flashed, but CONFIT_DA850_LOWLEVEL must be set 119*09d84117SAdam Fordto initialize hardware that's normally done by SPL. 120*09d84117SAdam Ford 121*09d84117SAdam FordFor this case, CONFIG_SYS_TEXT_BASE=0x60000000 which is the address to 122*09d84117SAdam Fordwhich the bootloader jumps when powered on. 123*09d84117SAdam Ford 124*09d84117SAdam FordExample: 125*09d84117SAdam FordFor the da850evm, there is a defconfig setup to use the NOR flash on 126*09d84117SAdam Fordthe UI expander board called da850evm_direct_nor_defconfig. 127*09d84117SAdam Ford 128*09d84117SAdam FordFlash to NOR directly using 129*09d84117SAdam Fordsudo mono ./sfh_OMAP-L138.exe -p /dev/ttyUSB0 -flash_noubl 130*09d84117SAdam Ford -flashType NOR u-boot.bin 131*09d84117SAdam Ford 132*09d84117SAdam FordSW7:5 through SW7:7 should be switched on and all others off. 133*09d84117SAdam Ford 13495a372b8STom RiniRecovery 13595a372b8STom Rini======== 13695a372b8STom Rini 13795a372b8STom RiniIn the case of a "bricked" board, you need to use the TI tools found 13895a372b8STom Rinihere[1] to write the u-boot.ais file. An example of recovering to the SPI 13995a372b8STom Riniflash of an AM1808 would be: 14095a372b8STom Rini 14195a372b8STom Rini$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \ 14295a372b8STom Rini -flash_noubl /path/to/u-boot.ais 14395a372b8STom Rini 14495a372b8STom RiniFor other target types and flash locations: 14595a372b8STom Rini 14695a372b8STom Rini$ mono sfh_OMAP-L138.exe -h 14795a372b8STom Rini 14895a372b8STom RiniLinks 14995a372b8STom Rini===== 15095a372b8STom Rini[1] 15195a372b8STom Rini http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L138 152