1# .gdbinit file 2# $Id$ 3#----- 4# NOTE: this file is generated by a script, "gen_gdbinit.pl". 5# (Please type "gen_gdbinit.pl --help" and check the help message). 6# $ Id: gen_gdbinit.pl,v 1.5 2004/01/23 08:23:25 takata Exp $ 7#----- 8# target platform: mappi 9 10# setting 11set width 0d70 12set radix 0d16 13debug_chaos 14 15# clk xin:cpu:bif:bus=25:200:50:50 16define clock_init 17 set *(unsigned long *)0x00ef4024 = 2 18 set *(unsigned long *)0x00ef4020 = 2 19 set *(unsigned long *)0x00ef4010 = 0 20 set *(unsigned long *)0x00ef4014 = 0 21 set *(unsigned long *)0x00ef4004 = 3 22 shell sleep 0.1 23 set *(unsigned long *)0x00ef4008 = 0x00000200 24end 25 26# Initialize programmable ports 27define port_init 28 set $sfrbase = 0x00ef0000 29 set *(unsigned short *)0x00ef1060 = 0x5555 30 set *(unsigned short *)0x00ef1062 = 0x5555 31 set *(unsigned short *)0x00ef1064 = 0x5555 32 set *(unsigned short *)0x00ef1066 = 0x5555 33 set *(unsigned short *)0x00ef1068 = 0x5555 34 set *(unsigned short *)0x00ef106a = 0x0000 35 set *(unsigned short *)0x00ef106e = 0x5555 36 set *(unsigned short *)0x00ef1070 = 0x5555 37 # LED ON 38 set *(unsigned char *)($sfrbase + 0x1015) = 0xff 39 set *(unsigned char *)($sfrbase + 0x1085) = 0xff 40 shell sleep 0.1 41 # LED OFF 42 set *(unsigned char *)($sfrbase + 0x1085) = 0x00 43end 44document port_init 45 P5=LED(output), P6.b4=LAN_RESET(output) 46end 47 48# Initialize SDRAM controller 49define sdram_init 50 # SDIR0 51 set *(unsigned long *)0x00ef6008 = 0x00000182 52 # SDIR1 53 set *(unsigned long *)0x00ef600c = 0x00000001 54 # Initialize wait 55 shell sleep 0.1 56 # Ch0-MOD 57 set *(unsigned long *)0x00ef602c = 0x00000020 58 # Ch0-TR 59 set *(unsigned long *)0x00ef6028 = 0x00051502 60 # Ch0-ADR (size:64MB) 61 set *(unsigned long *)0x00ef6020 = 0x00000004 62 # AutoRef On 63 set *(unsigned long *)0x00ef6004 = 0x00010f05 64 # Access enable 65 set *(unsigned long *)0x00ef6024 = 0x00000001 66end 67document sdram_init 68 SDRAM controller initialization 69 0x08000000 - 0x0bffffff (64MB) 70end 71 72# Initialize LAN controller 73define lanc_init 74 set $sfrbase = 0x00ef0000 75 # Set BSEL3 (BSEL3 for the Chaos's bselc) 76 set *(unsigned long *)($sfrbase + 0x5300) = 0x07078040 77 set *(unsigned long *)($sfrbase + 0x5304) = 0x01110102 78 set *(unsigned long *)($sfrbase + 0x5308) = 0x00000001 79 # Reset (P5=LED,P6.b4=LAN_RESET) 80 set *(unsigned short *)($sfrbase + 0x106c) = 0x0000 81 set *(unsigned char *)($sfrbase + 0x1016) = 0xff 82 set *(unsigned char *)($sfrbase + 0x1086) = 0xff 83 shell sleep 0.1 84 # swivel: 0=normal, 4=reverse 85# set *(unsigned char *)($sfrbase + 0x1086) = 0x00 86 set *(unsigned char *)($sfrbase + 0x1086) = 0x04 87 set *(unsigned long *)(0x0c000330) = 0xffffffff 88 # Set mac address 89 set $lanc = (void*)0x0c000300 90 set *(unsigned long *)($lanc + 0x0000) = 0x00610010 91 set *(unsigned long *)($lanc + 0x0004) = 0x00200030 92 set *(unsigned long *)($lanc + 0x0008) = 0x00400050 93 set *(unsigned long *)($lanc + 0x000c) = 0x00600007 94end 95document lanc_init 96 LAN controller initialization 97 ex.) MAC address: 10 20 30 40 50 60 98end 99 100# LCD & CRT dual-head setting (8bpp) 101define dispc_init 102 set $sfrbase = 0x00ef0000 103 # BSEL4 Dispc 104 set *(unsigned long *)($sfrbase + 0x5400) = 0x06078000 105 set *(unsigned long *)($sfrbase + 0x5404) = 0x00101101 106end 107 108# MMU enable 109define mmu_enable 110 set $evb=0x88000000 111 set *(unsigned long *)0xffff0024=1 112end 113 114# MMU disable 115define mmu_disable 116 set $evb=0 117 set *(unsigned long *)0xffff0024=0 118end 119 120# Show TLB entries 121define show_tlb_entries 122 set $i = 0 123 set $addr = $arg0 124 set $nr_entries = $arg1 125 use_mon_code 126 while ($i < $nr_entries) 127 set $tlb_tag = *(unsigned long*)$addr 128 set $tlb_data = *(unsigned long*)($addr + 4) 129 printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data 130 set $i = $i + 1 131 set $addr = $addr + 8 132 end 133 use_debug_dma 134end 135define itlb 136 set $itlb=0xfe000000 137 show_tlb_entries $itlb 0d32 138end 139define dtlb 140 set $dtlb=0xfe000800 141 show_tlb_entries $dtlb 0d32 142end 143 144# Show current task structure 145define show_current 146 set $current = $spi & 0xffffe000 147 printf "$current=0x%08lX\n",$current 148 print *(struct task_struct *)$current 149end 150 151# Show user assigned task structure 152define show_task 153 set = $arg0 & 0xffffe000 154 printf "$task=0x%08lX\n",$task 155 print *(struct task_struct *)$task 156end 157document show_task 158 Show user assigned task structure 159 arg0 : task structure address 160end 161 162# Show M32R registers 163define show_regs 164 printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 165 printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 166 printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 167 printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp 168 printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu 169 printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch 170 printf "EVB[0x%08lX]\n",$evb 171end 172 173# Setup all 174define setup 175 use_mon_code 176 set *(unsigned int)0xfffffffc=0x60 177 shell sleep 0.1 178 clock_init 179 shell sleep 0.1 180 port_init 181 sdram_init 182 lanc_init 183 dispc_init 184 set $evb=0x00000000 185end 186 187# Load modules 188define load_modules 189 use_debug_dma 190 load 191end 192 193# Set kernel parameters 194define set_kernel_parameters 195 set $param = (void*)0x00001000 196 # INITRD_START 197 #set *(unsigned long *)($param + 0x0010) = 0x082a0000 198 # INITRD_SIZE 199 #set *(unsigned long *)($param + 0x0014) = 0x00000000 200 # M32R_CPUCLK 201 set *(unsigned long *)($param + 0x0018) = 0d200000000 202 # M32R_BUSCLK 203 set *(unsigned long *)($param + 0x001c) = 0d50000000 204 205 # M32R_TIMER_DIVIDE 206 set *(unsigned long *)($param + 0x0020) = 0d128 207 208 set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.bbox-httpd nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0" 209end 210 211# Boot 212define boot 213 set_kernel_parameters 214 set $fp = 0 215 set $pc=0x00002000 216 set *(long *)0xfffffff4=0x8080 217# b load_flat_binary 218# set *(unsigned char *)0x08001003=0x63 219# set *(unsigned char *)0x08001003=0x02 220 si 221# c 222end 223 224# Set breakpoints 225define set_breakpoints 226 b *0x08000030 227end 228 229# Restart 230define restart 231 sdireset 232 sdireset 233 setup 234 load_modules 235 boot 236end 237 238sdireset 239sdireset 240file vmlinux 241target m32rsdi 242setup 243load_modules 244boot 245 246