• Rocket


    https://mp.weixin.qq.com/s/7suuJ7m2BKCpsHk1K2FzJQ

     

    介绍riscv-debug的使用实例:如何使用DMI。

     

    1. dm

     

    Debug Module实现了调试模块。

     

    2. dmi

     

    Debug Module Interface是对Debug Module的访问接口。

     

    3. DTM

     

    dmi包含在DTM中。DTM是硬件接口相关的,可以是JTAG DTM,也可以是USB DTM。

     

    4. JTAG DTM Registers

     

    1) 支持的寄存器列表

     

    a. 这里的address实际上是要存入IR中的指令编码;

    b. 而这些寄存器则是数据寄存器(Data Register);

    c. 使用存入IR中的指令编码来选择相应的数据寄存器(Data Register):

     

    2) dmi Register

     

    实现调试模块(Debug Module)访问的核心寄存器,用以实现对调试模块中各个寄存器的读写:

     

    至于dmi寄存器自身,则通过JTAG接口进行访问:

    a. 在IR中填入0x11,选择dmi数据寄存器;

    b. In Update-DR, the DTM starts the operation specified in op unless the current status reported in op is sticky.

    c. In Capture-DR, the DTM updates data with the result from that operation, updating op if the current op isn't sticky.

     

    3) dmcs Register

     

    用于对DTM进行控制以及获取状态:

     

    5. 实例1:To read an arbitrary Debug Module register

     

    A. scan 0x11 into IR,选择dmi数据寄存器;

     

    B. 通过JTAG TDI引脚scan in a proper value for dmi数据寄存器:

    a. with op set to 1,

    b. and address set to the desired register address;

     

    C. 在Update-DR状态,读操作开始执行;

     

    Update-DR状态是把(可能是串行扫描入的)数据寄存器的值并行输出。这里就是把dmi寄存器的值并出到调试模块(Debug Module),进而促使调试模块开始执行dmi中指定的操作。

     

    D. 在Capture-DR状态,读dmi寄存器的data域,获取返回的目标寄存器中的数据;

     

    Capture-DR状态是把数据并行存入数据寄存器中,这里就是把调试模块返回的数据并行存入到dmi寄存器中。

     

    E. 返回的不只有dmi.data,还有dmi.op,根据op是否为0来确认返回的数据是否合法。

     

    F. 如果返回的数据不合法,则需要更新IR,选择dmcs数据寄存器,将dmireset写1清除op,方便下次再次在Capture-DR状态读取dmi寄存器,获取调试模块返回的目标寄存器的数据;

     

    G. 如此循环,并根据此次访问的经验,来确定下一次在操作开始到返回数据之间应该等多长时间。

     

    6. 实例2:To write an arbitrary Debug Bus register

     

    A. scan 0x11 into IR,选择dmi数据寄存器;

     

    B. 通过JTAG TDI引脚scan in a proper value for dmi数据寄存器:

    a. with op set to 2,

    b. and address and data set to the desired register address and data respectively;

     

    C. 接下来的操作与读寄存器一样;

     

    7. almost never scan IR?

     

    这里说几乎不需要扫描IR,言过其实。因为要不停的扫描IR切换dmi和dmcs数据寄存器,读取数据、确定数据是否合法。

     

    如果等待的时间合适,刚好在Capture-DR状态返回的op=0,那么就不需要切换。也就不需要更改IR的值。所以这个“almost never”应该是指最开始学习等待时间时需要使用,而后可能都不需要了。

     

  • 相关阅读:
    os.path.basename()和os.path.splitext()
    关于pytorch中@和*的用处
    Python | os.path.join() method
    SURF (Speeded Up Robust Features,加速稳健特征)
    Canny算子
    医学影像中常见名词解释
    sigmod、tanh、ReLU激活函数的实现
    plt.gca()坐标轴移动
    损失函数和梯度下降解释
    torch和numpy的相互转换
  • 原文地址:https://www.cnblogs.com/wjcdx/p/12015979.html
Copyright © 2020-2023  润新知