zoukankan      html  css  js  c++  java
  • 如何调试运行在qemu上的riscv版uboot?

    uboot有两个阶段,重定位之前和重定位之后,这两个阶段的符号表是不一样的,因此需关注是调试重定位之前的uboot还是重定位之后的uboot(以riscv版uboot为例)

    1. 调试重定位之前的uboot
        1.1 使用qemu启动uboot,并进入调试模式

        $ qemu-system-riscv64 -nographic -machine virt -m 512 -kernel <opensbi>/build/platform/qemu/virt/firmware/fw_jump.elf -device loader,file=<uboot>/u-boot.bin -s -S
        1.2 调试重定位之前的uboot
        $ riscv64-unknown-linux-gnu-gdb <uboot>/u-boot

            (gdb) target remote :1234
            (gdb) b board_init_f
            (gdb) c
    2. 调试重定位之后的uboot
        2.1 使用qemu启动uboot,并进入调试模式(同1.1)
        2.2 调试重定位之前的uboot    
        $ riscv64-unknown-elf-gdb(riscv64-unknown-linux-gnu-gdb) <uboot>/u-boot
        (gdb) target remote :1234
        //获取重定位之后uboot在内存中的地址
        (gdb) b relocate_code (relocate_code函数的参数指定了重定位之后的uboot地址)
        (gdb) c
        (gdb) info register a2
        0x8ff64000
        (gdb) b call_board_init_r
        (gdb) symbol-file (delete old symbols)
          Discard symbol table `~/u-boot` (y or n) y
      
        // 加载重定位之后的符号表
        (gdb) add-symbol-file <uboot>/u-boot 0x8ff64000
          add symbol table file from "~/u-boot" at
          .text_addr = 0x8ff64000
          (y or n) y
        (gdb) b board_init_r
        (gdb) c 

     


          

  • 相关阅读:
    XUartPs_SetFifoThreshold
    函数指针 与 指针函数 的 区别
    zynq SPI 参数配置
    20199118《网络攻防实践》第三周作业
    maven项目将第三方jar包打入自己的jar中
    springboot项目简单的实现操作多数据库源
    WebSocket简单的应用
    怎么使用bat脚本更改本地受保护的hosts文件
    Spring Boot配置ssl证书启用HTTPS协议
    控制animation暂停:animation-play-state
  • 原文地址:https://www.cnblogs.com/dakewei/p/12290074.html
Copyright © 2011-2022 走看看