gdbconnectsp.jlink 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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
  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 = 0xf3000170
  70. monitor long 0xffc00028 = 0x00000001
  71. monitor long 0xffc00020 = 0x0000022d
  72. #
  73. # Initialize CS4 to enable mapping for external serial device
  74. #
  75. monitor long 0xffc00054 = 0xfff00574
  76. monitor long 0xffc00058 = 0x00000005
  77. monitor long 0xffc00050 = 0x10000001
  78. #
  79. # Initialize PORTA as all GPIO inputs, and PORTC
  80. # so that any pin which must not have a "sensible"
  81. # value prior to OS initialization is a GPIO input.
  82. #
  83. # This gives the EOS the best chance of initializing
  84. # the pins to the appropriate values at the beginning
  85. # of time.
  86. #
  87. # For SP, the one software controlled LED is
  88. # set to output, and is lit (the power LED).
  89. #
  90. monitor long 0xffb00020 = 0x00000000
  91. monitor long 0xffb00028 = 0x00400000
  92. # Disable CS2-4
  93. monitor long 0xffc00034 = 0
  94. monitor long 0xffc00038 = 0
  95. monitor long 0xffc00030 = 0
  96. monitor long 0xffc00044 = 0
  97. monitor long 0xffc00048 = 0
  98. monitor long 0xffc00040 = 0
  99. monitor long 0x0 = 0
  100. # Set the processor mode
  101. monitor reg cpsr = 0xd3
  102. end
  103. ##################
  104. ## enable-flash ##
  105. ##################
  106. define enable-flash
  107. monitor long 0xffc00010 = 0x02000001
  108. end
  109. ###################
  110. ## disable-flash ##
  111. ###################
  112. define disable-flash
  113. monitor long 0xffc00010 = 0x02000000
  114. end
  115. #################
  116. ## reset-sdram ##
  117. #################
  118. define reset-sdram
  119. monitor long $csar1 = 0
  120. monitor long $csor1 = 0xF3000170
  121. monitor long $csar1 = 0x22d
  122. end
  123. ########
  124. ## sb ##
  125. ########
  126. #
  127. # Useful breakpoints to catch "catastrophic" failure
  128. #
  129. define sb
  130. # Breakpoints on the exception vectors
  131. b *0x0
  132. b *0x4
  133. b *0x8
  134. b *0xc
  135. b *0x10
  136. b *0x14
  137. # b*0x1c
  138. # b*0x20
  139. # Breakpoints on error handling functions
  140. b netosBreakpoint
  141. b netosFatalError
  142. b NARamSetupAbortHandler
  143. b crash
  144. b customizeErrorHandler
  145. b customizeExceptionHandler
  146. end
  147. ###############
  148. ###############
  149. addresses
  150. attach-to-target
  151. setup-cs
  152. # Setup GDB for faster downloads
  153. set remote memory-write-packet-size 1024
  154. set remote memory-write-packet-size fixed
  155. monitor speed auto
  156. # Load the executable and symbols (all in image.elf)
  157. load image.elf