wdenk | a562e1b | 2005-01-09 18:21:42 +0000 | [diff] [blame] | 1 | # |
| 2 | # GDB Init script for the Coldfire 5272 processor. |
| 3 | # |
| 4 | # The main purpose of this script is to configure the |
| 5 | # DRAM controller so code can be loaded. |
| 6 | # |
| 7 | # This file was changed to suite the senTec COBRA5272 board. |
| 8 | # |
| 9 | |
| 10 | define addresses |
| 11 | |
| 12 | set $mbar = 0x10000001 |
| 13 | set $scr = $mbar - 1 + 0x004 |
| 14 | set $spr = $mbar - 1 + 0x006 |
| 15 | set $pmr = $mbar - 1 + 0x008 |
| 16 | set $apmr = $mbar - 1 + 0x00e |
| 17 | set $dir = $mbar - 1 + 0x010 |
| 18 | set $icr1 = $mbar - 1 + 0x020 |
| 19 | set $icr2 = $mbar - 1 + 0x024 |
| 20 | set $icr3 = $mbar - 1 + 0x028 |
| 21 | set $icr4 = $mbar - 1 + 0x02c |
| 22 | set $isr = $mbar - 1 + 0x030 |
| 23 | set $pitr = $mbar - 1 + 0x034 |
| 24 | set $piwr = $mbar - 1 + 0x038 |
| 25 | set $pivr = $mbar - 1 + 0x03f |
| 26 | set $csbr0 = $mbar - 1 + 0x040 |
| 27 | set $csor0 = $mbar - 1 + 0x044 |
| 28 | set $csbr1 = $mbar - 1 + 0x048 |
| 29 | set $csor1 = $mbar - 1 + 0x04c |
| 30 | set $csbr2 = $mbar - 1 + 0x050 |
| 31 | set $csor2 = $mbar - 1 + 0x054 |
| 32 | set $csbr3 = $mbar - 1 + 0x058 |
| 33 | set $csor3 = $mbar - 1 + 0x05c |
| 34 | set $csbr4 = $mbar - 1 + 0x060 |
| 35 | set $csor4 = $mbar - 1 + 0x064 |
| 36 | set $csbr5 = $mbar - 1 + 0x068 |
| 37 | set $csor5 = $mbar - 1 + 0x06c |
| 38 | set $csbr6 = $mbar - 1 + 0x070 |
| 39 | set $csor6 = $mbar - 1 + 0x074 |
| 40 | set $csbr7 = $mbar - 1 + 0x078 |
| 41 | set $csor7 = $mbar - 1 + 0x07c |
| 42 | set $pacnt = $mbar - 1 + 0x080 |
| 43 | set $paddr = $mbar - 1 + 0x084 |
| 44 | set $padat = $mbar - 1 + 0x086 |
| 45 | set $pbcnt = $mbar - 1 + 0x088 |
| 46 | set $pbddr = $mbar - 1 + 0x08c |
| 47 | set $pbdat = $mbar - 1 + 0x08e |
| 48 | set $pcddr = $mbar - 1 + 0x094 |
| 49 | set $pcdat = $mbar - 1 + 0x096 |
| 50 | set $pdcnt = $mbar - 1 + 0x098 |
| 51 | set $sdcr = $mbar - 1 + 0x180 |
| 52 | set $sdtr = $mbar - 1 + 0x184 |
| 53 | set $wrrr = $mbar - 1 + 0x280 |
| 54 | set $wirr = $mbar - 1 + 0x283 |
| 55 | set $wcr = $mbar - 1 + 0x288 |
| 56 | set $wer = $mbar - 1 + 0x28c |
| 57 | |
| 58 | end |
| 59 | |
| 60 | |
| 61 | # |
| 62 | # Setup system configuration |
| 63 | # |
| 64 | define setup-sys |
| 65 | set *((unsigned short *) $scr) = 0x0003 |
| 66 | set *((unsigned short *) $spr) = 0xffff |
| 67 | set *((unsigned char *) $pivr) = 0x4f |
| 68 | end |
| 69 | |
| 70 | |
| 71 | # |
| 72 | # Setup Chip Selects (as per Motorola M5272C3 board) |
| 73 | # |
| 74 | define setup-cs |
| 75 | |
| 76 | # CS0 -- FLASH |
| 77 | set *((unsigned long *) $csbr0) = 0xffe00201 |
| 78 | set *((unsigned long *) $csor0) = 0xffe00014 |
| 79 | |
| 80 | # CS1 -- external bus test |
| 81 | set *((unsigned long *) $csbr1) = 0x0 |
| 82 | set *((unsigned long *) $csor1) = 0x0 |
| 83 | |
| 84 | # CS2 -- Optional FSRAM |
| 85 | set *((unsigned long *) $csbr2) = 0x30000001 |
| 86 | set *((unsigned long *) $csor2) = 0xfff80000 |
| 87 | |
| 88 | # CS3 -- not used |
| 89 | set *((unsigned long *) $csbr3) = 0x0 |
| 90 | set *((unsigned long *) $csor3) = 0x0 |
| 91 | |
| 92 | # CS4 -- not used |
| 93 | set *((unsigned long *) $csbr4) = 0x0 |
| 94 | set *((unsigned long *) $csor4) = 0x0 |
| 95 | |
| 96 | # CS5 -- PLI socket0 |
| 97 | set *((unsigned long *) $csbr5) = 0x0 |
| 98 | set *((unsigned long *) $csor5) = 0x0 |
| 99 | |
| 100 | # CS6 -- PLI socket1 |
| 101 | set *((unsigned long *) $csbr6) = 0x0 |
| 102 | set *((unsigned long *) $csor6) = 0x0 |
| 103 | |
| 104 | # CS7 -- SDRAM |
| 105 | set *((unsigned long *) $csbr7) = 0x00000701 |
| 106 | set *((unsigned long *) $csor7) = 0xff00007c |
| 107 | |
| 108 | end |
| 109 | |
| 110 | |
| 111 | # |
| 112 | # Setup the DRAM controller. |
| 113 | # |
| 114 | |
| 115 | define setup-dram |
| 116 | set *((unsigned long *) $sdtr) = 0x0000f539 |
| 117 | set *((unsigned long *) $sdcr) = 0x00004211 |
| 118 | |
| 119 | # Dummy write to start SDRAM |
| 120 | set *((unsigned long *) 0) = 0 |
| 121 | end |
| 122 | |
| 123 | |
| 124 | # |
| 125 | # Setup for GPIO pins |
| 126 | # |
| 127 | define setup-ppio |
| 128 | |
| 129 | # PORT A -- the LED's |
| 130 | set *((unsigned long *) $pacnt) = 0x00000000 |
| 131 | # lower 8 bits for output: |
| 132 | set *((unsigned short *) $paddr) = 0xff |
| 133 | # LED's off: |
| 134 | set *((unsigned short *) $padat) = 0xff |
| 135 | |
| 136 | # PORT B |
| 137 | set *((unsigned long *) $pbcnt) = 0x55554155 |
| 138 | set *((unsigned short *) $pbddr) = 0x0000 |
| 139 | set *((unsigned short *) $pbdat) = 0x17ea |
| 140 | |
| 141 | # PORT C |
| 142 | #set *((unsigned short *) $pcddr) = 0x0000 |
| 143 | #set *((unsigned short *) $pcdat) = 0x1898 |
| 144 | |
| 145 | # PORT D |
| 146 | set *((unsigned long *) $pdcnt) = 0x00000000 |
| 147 | |
| 148 | end |
| 149 | |
| 150 | |
| 151 | # |
| 152 | # Added for uClinux-coldfire target... |
| 153 | # |
| 154 | target bdm /dev/bdm |
| 155 | |
| 156 | addresses |
| 157 | setup-sys |
| 158 | setup-cs |
| 159 | setup-dram |
| 160 | setup-ppio |
| 161 | set print pretty |
| 162 | set print asm-demangle |
| 163 | display/i $pc |
| 164 | |
| 165 | |
| 166 | # |
| 167 | load u-boot |
| 168 | set $pc=0x20000 |
| 169 | c |