首页 > 其他分享 >zynqMP调试笔记(包含如何调试U-BOOT)

zynqMP调试笔记(包含如何调试U-BOOT)

时间:2023-05-11 16:55:20浏览次数:25  
标签:zynqMP kunyi02 -- BOOT boot vitis xilinx petalinux 调试

创建工程:
kunyi02@kunyi02-PC:~/alinx/4ev-p/shao-Alps$ petalinux-create -t project -n petalinux --template zynqMP

配置工程:
xsa文件由硬件提供
kunyi02@kunyi02-PC:~/alinx/4ev-p/shao-Alps/petalinux$ petalinux-config --get-hw-description ../hardware/design_1_wrapper.xsa

uboot device tree config:
xilinx_zynqmp_virt_defconfig
⇒zynqmp-zcu100-revC.dts
qemu:
INFO: Sourcing build tools
ERROR: Failed to boot. Image file '/home/kunyi02/alinx/4ev-p/shao-Alps/petalinux/pre-built/linux/images/pmu_rom_qemu_sha3.elf' doesn't exist.
pmu_rom_qemu_sha3.elf需要手动拷贝(官网下载一个zynqmp的bsp包)
petalinux-boot --qemu --u-boot
petalinux-boot --qemu --kernel

编译内核:
①xilinx linux5.15.36 ----> rt-linux5.15.36
# 检查patch是否可用
kunyi02@kunyi02-PC:~/alinx/4ev-p/shao-Alps/linux-xlnx-xlnx_rebase_v5.15_LTS$ git apply --check patch-5.15.36-rt41.patch
# 内核打上patch
kunyi02@kunyi02-PC:~/alinx/4ev-p/shao-Alps/linux-xlnx-xlnx_rebase_v5.15_LTS$ git apply patch-5.15.36-rt41.patch
(虽然可以直接打上,但是某些xilinx的驱动程序还未确定是否需要改动)

②生成Image
export ARCH=arm
export CROSS_COMPILE=aarch64-linux-gnu-
make xilinx_zynqmp_defconfig
make all -j4(小于CPU的最大线程数)
⇒ arch/arm64/boot/Image

do_shared_workdir 稍微调查一下这个函数

https://support.xilinx.com/s/article/65467?language=en_US


打包boot.bin(包含fsbl )
~/alinx/4ev-p/shao-Alps/HILIOHUB/petalinux/images/linux$ petalinux-package --boot --u-boot --fsbl --force

BOOT.BIN烧写失败:
===== mrd->addr=0xFF5E0204, data=0x00000000 =====

BOOT_MODE REG = 0x0000

Downloading FSBL...

Running FSBL...

Finished running FSBL.

Problem in running uboot

Flash programming initialization failed.

ERROR: Flash Operation Failed
推测是petalinux生成的fsbl有问题,尝试用vitis生成的fsbl可以成功烧录:
①利用xsa文件创建vitis工程
②利用vitis工程中的fslb + linux生成的BOOT.BIN 烧写
还未验证启动,因为串口没有连出来

使用vitis的xsct加载uboot
tcl脚本:https://blog.csdn.net/aatu/article/details/121529283
connect
targets
targets -set -filter {name =~ "PSU"}
mwr 0xffca0038 0x1ff
targets

targets -set -filter {name =~ "MicroBlaze PMU"}
targets
dow /home/kunyi/vitis_P/u-boot/pmufw.elf
con

targets -set -filter {name =~ "Cortex-A53 #0"}
rst -processor
dow /home/kunyi/vitis_P/u-boot/zynqmp_fsbl.elf
con
stop

dow /home/kunyi/vitis_P/u-boot/bl31.elf
con
stop

dow -data /home/kunyi/vitis_P/u-boot/system.dtb 0x100000
dow /home/kunyi/vitis_P/u-boot/u-boot.elf
stop

反汇编(用于后续调式时查看汇编与函数的对应关系):
aarch64-linux-gnu-objdump -d u-boot > u-boot.asm

更换PetaLinux工程的HDF/XSA文件后,PetaLinux工程编译出现FSBL do_configureh错误。
使用命令“petalinux-build -x mrproper -f ”,彻底清除工程,再编译工程,不再有问题。


调试:
https://blog.csdn.net/hitxiaohongming/article/details/96374814
https://support.xilinx.com/s/article/76616?language=zh_CN
https://www.xilinx.com/htmldocs/xilinx2018_1/SDK_Doc/xsct/breakpoints/reference_breakpoints_bpadd.html

解决qemu安装失败问题(ubuntu20.04)
https://support.xilinx.com/s/article/2021-1-PetaLinux?language=en_US

DEBUG时的注意点:
1. 执行自己编写的tcl脚本(参照上面)
⇒自动将uboot.elf加载到IOHUB上
2. relocate之前添加断点
⇒bpadd board_init_f(在u-boot relocate之前可以利用函数名添加断点)
3.relocate地址查看
⇒bpadd setup_reloc
⇒通过vitis查看gd->relocaddr 0x000000007fdbb000为relocate之后的u-boot地址
4. relocate之后添加断点
⇒bpadd -addr 0x7fdd7214 (在u-boot relocate之后不能利用函数名添加断点,因为U-boot在内存上的地址改变了)
# ⇒ memmap -file /home/kunyi/vitis_P/u-boot/u-boot.elf -reloc 0x7fdbb000 (没有成功https://support.xilinx.com/s/article/1151076?language=en_US)

