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