1Summary 2======= 3The README is for the boot procedure used for various DA850 (or compatible 4parts such as the AM1808) based boards. 5 6In the context of U-Boot, the board is booted in three stages. The initial 7bootloader which executes upon reset is the ROM Boot Loader (RBL) and sits 8in the internal ROM. The RBL initializes the internal memory and then 9depending on the exact board and pin configurations will initialize another 10controller (such as SPI or NAND) to continue the boot process by loading 11the secondary program loader (SPL). The SPL will initialize the system 12further (some clocks, SDRAM) and then load the full u-boot from a 13predefined location in persistent storage to DDR and jumps to the u-boot 14entry point. 15 16AIS is an image format defined by TI for the images that are to be loaded 17to memory by the RBL. The image is divided into a series of sections and 18the image's entry point is specified. Each section comes with meta data 19like the target address the section is to be copied to and the size of the 20section, which is used by the RBL to load the image. At the end of the 21image the RBL jumps to the image entry point. The AIS format allows for 22other things such as programming the clocks and SDRAM if the header is 23programmed for it. We do not take advantage of this and instead use SPL as 24it allows for additional flexibility (run-time detect of board revision, 25loading the next image from a different media, etc). 26 27 28Compilation 29=========== 30The exact build target you need will depend on the board you have. For 31Logic PD boards, or other boards which store the ethernet MAC address at 32the end of SPI flash, run 'make da850evm'. For boards which store the 33ethernet MAC address in the i2c EEPROM located at 0x50, run 34'make da850_am18xxevm'. Once this build completes you will have a 35u-boot.ais file that needs to be written to the correct persistent 36storage. 37 38 39Flashing the images to SPI 40========================== 41The AIS image can be written to SPI flash using the following commands. 42Assuming that the network is configured and enabled and the u-boot.ais file 43is tftp'able. 44 45U-Boot > sf probe 0 46U-Boot > sf erase 0 +320000 47U-Boot > tftp u-boot.ais 48U-Boot > sf write c0700000 0 $filesize 49 50Flashing the images to NAND 51=========================== 52The AIS image can be written to NAND using the u-boot "nand" commands. 53 54Example: 55 56OMAPL138_LCDK requires the AIS image to be written to the second block of 57the NAND flash. 58 59From the "nand info" command we see that the second block would start at 60offset 0x20000: 61 62 U-Boot > nand info 63 sector size 128 KiB (0x20000) 64 Page size 2048 b 65 66From the tftp command we see that we need to copy 0x74908 bytes from 67memory address 0xc0700000 (0x75000 if we align a page of 2048): 68 69 U-Boot > tftp u-boot.ais 70 Load address: 0xc0700000 71 Bytes transferred = 477448 (74908 hex) 72 73The commands to write the image from memory to NAND would be: 74 75 U-Boot > nand erase 0x20000 0x75000 76 U-Boot > nand write 0xc0700000 0x20000 0x75000 77 78Alternatively, MTD partitions may be defined. Using "mtdparts" to 79conveniently have a bootloader partition starting at the second block 80(offset 0x20000): 81 82 setenv mtdids nand0=davinci_nand.0 83 setenv mtdparts mtdparts=davinci_nand.0:128k(bootenv),2m(bootloader) 84 85In this case the commands would be simplified to: 86 87 U-Boot > tftp u-boot.ais 88 U-Boot > nand erase.part bootloader 89 U-Boot > nand write 0xc0700000 bootloader 90 91Flashing the images to MMC 92========================== 93If the boot pins are set to boot from mmc, the RBL will try to load the 94next boot stage form the first couple of sectors of an external mmc card. 95As sector 0 is usually used for storing the partition information, the 96AIS image should be written at least after the first sector, but before the 97first partition begins. (e.g: make sure to leave at least 500KB of unallocated 98space at the start of the mmc when creating the partitions) 99 100CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is used by SPL, and should 101point to the sector were the u-boot image is located. (eg. After SPL) 102 103There are 2 ways to copy the AIS image to the mmc card: 104 105 1 - Using the TI tool "uflash" 106 $ uflash -d /dev/mmcblk0 -b ./u-boot.ais -p OMAPL138 -vv 107 108 2 - using the "dd" command 109 $ dd if=u-boot.ais of=/dev/mmcblk0 seek=117 bs=512 conv=fsync 110 111uflash writes the AIS image at offset 117. For compatibility with uflash, 112CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is set to take into account this 113offset, and the dd command is adjusted accordingly. 114 115Flashing the images to NOR 116========================== 117NOR Flash is XIP (execute-in-place), so no AIS (or SPL) is needed. The 118u-boot.bin is directy flashed, but CONFIT_DA850_LOWLEVEL must be set 119to initialize hardware that's normally done by SPL. 120 121For this case, CONFIG_SYS_TEXT_BASE=0x60000000 which is the address to 122which the bootloader jumps when powered on. 123 124Example: 125For the da850evm, there is a defconfig setup to use the NOR flash on 126the UI expander board called da850evm_direct_nor_defconfig. 127 128Flash to NOR directly using 129sudo mono ./sfh_OMAP-L138.exe -p /dev/ttyUSB0 -flash_noubl 130 -flashType NOR u-boot.bin 131 132SW7:5 through SW7:7 should be switched on and all others off. 133 134Recovery 135======== 136 137In the case of a "bricked" board, you need to use the TI tools found 138here[1] to write the u-boot.ais file. An example of recovering to the SPI 139flash of an AM1808 would be: 140 141$ mono sfh_OMAP-L138.exe -targetType AM1808 -p /dev/ttyUSB0 \ 142 -flash_noubl /path/to/u-boot.ais 143 144For other target types and flash locations: 145 146$ mono sfh_OMAP-L138.exe -h 147 148Links 149===== 150[1] 151 http://processors.wiki.ti.com/index.php/Serial_Boot_and_Flash_Loading_Utility_for_OMAP-L138 152