用eclipse调试uboot工程

用eclipse调试uboot工程


----------------------------------------------------------------------

2013-4-7更新:整理的PDF版本,放到这里了:http://download.csdn.net/detail/kangear/5230353

----------------------------------------------------------------------

   本文是在ubuntu12.10上调试的。首先保证jlink for linux中的JLinkGDBServer可以用!具体可以参考《(先留着,还没有整理好)。还要装好arm-linux-gdb安装方法参见这个《arm-linux-gdb的安装》。
0。安装 eclipse 插件 Zylin Embedded CDT
  打开 eclipsec 后,选择 Help->install New Software...在 Work with 位置输入http://com.zylin.cdt.feature 依指示完成安裝
打开上文中的U-boot3工程(可以参考这里《用eclipse导入uboot工程》),保证能正常编译。

1。启动后,先Run-》Debug Configrations 如下图配置:

 

 2。点击Debuger,如下配置:

 

 3。点击Commands-》如下配置:(里边填写的内容下附件)

 

 4。依此点击如下图所示:

 

 5。下边是调试窗口:

 

6。这样单步调度u-boot了。

参考1:《使用JLINK GDBSERVER调试U-BOOT的方法》http://blog.csdn.net/samantha_sun/article/details/6245504


参考2:《图解Ubuntu + Eclipse + JLink + arm-linux-gcc 配置》http://wenku.baidu.com/view/e4f9ad76f242336c1eb95ed2.html

参考3:《JLlink+GDB调试U-Boot  》http://blog.163.com/nesnil@126/blog/static/380812982012223104416462/


附件1:3里边输入的内容在如下:(参考《JLlink+GDB调试U-Boot  》中的.gdbinit)(更新:这个不能启动内核,附件2可以

 pasting

  1. #  
  2.   
  3. # J-LINK GDB SERVER initialization  
  4.   
  5. #  
  6.   
  7. # This connects to a GDB Server listening  
  8.   
  9. # for commands on localhost at tcp port 2331  
  10.   
  11. target remote 127.0.0.1:2331 #首先连接主机的GDB Server,端口都是2331。  
  12.   
  13. #注意主机的GDB Server勾掉"Localhost only"选项,否则连接不上  
  14.   
  15. # Set JTAG speed to 30 kHz  
  16.   
  17. monitor speed 30  
  18.   
  19.    
  20.   
  21. # Set GDBServer to little endian  
  22.   
  23. monitor endian little  
  24.   
  25.    
  26. #end  
  27.   
  28. # Reset the chip to get to a known state.  
  29.   
  30. monitor reset  
  31.   
  32.    
  33.   
  34. #  
  35.   
  36. # CPU core initialization  
  37.   
  38. #  
  39.   
  40.    
  41.   
  42. # Set the processor mode  
  43.   
  44. monitor reg cpsr = 0xd3  
  45.   
  46.    
  47.   
  48. #disable watchdog  
  49.   
  50. monitor MemU32 0x53000000 = 0x00000000  
  51.   
  52.    
  53.   
  54. #disable interrupt  
  55.   
  56. monitor MemU32 0x4A000008 = 0xFFFFFFFF #INTMSK  
  57.   
  58. monitor MemU32 0x4A00000C = 0x00007FFF #INTSUBMSK  
  59.   
  60.    
  61.   
  62. #set clock  
  63.   
  64. monitor MemU32 0x4C000000 = 0x00FFFFFF  
  65.   
  66. monitor MemU32 0x4C000014 = 0x00000005  
  67.   
  68. monitor MemU32 0x4C000004 = 0x0005C011  
  69.   
  70.    
  71.   
  72. #config sdram  
  73.   
  74. monitor MemU32 0x48000000 = 0x22011110 #conw  
  75.   
  76. monitor MemU32 0x48000004 = 0x00000700 #bank0  
  77.   
  78. monitor MemU32 0x48000008 = 0x00000700 #bank1  
  79.   
  80. monitor MemU32 0x4800000C = 0x00000700 #bank2  
  81.   
  82. monitor MemU32 0x48000010 = 0x00000700 #bank3  
  83.   
  84. monitor MemU32 0x48000014 = 0x00000700 #bank4  
  85.   
  86. monitor MemU32 0x48000018 = 0x00000700 #bank5  
  87.   
  88. monitor MemU32 0x4800001C = 0x00018005 #bank6  
  89.   
  90. monitor MemU32 0x48000020 = 0x00018005 #bank7  
  91.   
  92. monitor MemU32 0x48000024 = 0x008E04F4 #vREFRESH  
  93.   
  94. monitor MemU32 0x48000028 = 0xB1 #vBANKSIZE -- 128M/128M --- should  
  95.   
  96. monitor MemU32 0x4800002c = 0x30 #vMRSRB6  
  97.   
  98. monitor MemU32 0x48000030 = 0x30 #vMRSRB7  
  99.   
  100.    
  101.   
  102. # Set auto JTAG speed  
  103.   
  104. monitor speed auto  
  105.   
  106.    
  107.   
  108. # Setup GDB FOR FASTER DOWNLOADS  
  109.   
  110. set remote memory-write-packet-size 1024  
  111.   
  112. set remote memory-write-packet-size fixed  
  113.   
  114.    
  115.   
  116. # Load the program executable called "image.elf"  
  117.   
  118. # load image.elf  
  119.   
  120. b _start  
  121.   
  122. load  
  123.   
  124. continue 

 附件2:能启动内核的脚本内容http://my.csdn.net/kangear/code/detail/40157

原文地址:https://www.cnblogs.com/liuchengchuxiao/p/4123061.html