gdbconnectwiem.jlink 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. echo Setting up the environment for debugging gdb.\n
  2. set complaints 1
  3. set output-radix 16
  4. set input-radix 16
  5. set endian big
  6. dir .
  7. set prompt (netsilicon-gdb)
  8. # Set target for ROM at addr 0
  9. set rdiromatzero 1
  10. ######################
  11. ## attach-to-target ##
  12. ######################
  13. define attach-to-target
  14. #
  15. # This targets a "Raven" debugger via "netsiliconLibRemote"
  16. # at the named address.
  17. #
  18. target remote localhost:2331
  19. monitor speed 30
  20. #
  21. # Notify netsiliconLibRemote that it should be big endian
  22. #
  23. monitor endian big
  24. #
  25. # Initialize the debugger
  26. #
  27. monitor reset 1 0
  28. monitor halt
  29. end
  30. ###############
  31. ## addresses ##
  32. ###############
  33. define addresses
  34. set $portd_data = 0xffa00040
  35. set $portd_out = 0xffa00044
  36. set $scr = 0xffb00000
  37. set $pllcr = 0xffb00008
  38. set $porta = 0xffb00020
  39. set $portb = 0xffb00024
  40. set $portc = 0xffb00028
  41. set $ier = 0xffb00030
  42. set $mmcr = 0xffc00000
  43. set $csar0 = 0xffc00010
  44. set $csor0 = 0xffc00014
  45. set $csorb0 = 0xffc00018
  46. set $csar1 = 0xffc00020
  47. set $csor1 = 0xffc00024
  48. set $csorb1 = 0xffc00028
  49. set $csar2 = 0xffc00030
  50. set $csor2 = 0xffc00034
  51. set $csorb2 = 0xffc00038
  52. set $csar3 = 0xffc00040
  53. set $csor3 = 0xffc00044
  54. set $csorb3 = 0xffc00048
  55. set $csar4 = 0xffc00050
  56. set $csor4 = 0xffc00054
  57. set $csorb4 = 0xffc00058
  58. end
  59. ##############
  60. ## setup-cs ##
  61. ##############
  62. define setup-cs
  63. monitor long 0xffb00000 = 0x4004a000
  64. monitor long 0xffc00000 = 0x0dc00000
  65. monitor long 0xffb00030 = 0x00000000
  66. monitor long 0xffc00014 = 0xf3000574
  67. monitor long 0xffc00018 = 0x00000005
  68. monitor long 0xffc00010 = 0x02000000
  69. monitor long 0xffc00024 = 0xf3000174
  70. monitor long 0xffc00028 = 0x00000001
  71. monitor long 0xffc00020 = 0x0000022d
  72. #
  73. # Initialize PORTA as all GPIO inputs, and PORTC
  74. # so that any pin which must not have a "sensible"
  75. # value prior to OS initialization is a GPIO input.
  76. #
  77. # This gives the EOS the best chance of initializing
  78. # the pins to the appropriate values at the beginning
  79. # of time.
  80. #
  81. monitor long 0xffb00020 = 0x00000000
  82. monitor long 0xffb00028 = 0x00000000
  83. # Disable CS2-4
  84. monitor long 0xffc00034 = 0
  85. monitor long 0xffc00038 = 0
  86. monitor long 0xffc00030 = 0
  87. monitor long 0xffc00044 = 0
  88. monitor long 0xffc00048 = 0
  89. monitor long 0xffc00040 = 0
  90. monitor long 0xffc00054 = 0
  91. monitor long 0xffc00058 = 0
  92. monitor long 0xffc00050 = 0
  93. monitor long 0x0 = 0
  94. # Set the processor mode
  95. monitor reg cpsr = 0xd3
  96. end
  97. ##################
  98. ## enable-flash ##
  99. ##################
  100. define enable-flash
  101. monitor long 0xffc00010 = 0x02000001
  102. end
  103. ###################
  104. ## disable-flash ##
  105. ###################
  106. define disable-flash
  107. monitor long 0xffc00010 = 0x02000000
  108. end
  109. #################
  110. ## reset-sdram ##
  111. #################
  112. define reset-sdram
  113. monitor long $csar1 = 0
  114. monitor long $csor1 = 0xF3000174
  115. monitor long $csar1 = 0x22d
  116. end
  117. ########
  118. ## sb ##
  119. ########
  120. #
  121. # Useful breakpoints to catch "catastrophic" failure
  122. #
  123. define sb
  124. # Breakpoints on the exception vectors
  125. b *0x0
  126. b *0x4
  127. b *0x8
  128. b *0xc
  129. b *0x10
  130. b *0x14
  131. # b*0x1c
  132. # b*0x20
  133. # Breakpoints on error handling functions
  134. b netosBreakpoint
  135. b netosFatalError
  136. b NARamSetupAbortHandler
  137. b crash
  138. b customizeErrorHandler
  139. b customizeExceptionHandler
  140. end
  141. ###############
  142. ###############
  143. addresses
  144. attach-to-target
  145. setup-cs
  146. # Setup GDB for faster downloads
  147. set remote memory-write-packet-size 1024
  148. set remote memory-write-packet-size fixed
  149. monitor speed auto
  150. # Load the executable and symbols (all in image.elf)
  151. load image.elf