1# .gdbinit file
2# $Id: dot.gdbinit.oaks32r,v 1.4 2004/10/20 02:24:37 takata Exp $
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.12 2004/07/26 09:56:10 takata Exp $
7#-----
8# target platform: oaks32r
9
10# setting
11set width 0d70
12set radix 0d16
13
14# clk xin:cpu:bus=16:66:33
15define clock_init
16  set *(unsigned long *)0x00ef4008 = 1
17  shell sleep 0.1
18  set *(unsigned long *)0x00ef4000 = 0x00020100
19end
20
21# Initialize programmable ports
22define port_init
23  set *(unsigned long *)0x00ef1000 = 0x1
24  set *(unsigned long *)0x00ef1060 = 0x01400001
25  set *(unsigned long *)0x00ef1064 = 0x00015555
26  set *(unsigned long *)0x00ef1068 = 0x55555050
27  set *(unsigned long *)0x00ef106c = 0x05150040
28end
29
30# Initialize SDRAM controller
31define sdram_init
32  set *(unsigned long *)0x00ef6008 = 0x00000182
33  set *(unsigned long *)0x00ef600c = 0x00000001
34  shell sleep 0.1
35  set *(unsigned long *)0x00ef602c = 0x00000010
36  set *(unsigned long *)0x00ef6028 = 0x00000300
37  set *(unsigned long *)0x00ef6048 = 0x00000001
38  set *(unsigned long *)0x00ef6020 = 0x01000041
39  set *(unsigned long *)0x00ef6004 = 0x00010117
40  set *(unsigned long *)0x00ef6010 = 0x00000001
41  set *(unsigned long *)0x00ef6024 = 0x00000001
42end
43document sdram_init
44  SDRAM controller initialization
45  0x01000000 - 0x017fffff (8MB)
46end
47
48# Initialize LAN controller
49define lanc_init
50  set *(unsigned long *)0x00ef5008 = 0x03031303
51  #RST DRV (P64)
52  set *(unsigned char *)0x00ef1046 = 0x08
53  set *(unsigned char *)0x00ef1026 = 0xff
54  set *(unsigned char *)0x00ef1026 = 0x00
55  set *(unsigned short *)0x02000630 = 0xffff
56end
57
58# Show current task structure
59define show_current
60  set $current = $spi & 0xffffe000
61  printf "$current=0x%08lX\n",$current
62  print *(struct task_struct *)$current
63end
64
65# Show user assigned task structure
66define show_task
67  set  = $arg0 & 0xffffe000
68  printf "$task=0x%08lX\n",$task
69  print *(struct task_struct *)$task
70end
71document show_task
72  Show user assigned task structure
73  arg0 : task structure address
74end
75
76# Show M32R registers
77define show_regs
78  printf " R0[0x%08lX]   R1[0x%08lX]   R2[0x%08lX]   R3[0x%08lX]\n",$r0,$r1,$r2,$r3
79  printf " R4[0x%08lX]   R5[0x%08lX]   R6[0x%08lX]   R7[0x%08lX]\n",$r4,$r5,$r6,$r7
80  printf " R8[0x%08lX]   R9[0x%08lX]  R10[0x%08lX]  R11[0x%08lX]\n",$r8,$r9,$r10,$r11
81  printf "R12[0x%08lX]   FP[0x%08lX]   LR[0x%08lX]   SP[0x%08lX]\n",$r12,$fp,$lr,$sp
82  printf "PSW[0x%08lX]  CBR[0x%08lX]  SPI[0x%08lX]  SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu
83  printf "BPC[0x%08lX]   PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch
84end
85
86# Setup all
87define setup
88  use_mon_code
89  set *(unsigned int)0xfffffffc=0x60
90  shell sleep 0.1
91  clock_init
92  shell sleep 0.1
93  port_init
94  sdram_init
95  lanc_init
96end
97
98# Load modules
99define load_modules
100  use_debug_dma
101  load
102end
103
104# Set kernel parameters
105define set_kernel_parameters
106  set $param = (void*)0x01001000
107  # INITRD_START
108#  set *(unsigned long *)($param + 0x0010) = 0x00000000
109  # INITRD_SIZE
110#  set *(unsigned long *)($param + 0x0014) = 0x00000000
111  # M32R_CPUCLK
112  set *(unsigned long *)($param + 0x0018) = 0d66666667
113  # M32R_BUSCLK
114  set *(unsigned long *)($param + 0x001c) = 0d33333333
115
116  # M32R_TIMER_DIVIDE
117  set *(unsigned long *)($param + 0x0020) = 0d128
118
119  set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 \0"
120end
121
122# Boot
123define boot
124  set_kernel_parameters
125  set $fp = 0
126  set $pc = 0x01002000
127  si
128  c
129end
130
131# Set breakpoints
132define set_breakpoints
133  b *0x00000020
134  b *0x00000030
135end
136
137# Restart
138define restart
139  sdireset
140  sdireset
141  setup
142  load_modules
143  boot
144end
145
146sdireset
147sdireset
148file vmlinux
149target m32rsdi
150setup
151#load_modules
152#set_breakpoints
153#boot
154
155