当前位置:   article > 正文

四、在Xilinx FPGA上使用Cortex M1 软核——固化Cortex-M1程序_target.mmi

target.mmi

在Xilinx FPGA上使用Cortex M1 软核——固化Cortex-M1程序

本文的硬件(FPGA)工程和软件代码、脚本均参考ARM提供的例程。

本文使用的FPGA工程:

https://download.csdn.net/download/lai823177557/11580459
  • 1

本文使用的Keil工程:

https://download.csdn.net/download/lai823177557/11607865
  • 1

生成Memory Map Information(MMI)

MMI简介

MMI是融合CM1程序文件(.elf)和bit流文件时的说明文件。官方文档对MMI文件的介绍:
在这里插入图片描述
根据文档描述,每次生成新的bit流文件后都需要重新生成MMI文件。

生成脚本

ARM例程中提供了生成脚本,但是不能原封不动地用于之前建立的FPGA工程,故做了3处修改:

  • 生成文件的文件名(mmi_file 变量)
    改为自己喜欢的名字:cortex_m1.mmi
  • 目标器件(part 变量)
    改为开发板的器件型号:xc7z020clg484-1
  • AddressSpace名称(AddressSpace Name)
    将AddressSpace Name改为和工程匹配,名称来源:
    打开FPGA工程的RTL ANALYSIS,依次展开直到找到M1软核。展开软核知道找到u_x_itcm,选中它即可找到其完整名称。
    在这里插入图片描述
    以下是使用ARM例程中修改后的脚本:
# -----------------------------------------------------------------------------
#  The confidential and proprietary information contained in this file may
#  only be used by a person authorised under and to the extent permitted
#  by a subsisting licensing agreement from ARM limited.
#
#             (C) COPYRIGHT 2018 ARM limited.
#                 ALL RIGHTS RESERVED
#
#  This entire notice must be reproduced on all copies of this file
#  and copies of this file may only be made by a person if such person is
#  permitted to do so under the terms of a subsisting license agreement
#  from ARM limited.
#
#       SVN Information
#
#       Checked In          : $Date$
#
#       Revision            : $Revision$
#
#       Release Information : Cortex-M1 DesignStart-r0p1-00rel0
#
# -----------------------------------------------------------------------------
#  Project : Cortex-M1 Arty A7 Example design with V2C-DAPLink adaptor board
#
#  Purpose : Script to get ITCM BRAM locations
#            MMI format from following two articles
#
# https://www.xilinx.com/support/answers/63041.html
# https://forums.xilinx.com/t5/Vivado-TCL-Community/export-BRAM-locations-into-MMI-file/td-p/771221
# -----------------------------------------------------------------------------

# Set MMI output file name
set mmi_file "cortex_m1.mmi"
set part     "xc7z020clg484-1"

# Function to swap bits
proc swap_bits { bit } {

    if { $bit > 23 } {return [expr {24 + (31 - $bit)}]}
    if { $bit > 15 } {return [expr {16 + (23 - $bit)}]}
    if { $bit > 7  } {return [expr {8  + (15 - $bit)}]}
    return [expr {7 - $bit}]
}

# If run from batch file, will need to open project, then open the run
# open_run impl_1

# Find all the ITCM RAMs, place in a list
set itcm_ram [get_cells -hier -regexp {.*itcm.*ram_block_reg.*} -filter {REF_NAME =~ RAMB36E1}]

# Vivado appears to read the memories in their actual bit order
# However update_mem amongst its very many failings doesn't support endianness, even though you specify it in the file!
# It also pays no attention to the bit_lane definition, it does the conversion based on the order memories are defined
# in the file!  Not clear what the MMI file does achieve!

# So go through and reverse e
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/718625
推荐阅读
相关标签
  

闽ICP备14008679号