dot.gdbinit 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # .gdbinit file
  2. # $Id: dot.gdbinit,v 1.1 2005/04/11 02:21:08 sakugawa Exp $
  3. # setting
  4. set width 0d70
  5. set radix 0d16
  6. use_debug_dma
  7. # Initialize SDRAM controller for Mappi
  8. define sdram_init
  9. # SDIR0
  10. set *(unsigned long *)0x00ef6008 = 0x00000182
  11. # SDIR1
  12. set *(unsigned long *)0x00ef600c = 0x00000001
  13. # Initialize wait
  14. shell sleep 0.1
  15. # MOD
  16. set *(unsigned long *)0x00ef602c = 0x00000020
  17. set *(unsigned long *)0x00ef604c = 0x00000020
  18. # TR
  19. set *(unsigned long *)0x00ef6028 = 0x00051502
  20. set *(unsigned long *)0x00ef6048 = 0x00051502
  21. # ADR
  22. set *(unsigned long *)0x00ef6020 = 0x08000004
  23. set *(unsigned long *)0x00ef6040 = 0x0c000004
  24. # AutoRef On
  25. set *(unsigned long *)0x00ef6004 = 0x00010517
  26. # Access enable
  27. set *(unsigned long *)0x00ef6024 = 0x00000001
  28. set *(unsigned long *)0x00ef6044 = 0x00000001
  29. end
  30. # Initialize LAN controller for Mappi
  31. define lanc_init
  32. # Set BSEL4
  33. #set *(unsigned long *)0x00ef5004 = 0x0fff330f
  34. #set *(unsigned long *)0x00ef5004 = 0x01113301
  35. # set *(unsigned long *)0x00ef5004 = 0x02011101
  36. # set *(unsigned long *)0x00ef5004 = 0x04441104
  37. end
  38. define clock_init
  39. set *(unsigned long *)0x00ef4010 = 2
  40. set *(unsigned long *)0x00ef4014 = 2
  41. set *(unsigned long *)0x00ef4020 = 3
  42. set *(unsigned long *)0x00ef4024 = 3
  43. set *(unsigned long *)0x00ef4004 = 0x7
  44. # shell sleep 0.1
  45. # set *(unsigned long *)0x00ef4004 = 0x5
  46. shell sleep 0.1
  47. set *(unsigned long *)0x00ef4008 = 0x0200
  48. end
  49. define port_init
  50. set $sfrbase = 0x00ef0000
  51. set *(unsigned short *)0x00ef1060 = 0x5555
  52. set *(unsigned short *)0x00ef1062 = 0x5555
  53. set *(unsigned short *)0x00ef1064 = 0x5555
  54. set *(unsigned short *)0x00ef1066 = 0x5555
  55. set *(unsigned short *)0x00ef1068 = 0x5555
  56. set *(unsigned short *)0x00ef106a = 0x0000
  57. set *(unsigned short *)0x00ef106e = 0x5555
  58. set *(unsigned short *)0x00ef1070 = 0x5555
  59. end
  60. # MMU enable
  61. define mmu_enable
  62. set $evb=0x88000000
  63. set *(unsigned long *)0xffff0024=1
  64. end
  65. # MMU disable
  66. define mmu_disable
  67. set $evb=0
  68. set *(unsigned long *)0xffff0024=0
  69. end
  70. # Show TLB entries
  71. define show_tlb_entries
  72. set $i = 0
  73. set $addr = $arg0
  74. while ($i < 0d16 )
  75. set $tlb_tag = *(unsigned long*)$addr
  76. set $tlb_data = *(unsigned long*)($addr + 4)
  77. printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data
  78. set $i = $i + 1
  79. set $addr = $addr + 8
  80. end
  81. end
  82. define itlb
  83. set $itlb=0xfe000000
  84. show_tlb_entries $itlb
  85. end
  86. define dtlb
  87. set $dtlb=0xfe000800
  88. show_tlb_entries $dtlb
  89. end
  90. # Cache ON
  91. define set_cache_type
  92. set $mctype = (void*)0xfffffff8
  93. # chaos
  94. # set *(unsigned long *)($mctype) = 0x0000c000
  95. # m32102 i-cache only
  96. set *(unsigned long *)($mctype) = 0x00008000
  97. # m32102 d-cache only
  98. # set *(unsigned long *)($mctype) = 0x00004000
  99. end
  100. define cache_on
  101. set $param = (void*)0x08001000
  102. set *(unsigned long *)($param) = 0x60ff6102
  103. end
  104. # Show current task structure
  105. define show_current
  106. set $current = $spi & 0xffffe000
  107. printf "$current=0x%08lX\n",$current
  108. print *(struct task_struct *)$current
  109. end
  110. # Show user assigned task structure
  111. define show_task
  112. set $task = $arg0 & 0xffffe000
  113. printf "$task=0x%08lX\n",$task
  114. print *(struct task_struct *)$task
  115. end
  116. document show_task
  117. Show user assigned task structure
  118. arg0 : task structure address
  119. end
  120. # Show M32R registers
  121. define show_regs
  122. printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3
  123. printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7
  124. printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11
  125. printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp
  126. printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu
  127. printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch
  128. printf "EVB[0x%08lX]\n",$evb
  129. set $mests = *(unsigned long *)0xffff000c
  130. set $mdeva = *(unsigned long *)0xffff0010
  131. printf "MESTS[0x%08lX] MDEVA[0x%08lX]\n",$mests,$mdeva
  132. end
  133. # Setup all
  134. define setup
  135. clock_init
  136. shell sleep 0.1
  137. port_init
  138. sdram_init
  139. # lanc_init
  140. # dispc_init
  141. # set $evb=0x08000000
  142. end
  143. # Load modules
  144. define load_modules
  145. use_debug_dma
  146. load
  147. # load busybox.mot
  148. end
  149. # Set kernel parameters
  150. define set_kernel_parameters
  151. set $param = (void*)0x08001000
  152. ## MOUNT_ROOT_RDONLY
  153. set {long}($param+0x00)=0
  154. ## RAMDISK_FLAGS
  155. #set {long}($param+0x04)=0
  156. ## ORIG_ROOT_DEV
  157. #set {long}($param+0x08)=0x00000100
  158. ## LOADER_TYPE
  159. #set {long}($param+0x0C)=0
  160. ## INITRD_START
  161. set {long}($param+0x10)=0x082a0000
  162. ## INITRD_SIZE
  163. set {long}($param+0x14)=0d6200000
  164. # M32R_CPUCLK
  165. set *(unsigned long *)($param + 0x0018) = 0d100000000
  166. # M32R_BUSCLK
  167. set *(unsigned long *)($param + 0x001c) = 0d50000000
  168. # M32R_TIMER_DIVIDE
  169. set *(unsigned long *)($param + 0x0020) = 0d128
  170. set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/root.2.6_04 nfsaddrs=192.168.0.102:192.168.0.1:192.168.0.1:255.255.255.0:mappi: \0"
  171. end
  172. # Boot
  173. define boot
  174. set_kernel_parameters
  175. debug_chaos
  176. set *(unsigned long *)0x00f00000=0x08002000
  177. set $pc=0x08002000
  178. set $fp=0
  179. del b
  180. si
  181. end
  182. # Restart
  183. define restart
  184. sdireset
  185. sdireset
  186. setup
  187. load_modules
  188. boot
  189. end
  190. sdireset
  191. sdireset
  192. file vmlinux
  193. target m32rsdi
  194. restart
  195. boot