断点计算:
relocate之前:0x0000000008000000
relocate之后:0x000000007fdbb000
根据relocate之后运行的地址 计算差值 去u-boot.asm中去对比执行到哪里:
0x7fdd9fd0 - 0x7fdbb000 1efd0 000000000801efd0 <board_init_r>
0x7fdd7214 - 0x7fdbb000 1C214 000000000801c210 <main_loop>
0x7fdd97cc - 0x7fdbb000 1e7cc 000000000801e7cc <autoboot_command>

bpadd board_init_f
bpadd -addr 0x7fdd7214
bpadd -addr 0x7fdd97cc
bpadd -addr 0x7fdd9fd0

标签:zynqMP,kunyi02,--,BOOT,boot,vitis,xilinx,petalinux,调试
From: https://www.cnblogs.com/aodong/p/17391582.html

相关文章

  • stm32 boot0硬件接法导致的概率性启动失败问题总结和反思
    概要 问题概要,板子在稳压电源上工作很好,可一旦接了电池,stm32就会出现概率性的无法启动。加上项目比较急,这个问题阻塞一直无法量产。真是非常的要命啊。 思路分析 既然是不同的电源会导致这个问题,第一步就是分析电源的毛刺,通过示波器查看,发现稳压电源的电压是逐渐上升的,而电......
  • SpringBoot中@ControllerAdvice/@RestControlAdvice+@ExceptionHandler实现全局异常捕
    场景在编写Controller接口时,为避免接口因为未知的异常导致返回不友好的结果和提示。如果不进行全局异常捕获则需要对每个接口进行try-catch或其他操作。 可以对Controller进行全局的异常捕获和处理,一旦发生异常,则返回通用的500响应码与通用错误提示。并将异常发生的具体的......
  • 真机调试可以正常安装,但是不能正常运行,出现错误:couldn‘t find “libc++_shared.so“
    在迁移代码的时候,发现代码可以在模拟器上运行,但是无法在真机上面运行,最后经过挨个的排查,最终发现是ndk的问题。在app的build.gradle中的ndk缺少了匹配的实体机类型,然后加了一下'x86','armeabi-v7a','armeabi','armabi-v7a','x86_64','arm64-v8a','mips','mips64......
  • springboot跨域问题解决方案
    以下内容仅供自己学习使用,侵权私聊必删。在进行前后端交互的时候,往往会遇到以下的跨域问题。那么解决这种跨域的话,可以使用以下这种方法:(引自于程序员青戈)创建config配置目录新建CorsConfig类然后把下面的内容复制进去根据自己需要修改以下就可以解决跨域问题啦importo......
  • SpringBoot整合规则引擎Drools
    目录1整合规则引擎Drools1.1前言1.2pom.xml1.3Drools配置类1.4示例Demo1.4.1添加业务Model1.4.2定义drools规则1.4.3添加Service层1.4.4添加Controller1.4.5测试1.5drools规则解析1.5.1简介1.5.2规则体语法结构1.5.3注释1.5.4Pattern模式匹配1.5.5比较操作符1.5.......
  • springboot集成springSwagger生成接口文档
    1.首先引入pom.xml依赖<!--SwaggerAPI文档--><dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version><exclusions><exclus......
  • java基于springboot+vue的房屋租赁租房系统、租房管理系统,附源码+数据库,免费包运行,适
    1、项目介绍java基于springboot+vue的房屋租赁租房系统、租房管理系统,分为管理员和用户。用户的功能有:登录、注册、房屋信息、交流论坛、房屋咨询、在线客服、个人中心、我的收藏、我的发布、预约看房管理、在线签约管理、租赁评价管理、管理员的功能有:登录、个人中心、用户管......
  • SpringBoot上传图片到resource下
    推荐博客:https://blog.csdn.net/weixin_52065369/article/details/120412307这样上传到resource下的图片需要重启编译后才能访问,需要配置以下才能访问的到,通常不采用这样的方式https://blog.csdn.net/qq_41604890/article/details/114553632上传图片到本机......
  • 【Azure 媒体服务】Media Service的编码示例 -- 创建缩略图子画面的.NET代码调试问题
    问题描述在中国区Azure上,使用MediaService服务,想要使用.NET的代码来对上传视频创建缩略图(Thumbnail)。通过官网文档(https://docs.azure.cn/zh-cn/media-services/latest/samples/samples-encoding-reference#create-a-thumbnail-sprite)下载.NET示例,配置appsettings.json......
  • springboot自动装配过程
    一、首先要知道springboot的启动类然后知道启动类有一个重要的注解:@SpringBootApplication然后跟踪查看,它是由@SpringBootConfiguration、@EnableAutoConfiguration、@ComponentScan注解组成的@SpringBootConfiguration作用是声明当前类是一个组件@ComponentScan作用是扫描启......