从skyeye学习arm( u-boot篇)

2019-07-13 05:43发布


【 声明:版权所有,欢迎转载,请勿用于商业用途。  联系信箱:feixiaoxing @163.com】
    有了上面的skyeye环境,我们可以自己在上面进行测试和学习了。很多学习嵌入式linux的朋友都会涉及到u-boot的移植问题。但是u-boot调试是非常困难的,你能用到的方法不是点灯就是打印。但是有了skyeye之后,完全可以帮我们进行源码级别的调试。要进行u-boot调试,最主要的就是配置一个skyeye 文件和 编译u-boot。
   (1)配置skyeye.conf文件
cpu: arm920t mach: s3c2410x #physical memory #mem_bank: map=M, type=RW, addr=0x20000000, size=0x01000000 mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000 mem_bank: map=M, type=RW, addr=0x30000000, size=0x10000000 mem_bank: map=M, type=RW, addr=0xc0000000, size=0x01000000 mem_bank: map=M, type=RW, addr=0xc1000000, size=0x00600000 mem_bank: map=M, type=RW, addr=0xc1600000, size=0x00a00000 #all peripherals I/O mapping area #mem_bank: map=I, type=RW, addr=0xfefa0000, size=0x00060000 mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000 mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020 net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1 lcd: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: arm cpu info: armv4, arm920t, 41009200, ff00fff0, 2 mach info: name s3c2410x, mach_init addr 0x806dc30 ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1 failed to setup_module (name:net, type:cs8900a) tapif_init: icotl TUNSETIFF erroruart_mod:0, desc_in:, desc_out:, converter: SKYEYE: use arm920t mmu ops start addr is set to 0x33f80000 by exec file. ERROR: s3c2410x_io_write_word(0x4c000000) = 0x00ffffff ERROR: s3c2410x_io_write_word(0x4c000008) = 0x00048032 U-Boot 1.3.2 (Jan 12 2014 - 11:37:08) DRAM: 64 MB Flash: 512 kB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial ERROR: s3c2410x_io_write_word(0x1900030a) = 0x00000000 SMDK2410 # bdinfo arch_number = 0x000000C1 env_t = 0x00000000 boot_params = 0x30000100 DRAM bank = 0x00000000 -> start = 0x30000000 -> size = 0x04000000 ethaddr = 00:00:00:00:00:00 ip_addr = 10.0.0.110 baudrate = 115200 bps SMDK2410 #

    (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-boot GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later 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: ... 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 :12345 Remote debugging using :12345 _start () at start.S:42 42 _start: b start_code (gdb) b board_init Breakpoint 1 at 0x33f909d4: file smdk2410.c, line 74. (gdb) c Continuing. Breakpoint 1, board_init () at smdk2410.c:74 74 clk_power->LOCKTIME = 0xFFFFFF; (gdb) bt #0 board_init () at smdk2410.c:74 During 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:178 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)
    如果大家身边没有一块真实的arm开发板,完全可以用skyeye来进行相关的调试工作,非常方便。