gdbconnectme.jlink 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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
  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. # For ME, the one software controlled LED is
  82. # set to output, and is darkened.
  83. #
  84. monitor long 0xffb00020 = 0x00000000
  85. monitor long 0xffb00028 = 0x00400040
  86. # Disable CS2-4
  87. monitor long 0xffc00034 = 0
  88. monitor long 0xffc00038 = 0
  89. monitor long 0xffc00030 = 0
  90. monitor long 0xffc00044 = 0
  91. monitor long 0xffc00048 = 0
  92. monitor long 0xffc00040 = 0
  93. monitor long 0xffc00054 = 0
  94. monitor long 0xffc00058 = 0
  95. monitor long 0xffc00050 = 0
  96. monitor long 0x0 = 0
  97. # Set the processor mode
  98. monitor reg cpsr = 0xd3
  99. end
  100. ##################
  101. ## enable-flash ##
  102. ##################
  103. define enable-flash
  104. monitor long 0xffc00010 = 0x02000001
  105. end
  106. ###################
  107. ## disable-flash ##
  108. ###################
  109. define disable-flash
  110. monitor long 0xffc00010 = 0x02000000
  111. end
  112. #################
  113. ## reset-sdram ##
  114. #################
  115. define reset-sdram
  116. monitor long $csar1 = 0
  117. monitor long $csor1 = 0xF3000174
  118. monitor long $csar1 = 0x22d
  119. end
  120. ########
  121. ## sb ##
  122. ########
  123. #
  124. # Useful breakpoints to catch "catastrophic" failure
  125. #
  126. define sb
  127. # Breakpoints on the exception vectors
  128. b *0x0
  129. b *0x4
  130. b *0x8
  131. b *0xc
  132. b *0x10
  133. b *0x14
  134. # b*0x1c
  135. # b*0x20
  136. # Breakpoints on error handling functions
  137. b netosBreakpoint
  138. b netosFatalError
  139. b NARamSetupAbortHandler
  140. b crash
  141. b customizeErrorHandler
  142. b customizeExceptionHandler
  143. end
  144. ###############
  145. ###############
  146. addresses
  147. attach-to-target
  148. setup-cs
  149. # Setup GDB for faster downloads
  150. set remote memory-write-packet-size 1024
  151. set remote memory-write-packet-size fixed
  152. monitor speed auto
  153. # Load the executable and symbols (all in image.elf)
  154. load image.elf