| [2] | 1 | set can-use-hw-watchpoints 1 |
|---|
| 2 | set remote hardware-breakpoint-limit 2 |
|---|
| 3 | set remote hardware-watchpoint-limit 2 |
|---|
| 4 | set remotecache off |
|---|
| 5 | set trust-readonly-sections on |
|---|
| 6 | set endian little |
|---|
| 7 | #set endian big |
|---|
| 8 | set confirm off |
|---|
| 9 | #useful settings |
|---|
| 10 | #set disassemble-next-line on |
|---|
| 11 | |
|---|
| 12 | #set debug remote 1 |
|---|
| 13 | #set debug serial 1 |
|---|
| 14 | |
|---|
| 15 | define tconn |
|---|
| 16 | dont-repeat |
|---|
| 17 | target extended-remote 169.254.96.4:50000 |
|---|
| 18 | end |
|---|
| 19 | document tconn |
|---|
| 20 | Connect to the target. |
|---|
| 21 | This command simply executes target extended-remote command. It is there for |
|---|
| 22 | convenience. |
|---|
| 23 | end |
|---|
| 24 | |
|---|
| 25 | define tload |
|---|
| 26 | dont-repeat |
|---|
| 27 | monitor L |
|---|
| 28 | set $pc=_start |
|---|
| 29 | # set $pc=start |
|---|
| 30 | end |
|---|
| 31 | |
|---|
| 32 | document tload |
|---|
| 33 | Load binary file in to the target memory. |
|---|
| 34 | File will be loaded at address that was given to JTAG server on comand line |
|---|
| 35 | with -a switch. After file is loaded PC will be set to the symbol _start. |
|---|
| 36 | end |
|---|
| 37 | |
|---|
| 38 | define taload |
|---|
| 39 | monitor L,$arg0 |
|---|
| 40 | set $pc=0x$arg0 |
|---|
| 41 | end |
|---|
| 42 | |
|---|
| 43 | document taload |
|---|
| 44 | Load binary file in to the target memory at specified address. |
|---|
| 45 | File will be loaded at address that was specified. Note that address must |
|---|
| 46 | be hexdecimal without 0x prefix. After binary is loaded $pc will be set |
|---|
| 47 | to the load address. |
|---|
| 48 | end |
|---|
| 49 | |
|---|
| 50 | define treset |
|---|
| 51 | dont-repeat |
|---|
| 52 | # monitor R |
|---|
| 53 | # disconnect |
|---|
| 54 | # shell sleep 3 |
|---|
| 55 | # tconn |
|---|
| 56 | disconnect |
|---|
| 57 | shell sleep 6 |
|---|
| 58 | tconn |
|---|
| 59 | end |
|---|
| 60 | document treset |
|---|
| 61 | Reset and run target. |
|---|
| 62 | This command should will reset target and run it after reset. Press Ctrl-C to |
|---|
| 63 | regain control over target after reset. |
|---|
| 64 | end |
|---|
| 65 | |
|---|
| 66 | define trg |
|---|
| 67 | monitor g |
|---|
| 68 | end |
|---|
| 69 | document trg |
|---|
| 70 | Display MIPS CP0 registers. |
|---|
| 71 | Display selected CP0 registers, not shown by "info registers" command. |
|---|
| 72 | end |
|---|
| 73 | |
|---|
| 74 | define trun |
|---|
| 75 | dont-repeat |
|---|
| 76 | tload |
|---|
| 77 | c |
|---|
| 78 | end |
|---|
| 79 | document trun |
|---|
| 80 | Load binary file and execute it. |
|---|
| 81 | File will be loaded at address that was given to JTAG server on comand line |
|---|
| 82 | with -a switch. After file is loaded PC will be set to the symbol _start and |
|---|
| 83 | executed by jumping to that address. |
|---|
| 84 | end |
|---|
| 85 | |
|---|
| 86 | define tcreset |
|---|
| 87 | dont-repeat |
|---|
| 88 | set $reset_ctrl = 0xb0404008 |
|---|
| 89 | set $sw_reset = 0xb0404014 |
|---|
| 90 | set *$reset_ctrl = 0x8 |
|---|
| 91 | set *$sw_reset = 0x80000000 |
|---|
| 92 | disconnect |
|---|
| 93 | shell sleep 3 |
|---|
| 94 | tconn |
|---|
| 95 | end |
|---|
| 96 | document tcreset |
|---|
| 97 | Chip specific reset. |
|---|
| 98 | This command resets chip in a chip specific but more reliable way. This is |
|---|
| 99 | done by wrting reset registers in SUN block. This may not work if you are |
|---|
| 100 | using other than supported chip. If your JTAG supports hardware reset line |
|---|
| 101 | this command is not needed. |
|---|
| 102 | Supported chip - BCM7002, BCM3545 |
|---|
| 103 | end |
|---|
| 104 | |
|---|
| 105 | define print-cause |
|---|
| 106 | set $exccode=($arg0>>2)&0x1f |
|---|
| 107 | printf "ExcCode %d ", $exccode |
|---|
| 108 | if (1 == $exccode) |
|---|
| 109 | printf "TLB modification" |
|---|
| 110 | end |
|---|
| 111 | if (2 == $exccode) |
|---|
| 112 | printf "TLB (load)" |
|---|
| 113 | end |
|---|
| 114 | if (3 == $exccode) |
|---|
| 115 | printf "TLB (store)" |
|---|
| 116 | end |
|---|
| 117 | if (4 == $exccode) |
|---|
| 118 | printf "Address error (load)" |
|---|
| 119 | end |
|---|
| 120 | if (5 == $exccode) |
|---|
| 121 | printf "Address error (store)" |
|---|
| 122 | end |
|---|
| 123 | if (6 == $exccode) |
|---|
| 124 | printf "Bus error (instruction)" |
|---|
| 125 | end |
|---|
| 126 | if (7 == $exccode) |
|---|
| 127 | printf "Bus error (data)" |
|---|
| 128 | end |
|---|
| 129 | if (8 == $exccode) |
|---|
| 130 | printf "Syscall" |
|---|
| 131 | end |
|---|
| 132 | if (9 == $exccode) |
|---|
| 133 | printf "Breakpoint" |
|---|
| 134 | end |
|---|
| 135 | if (10 == $exccode) |
|---|
| 136 | printf "Reserved instruction" |
|---|
| 137 | end |
|---|
| 138 | if (11 == $exccode) |
|---|
| 139 | printf "Coprocessor unusable" |
|---|
| 140 | end |
|---|
| 141 | if (12 == $exccode) |
|---|
| 142 | printf "Arithmetic Overflow" |
|---|
| 143 | end |
|---|
| 144 | echo \n |
|---|
| 145 | end |
|---|
| 146 | document print-cause |
|---|
| 147 | Decode ExcCode field and print in human readable form. |
|---|
| 148 | Usage: "print-cause $cause" or "print-cause value" |
|---|
| 149 | end |
|---|
| 150 | |
|---|
| 151 | define tawatch |
|---|
| 152 | awatch $arg0 |
|---|
| 153 | printf "maint packet Z4,%08x,%x\n", &($arg0), $arg1 |
|---|
| 154 | end |
|---|
| 155 | |
|---|
| 156 | document tawatch |
|---|
| 157 | Set access watchpoint and print command for gdb |
|---|
| 158 | This macro is helper for setting access watchpoint with size greater than |
|---|
| 159 | 4 bytes. Gdb refuses to do this without any hacks. Macro takes 2 arguments |
|---|
| 160 | watchpoint address and watchpoint size. It will then set a normal watchpoint |
|---|
| 161 | so gdb can control it. It also will print a command which user must paste on |
|---|
| 162 | the console to set a watchpoint which monitors starting with address and |
|---|
| 163 | within specified size. |
|---|
| 164 | end |
|---|
| 165 | |
|---|
| 166 | define jcload |
|---|
| 167 | dont-repeat |
|---|
| 168 | monitor L,81000000 |
|---|
| 169 | set $pc=0x81000000 |
|---|
| 170 | end |
|---|
| 171 | |
|---|
| 172 | document jcload |
|---|
| 173 | Load compressed binary |
|---|
| 174 | This command should be used to load specially built compressed binary with |
|---|
| 175 | decompressor. This binary is much smaller than original ram binary and will |
|---|
| 176 | load much faster. The load address and entry point for this binary are |
|---|
| 177 | different than for an uncompressed binary and equal 0x81000000 |
|---|
| 178 | end |
|---|
| 179 | |
|---|
| 180 | define jcrun |
|---|
| 181 | dont-repeat |
|---|
| 182 | jcload |
|---|
| 183 | hbreak bcm_main |
|---|
| 184 | set $start_break = $bpnum |
|---|
| 185 | disable |
|---|
| 186 | enable $start_break |
|---|
| 187 | c |
|---|
| 188 | clear |
|---|
| 189 | enable |
|---|
| 190 | c |
|---|
| 191 | end |
|---|
| 192 | |
|---|
| 193 | document jcrun |
|---|
| 194 | Run compressed binary |
|---|
| 195 | This command shouldbe used to run compressed binary. It will make sure that |
|---|
| 196 | all breakpoints that were set will be restored after decompression. |
|---|
| 197 | end |
|---|
| 198 | |
|---|
| 199 | define sbp |
|---|
| 200 | set $pc += 4 |
|---|
| 201 | end |
|---|
| 202 | document sbp |
|---|
| 203 | Skip embedded breakpoint instrucution. |
|---|
| 204 | end |
|---|
| 205 | |
|---|
| 206 | define xmodem |
|---|
| 207 | # for 7002 |
|---|
| 208 | set *0xb0404090=$arg0 |
|---|
| 209 | # for 7550 |
|---|
| 210 | set *0xb04040d0=$arg0 |
|---|
| 211 | # for 7552 |
|---|
| 212 | set *0xb0404364=$arg0 |
|---|
| 213 | end |
|---|
| 214 | |
|---|
| 215 | tconn |
|---|