从skyeye学习arm( u-boot篇)

来源:互联网 发布:java手机游戏编程 编辑:程序博客网 时间:2024/05/21 04:08


【 声明:版权所有,欢迎转载,请勿用于商业用途。  联系信箱:feixiaoxing @163.com】


    有了上面的skyeye环境,我们可以自己在上面进行测试和学习了。很多学习嵌入式linux的朋友都会涉及到u-boot的移植问题。但是u-boot调试是非常困难的,你能用到的方法不是点灯就是打印。但是有了skyeye之后,完全可以帮我们进行源码级别的调试。要进行u-boot调试,最主要的就是配置一个skyeye 文件和 编译u-boot。


   (1)配置skyeye.conf文件


cpu:  arm920tmach: s3c2410x#physical memory  #mem_bank: map=M, type=RW, addr=0x20000000, size=0x01000000mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000mem_bank: map=M, type=RW, addr=0x30000000, size=0x10000000mem_bank: map=M, type=RW, addr=0xc0000000, size=0x01000000mem_bank: map=M, type=RW, addr=0xc1000000, size=0x00600000mem_bank: map=M, type=RW, addr=0xc1600000, size=0x00a00000#all peripherals I/O mapping area#mem_bank: map=I, type=RW, addr=0xfefa0000, size=0x00060000mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1lcd:type=s3c2410x,mod=gtk#dbct:state=on

    (2)编译u-boot, 我们使用的版本为u-boot-1.3.2.tar.bz2,


    a) 将arm交叉编译环境加入到PATH中;

    b)tar xjvf u-boot-1.3.2.tar.bz2;

    c)cd u-boot-1.3.2;

    d) make smdk2410_config;

    e) make, 编译在时候会有两个错误, 这和编译器有关, 只需要把_udivsi3.S:67, _umodsi3.S:79对应的代码直接用@注释就可以了;

    f)在目录下可以看到生成了u-boot、u-boot.bin两个文件。


    (3)将u-boot、skyeye.conf拷贝到一个目录下,在命令行下直接输入skyeye -e u-boot, 你就可以看到下面的内容


realsil@hp-6531s:~/Desktop/exer/arm_uboot$ skyeye -e u-boot Your elf file is little endian.arch: armcpu info: armv4, arm920t, 41009200, ff00fff0, 2 mach info: name s3c2410x, mach_init addr 0x806dc30ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1failed to setup_module (name:net, type:cs8900a)tapif_init: icotl TUNSETIFF erroruart_mod:0, desc_in:, desc_out:, converter:SKYEYE: use arm920t mmu opsstart addr is set to 0x33f80000 by exec file.ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffffERROR: s3c2410x_io_write_word(0x4c000008) = 0x00048032U-Boot 1.3.2 (Jan 12 2014 - 11:37:08)DRAM:  64 MBFlash: 512 kB*** Warning - bad CRC, using default environmentIn:    serialOut:   serialErr:   serialERROR: s3c2410x_io_write_word(0x1900030a) = 0x00000000SMDK2410 # bdinfoarch_number = 0x000000C1env_t       = 0x00000000boot_params = 0x30000100DRAM bank   = 0x00000000-> start    = 0x30000000-> size     = 0x04000000ethaddr     = 00:00:00:00:00:00ip_addr     = 10.0.0.110baudrate    = 115200 bpsSMDK2410 # 



    (4)调试u-boot


    a) 打开一个窗口, 输入skyeye -e u-boot -d;

    b) 再打开一个窗口, 输入gdb的相关调试命令即可。

realsil@hp-6531s:~/Desktop/exer/gdb-7.1/gdb$ ./gdb ../../u-boot-1.3.2/u-bootGNU gdb (GDB) 7.1Copyright (C) 2010 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.  Type "show copying"and "show warranty" for details.This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux".For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>...Reading symbols from /home/realsil/Desktop/exer/u-boot-1.3.2/u-boot...done.Setting up the environment for debugging gdb.Function "internal_error" not defined.Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]Function "info_command" not defined.Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]/home/realsil/Desktop/exer/gdb-7.1/gdb/.gdbinit:8: Error in sourced command file:No breakpoint number 0.(gdb) target remote :12345Remote debugging using :12345_start () at start.S:4242_start:b       start_code(gdb) b  board_initBreakpoint 1 at 0x33f909d4: file smdk2410.c, line 74.(gdb) cContinuing.Breakpoint 1, board_init () at smdk2410.c:7474clk_power->LOCKTIME = 0xFFFFFF;(gdb) bt#0  board_init () at smdk2410.c:74During symbol reading, incomplete CFI data; unspecified registers (e.g., r0) at 0x33f909d4.#1  0x33f805cc in start_armboot () at board.c:300#2  0x33f8009c in start_code () at start.S:178#3  0x33f8009c in start_code () at start.S:178Backtrace stopped: previous frame identical to this frame (corrupt stack?)(gdb) 

    如果大家身边没有一块真实的arm开发板,完全可以用skyeye来进行相关的调试工作,非常方便。   

   


3 0