Chinaunix首页 | 论坛 | 博客
  • 博客访问: 240496
  • 博文数量: 49
  • 博客积分: 1595
  • 博客等级: 上尉
  • 技术积分: 497
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-21 15:22
文章分类

全部博文(49)

文章存档

2011年(19)

2010年(30)

我的朋友

分类: LINUX

2010-07-15 15:55:50

!# U-Boot 编译调试 ## 请参考Pro_&_Linux_App_Edition_Targeting_Manual.chm
./ltib ## install ltib
$ ./ltib -p u-boot -m prep ## get U-Boot source
$ cd rpm/BUILD/u-boot-1.1.3
$ vim config.mk
 DBGFLAGS = -g2 -gdwarf-2
 AFLAGS_DEBUG = -Wa,-gdwarf2
 OPTFLAGS = -O1
$ vim u-boot-1.1.3/lib_ppc/board.c ## line624: debug => printf
 debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 =>  printf ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
$ make ## 编译,最好用 ./ltib -p u-boot -m scbuild
注意: 用ltib 编译,要修改confing/platform/mpc8349itx/.config中CLFAGS参数
编译常用(make distclean ; make MPC8349ITX_config ; make )
 
 
启动linux samba服务,将u-boot目录做共享目录由windows访问
在windows上访问uboot共享目录,打开后右键点击共享目录,映射为磁盘驱动器z
 
 
启动CodeWarrior IDE,
@ IDE: File > Open , find and open ELF file: u-boot , click OK
@ IDE: Choose Debugger : CodeWarrior USB TAP , click OK
按照提示选择添加缺少的文件start.S(前提是将源码完全复制),其余会自动添加,不能自动添加的,手动添加。
 
 
设置好断点,开发板上电。
 
加上跳线J22E,利用u-boot烧写u-boot.bin 到 fe700000
=> erase 0xfe70000 0xfe74ffff
=> cp.b $loadaddr 0xfe700000 $filesize
完毕,重启,去掉J22E调试。或flash 烧写u-boot.bin到fe700000 (依据Pro_&_Linux_App_Edition_Targeting_Manual.chm)
上面利用u-boot烧写u-boot.bin到fe700000相当于下面的操作:
去掉J22 A,B,C,E,利用CodeWarrior烧写u-boot.bin到 0xfef0_0000
flash programmer加载配置文件liuby.xml,修改Flash Memory Base Address为fe80_0000
在Erase/Blank_chek窗口不要勾选 All Sectors,鼠标选取 fef00000 <-> fef4_ffff,擦除
在Program/Verify窗口选取u-boot.bin,修改Apply Address Offset: 0xfef00000,烧写。
完毕,插上J22 A,B,C,重启,调试。
 
 
调试分为3个阶段:
Debugging U-Boot before the MMU is Enabled
Debugging U-Boot after the MMU is Enabled
Debugging the U-Boot Section in RAM
 
 
1. Debugging U-Boot before the MMU is Enabled
 遵照选择alternate load address: 0xfef0 0000
 不选择Use Target Initialization File
 CW -> Debug -> Attach to Process ;break停止,F10单步运行
2. Debugging U-Boot after the MMU is Enabled
 遵照,不选择Alternate Load Addr:
 不选择Use Target Initialization File
 CW -> Debug -> Attach to Process ;break停止,F10单步运行
 board_init_f(board.c)函数入口处设置 hardware断点。
 
随记.
 
阅读(7631) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~