Larry Johnson | 6768267 | 2008-03-17 11:10:35 -0500 | [diff] [blame] | 1 | The Korat board has two NOR flashes, FLASH0 and FLASH1, which are connected to |
| 2 | chip select 0 and 1, respectively. FLASH0 contains 16 MiB, and is mapped to |
| 3 | addresses 0xFF000000 - 0xFFFFFFFF as U-Boot Flash Bank #2. FLASH1 contains |
| 4 | from 16 to 128 MiB, and is mapped to 0xF?000000 - 0xF7FFFFFF as U-Boot Flash |
| 5 | Bank #1 (with the starting address depending on the flash size detected at |
| 6 | runtime). The write-enable pin on FLASH0 is disabled, so the contents of FLASH0 |
| 7 | cannot be modified in the field. This also prevents FLASH0 from executing |
| 8 | commands to return chip information, so its configuration is hard-coded in |
| 9 | U-Boot. |
| 10 | |
| 11 | There are two versions of U-Boot for Korat: "permanent" and "upgradable". The |
| 12 | permanent U-Boot is pre-programmed at the top of FLASH0, e.g., at addresses |
| 13 | 0xFFFA0000 - 0xFFFFFFFF for the current 384 KiB size. The upgradable U-Boot is |
| 14 | located 256 KiB from the top of FLASH1, e.g. at addresses 0xF7F6000 - 0xF7FC0000 |
| 15 | for the current 384 KiB size. FLASH1 addresses 0xF7FE0000 - 0xF7FF0000 are |
| 16 | used for the U-Boot environmental parameters, and addresses 0xF7FC0000 - |
| 17 | 0xF7FDFFFF are used for the redundant copy of the parameters. These locations |
| 18 | are used by both versions of U-Boot. |
| 19 | |
| 20 | On booting, the permanent U-Boot in FLASH0 begins executing. After performing |
| 21 | minimal setup, it monitors the state of the board's Reset switch (GPIO47). If |
| 22 | the switch is sensed as open before a timeout period, then U-Boot branches to |
| 23 | address 0xF7FBFFFC. This causes the upgradable U-Boot to execute from the |
| 24 | beginning. If the switch remains closed thoughout the timeout period, the |
| 25 | permanent U-Boot activates the on-board buzzer until the switch is sensed as |
| 26 | opened. It then continues to execute without branching to FLASH1. The effect |
| 27 | of this is that normally the Korat board boots its upgradable U-Boot, but, if |
| 28 | this has been corrupted, the user can boot the permanent U-Boot, which can then |
| 29 | be used to erase and reload FLASH1 as needed. |
| 30 | |
| 31 | Note that it is not necessary for the permanent U-Boot to have all the latest |
| 32 | features, but only that it have sufficient functionality (working "tftp", |
| 33 | "erase", "cp.b", etc.) to repair FLASH1. Also, the permanent U-Boot makes no |
| 34 | assumptions about the size of FLASH1 or the size of the upgradable U-Boot: it is |
| 35 | sufficient that the upgradable U-Boot can be started by a branch to 0xF7FBFFFC. |
| 36 | |
| 37 | The build sequence: |
| 38 | |
| 39 | make korat_config |
| 40 | make all perm=1 |
| 41 | |
| 42 | builds the permanent U-Boot by selecting loader file "u-boot.lds" and defining |
| 43 | preprocessor symbol "CONFIG_KORAT_PERMANENT". The default build: |
| 44 | |
| 45 | make korat_config |
| 46 | make all |
| 47 | |
| 48 | creates the upgradable U-Boot but selecting loader file "u-boot-F7FC.lds" and |
| 49 | leaving preprocessor symbol "CONFIG_KORAT_PERMANENT" undefined. |
| 50 | |
| 51 | 2008-02-22, Larry Johnson <lrj@acm.org> |