You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Petalinux JTAG启动MMU段转换故障排查求助

问题描述

在Petalinux项目中执行以下命令:

petalinux-boot --jtag --fpga --bitstream ../system.bit --u-boot

出现以下错误:

rlwrap: warning: your $TERM is 'xterm-256color' but rlwrap couldn't find it in the terminfo database. Expect some problems.: Inappropriate ioctl for device

Memory read error at 0xF8007080. MMU section translation fault 
    invoked from within
"::tcf::eval -progress {apply {{msg} {puts $msg}}} {tcf_send_command tcfchan#0 Memory get siiii {Bea{o{msg o{} A}}} {JTAG-jsn-DLC10-00001c72991001-4ba00477-0.0 4160778368 4 4 7}}"
    (procedure "::tcf::send_command" line 4)
    invoked from within
"::tcf::send_command $chan Memory get "siiii" "Bea{o{msg o{} A}}" [list $ctx $start_addr $size $nbytes $mode]"
    (procedure "mrd" line 87)
    invoked from within
"mrd 0xF8007080"
    (procedure "ps_version" line 2)
    invoked from within
"ps_version"
    (procedure "ps7_post_config" line 8)
    invoked from within
"ps7_post_config"
    (file "/tmp/tmp.8jPVijmAkY" line 12)
INFO: The XSDB log is as follows

执行petalinux-boot --jtag --kernel --hw_server-url tcp:127.0.0.1:3121时仍出现相同错误。

使用XSCT执行下载FSBL命令:

xsct% dow "../zynq_fsbl.elf" 

出现错误:

: Memory write error at0x0. MMU section translation fault. 

查阅Zynq 7000(AVNET板)文档得知:

The MMU might not find a global mapping or a mapping for the currently selected ASID with a matching non-secure TLB ID (NSTID) for the virtual address in the TLB. In this case, the hardware does a translation table walk if the translation table walk is enabled by the PD0 or PD1 bit in the TTB Control register. If translation table walks are disabled, the processor returns a section translation fault

询问:下载FSBL是否需要禁用MMU?如何排查该问题?


解答

关于FSBL与MMU的关系

FSBL本身会在初始化阶段自动配置MMU(建立必要的地址映射),正常情况下不需要手动禁用MMU。出现MMU段转换错误,说明硬件初始化或JTAG访问流程存在异常,导致CPU无法正确解析目标地址的映射。

排查步骤

1. 检查JTAG连接与硬件状态

  • 确认JTAG线缆连接牢固,目标板供电正常、处于可调试状态
  • 重启目标板和调试主机的hw_server,重新建立JTAG连接:
    # 关闭现有hw_server进程
    killall hw_server
    # 重新启动hw_server
    hw_server
    

2. 验证FPGA比特流加载正确性

  • 单独使用XSCT加载比特流,确认无错误:
    xsct% connect
    xsct% fpga ../system.bit
    xsct% after 1000 # 等待硬件初始化完成
    
  • 加载比特流后,执行PS初始化脚本确保核心状态正常:
    xsct% source <Petalinux安装路径>/components/plnx_workspace/hw_description/hw_platform_1/ps7_init.tcl
    xsct% ps7_init
    

3. 检查FSBL的编译配置

  • 确认FSBL是基于当前AVNET Zynq 7000平台的BSP编译生成,未修改过默认MMU初始化逻辑
  • 若自定义过FSBL代码,检查是否在MMU配置前就尝试访问未映射的地址;确保链接脚本中代码段、数据段映射到正确物理地址(如0x0或0xFFFF0000)

4. 手动禁用MMU调试(临时方案)

如果上述步骤无效,可尝试在XSCT中手动禁用MMU后再下载FSBL:

xsct% connect
xsct% fpga ../system.bit
xsct% after 1000
# 切换到ARM处理器调试目标
xsct% targets -set -filter {name =~ "*A9*"}
# 读取CP15的SCTLR寄存器(MMU控制寄存器)
xsct% mrc 15 0 0 0 0
# 清除第0位(MMU使能位),禁用MMU
xsct% mcr 15 0 0 0 0 [expr {<读取到的SCTLR值> & ~0x1}]
# 确认MMU已禁用
xsct% mrc 15 0 0 0 0
# 下载FSBL
xsct% dow ../zynq_fsbl.elf
# 启动FSBL
xsct% con

5. 检查硬件设计的地址映射

  • 打开Vivado工程,确认PS端外设地址分配、DDR控制器配置正确,无地址冲突
  • 检查是否启用了PS安全特性(如TrustZone),若启用需确保调试工具使用正确的安全上下文访问目标地址

6. 排查环境与工具版本问题

  • 确认Petalinux、Vivado、XSCT版本匹配(如统一使用2022.1系列工具),版本不兼容可能导致调试命令异常
  • 解决rlwrap警告:临时修改TERM环境变量
    export TERM=xterm
    

内容的提问来源于stack exchange,提问作者Creator

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.09 08:37:46