免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1581 | 回复: 0
打印 上一主题 下一主题

用OPENOCD 调试LINUX(带MMU) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-25 19:56 |只看该作者 |倒序浏览

1.编译带调试信息的内核,并将对应的zImage烧写到nandz中(bootloader在此必须已经正确的配置,确保传递参数的正确性)
2.目标板上电
##### FriendlyARM BIOS for 2440 #####                                          
[x] bon part 0 320k 2368k                                                      
[v] Download vivi                                                               
[k] Download linux kernel                                                      
[y] Download root_yaffs image                                                   
[c] Download root_cramfs image                                                  
[n] Download Nboot                                                              
[e] Download Eboot                                                              
Download WinCE NK.nb0                                                      
[w] Download WinCE NK.bin                                                      
[d] Download & Run                                                              
[f] Format the nand flash                                                      
[p] Partition for Linux                                                         
Boot the system                                                            
Set the boot parameters                                                     
[t] Print the TOC struct of wince                                               
[q] Goto shell of vivi                                                         
Enter your selection:
3.启动OPENOCD并用telnet链接到OPENOCD然后说输入以下命令:
#halt
#bp 0x30008000 4 hw/*这是Bootloader加载zImage到内存的地址*/
#bp /*查看断点是否成功*/
#resume
3.minicom终端按下b键
##### FriendlyARM BIOS for 2440 #####                                          
[x] bon part 0 320k 2368k                                                      
[v] Download vivi                                                               
[k] Download linux kernel                                                      
[y] Download root_yaffs image                                                   
[c] Download root_cramfs image                                                  
[n] Download Nboot                                                              
[e] Download Eboot                                                              
Download WinCE NK.nb0                                                      
[w] Download WinCE NK.bin                                                      
[d] Download & Run                                                              
[f] Format the nand flash                                                      
[p] Partition for Linux                                                         
Boot the system                                                            
Set the boot parameters                                                     
[t] Print the TOC struct of wince                                               
[q] Goto shell of vivi                                                         
Enter your selection: b
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done     
zImage magic = 0x016f2818                                                      
Setup linux parameters at 0x30000100                                            
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttyS"
MACH_TYPE = 782                                                                 
NOW, Booting Linux......
4.回到telnet界面输入以下命令:
#rbp 0x30008000
#bp 0x300080d4 4 hw/*通过查看反汇编得知在这里开启MMU*/
#resume
5.这是minicom输出为
##### FriendlyARM BIOS for 2440 #####                                          
[x] bon part 0 320k 2368k                                                      
[v] Download vivi                                                               
[k] Download linux kernel                                                      
[y] Download root_yaffs image                                                   
[c] Download root_cramfs image                                                  
[n] Download Nboot                                                              
[e] Download Eboot                                                              
Download WinCE NK.nb0                                                      
[w] Download WinCE NK.bin                                                      
[d] Download & Run                                                              
[f] Format the nand flash                                                      
[p] Partition for Linux                                                         
Boot the system                                                            
Set the boot parameters                                                     
[t] Print the TOC struct of wince                                               
[q] Goto shell of vivi                                                         
Enter your selection: b                                                         
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done     
zImage magic = 0x016f2818                                                      
Setup linux parameters at 0x30000100                                            
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttyS"
MACH_TYPE = 782                                                                 
NOW, Booting Linux......                                                        
Uncompressing Linux.............................................................
6.开启eclipse 配置arm-linuc-gdb初始化命令如下
target remote localhost:3333
monitor halt
monitor step
monitor rbp 0x300080d4
monitor arm7_9 sw_bkpts enable
hbreak start_kernel
continue
7.启动GDB然后可以看见在start_kernel处停止


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/101140/showart_2060159.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP