dot.gdbinit_400MHz_32MB 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. # .gdbinit file
  2. # $Id: dot.gdbinit_400MHz_32MB,v 1.1 2004/10/21 01:41:27 fujiwara 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: m32700ut
  9. # setting
  10. set width 0d70
  11. set radix 0d16
  12. debug_chaos
  13. # clk xin:cpu:bif:bus=25:400:100:50
  14. define clock_init
  15. set *(unsigned long *)0x00ef4008 = 0x00000000
  16. set *(unsigned long *)0x00ef4004 = 0
  17. shell sleep 0.1
  18. # NOTE: Please change the master clock source from PLL-clock to Xin-clock
  19. # and switch off PLL, before resetting the clock gear ratio.
  20. set *(unsigned long *)0x00ef4024 = 3
  21. set *(unsigned long *)0x00ef4020 = 2
  22. set *(unsigned long *)0x00ef4010 = 0
  23. set *(unsigned long *)0x00ef4014 = 0
  24. set *(unsigned long *)0x00ef4004 = 7
  25. shell sleep 0.1
  26. set *(unsigned long *)0x00ef4008 = 0x00000200
  27. end
  28. # Initialize SDRAM controller
  29. define sdram_init
  30. # SDIR0
  31. set *(unsigned long *)0x00ef6008 = 0x00000182
  32. # SDIR1
  33. set *(unsigned long *)0x00ef600c = 0x00000001
  34. # Initialize wait
  35. shell sleep 0.1
  36. # Ch0-MOD
  37. set *(unsigned long *)0x00ef602c = 0x00000020
  38. # Ch0-TR
  39. set *(unsigned long *)0x00ef6028 = 0x00041302
  40. # Ch0-ADR (size:32MB)
  41. set *(unsigned long *)0x00ef6020 = 0x08000003
  42. # AutoRef On
  43. set *(unsigned long *)0x00ef6004 = 0x00010517
  44. # Access enable
  45. set *(unsigned long *)0x00ef6024 = 0x00000001
  46. end
  47. document sdram_init
  48. SDRAM controller initialization
  49. 0x08000000 - 0x09ffffff (32MB)
  50. end
  51. # Initialize BSEL3 for UT-CFC
  52. define cfc_init
  53. set $sfrbase = 0xa0ef0000
  54. # too fast
  55. # set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000
  56. # set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204
  57. # set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000
  58. # set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf
  59. # set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f
  60. # set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f
  61. end
  62. document cfc_init
  63. CF controller initialization
  64. end
  65. # MMU enable
  66. define mmu_enable
  67. set $evb=0x88000000
  68. set *(unsigned long *)0xffff0024=1
  69. end
  70. # MMU disable
  71. define mmu_disable
  72. set $evb=0
  73. set *(unsigned long *)0xffff0024=0
  74. end
  75. # Show TLB entries
  76. define show_tlb_entries
  77. set $i = 0
  78. set $addr = $arg0
  79. set $nr_entries = $arg1
  80. use_mon_code
  81. while ($i < $nr_entries)
  82. set $tlb_tag = *(unsigned long*)$addr
  83. set $tlb_data = *(unsigned long*)($addr + 4)
  84. printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data
  85. set $i = $i + 1
  86. set $addr = $addr + 8
  87. end
  88. use_debug_dma
  89. end
  90. define itlb
  91. set $itlb=0xfe000000
  92. show_tlb_entries $itlb 0d32
  93. end
  94. define dtlb
  95. set $dtlb=0xfe000800
  96. show_tlb_entries $dtlb 0d32
  97. end
  98. # Initialize TLB entries
  99. define init_tlb_entries
  100. set $i = 0
  101. set $addr = $arg0
  102. set $nr_entries = $arg1
  103. use_mon_code
  104. while ($i < $nr_entries)
  105. set *(unsigned long *)($addr + 0x4) = 0
  106. set $i = $i + 1
  107. set $addr = $addr + 8
  108. end
  109. use_debug_dma
  110. end
  111. define tlb_init
  112. set $itlb=0xfe000000
  113. init_tlb_entries $itlb 0d32
  114. set $dtlb=0xfe000800
  115. init_tlb_entries $dtlb 0d32
  116. end
  117. # Show current task structure
  118. define show_current
  119. set $current = $spi & 0xffffe000
  120. printf "$current=0x%08lX\n",$current
  121. print *(struct task_struct *)$current
  122. end
  123. # Show user assigned task structure
  124. define show_task
  125. set = $arg0 & 0xffffe000
  126. printf "$task=0x%08lX\n",$task
  127. print *(struct task_struct *)$task
  128. end
  129. document show_task
  130. Show user assigned task structure
  131. arg0 : task structure address
  132. end
  133. # Show M32R registers
  134. define show_regs
  135. printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3
  136. printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7
  137. printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11
  138. printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp
  139. printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu
  140. printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch
  141. printf "EVB[0x%08lX]\n",$evb
  142. end
  143. # Setup all
  144. define setup
  145. use_mon_code
  146. set *(unsigned int)0xfffffffc=0x60
  147. shell sleep 0.1
  148. clock_init
  149. shell sleep 0.1
  150. # SDRAM: 32MB
  151. set *(unsigned long *)0x00ef6020 = 0x08000003
  152. cfc_init
  153. # USB
  154. set *(unsigned short *)0xb0301000 = 0x100
  155. set $evb=0x08000000
  156. end
  157. # Load modules
  158. define load_modules
  159. use_debug_dma
  160. load
  161. end
  162. # Set kernel parameters
  163. define set_kernel_parameters
  164. set $param = (void*)0x08001000
  165. # INITRD_START
  166. # set *(unsigned long *)($param + 0x0010) = 0x08300000
  167. # INITRD_SIZE
  168. # set *(unsigned long *)($param + 0x0014) = 0x00000000
  169. # M32R_CPUCLK
  170. set *(unsigned long *)($param + 0x0018) = 0d400000000
  171. # M32R_BUSCLK
  172. set *(unsigned long *)($param + 0x001c) = 0d50000000
  173. # M32R_TIMER_DIVIDE
  174. set *(unsigned long *)($param + 0x0020) = 0d128
  175. set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=32M \0"
  176. end
  177. # Boot
  178. define boot
  179. set_kernel_parameters
  180. set $fp = 0
  181. set $pc = 0x08002000
  182. # set *(unsigned char *)0xffffffff = 0x03
  183. si
  184. c
  185. end
  186. # Set breakpoints
  187. define set_breakpoints
  188. b *0x08000030
  189. end
  190. # Restart
  191. define restart
  192. sdireset
  193. sdireset
  194. set $pc = 0
  195. b *0x04001000
  196. b *0x08001000
  197. b *0x08002000
  198. si
  199. c
  200. tlb_init
  201. del
  202. setup
  203. load_modules
  204. boot
  205. end
  206. define si
  207. stepi
  208. x/i $pc
  209. show_reg
  210. end
  211. sdireset
  212. sdireset
  213. file vmlinux
  214. target m32rsdi
  215. set $pc = 0
  216. b *0x04001000
  217. b *0x08001000
  218. b *0x08002000
  219. c
  220. tlb_init
  221. del
  222. setup
  223. load_modules
  224. boot