使用CMSDK生成基于Cortex-M4的总线结构


前言


下面内容可供参考,如有错误请指正。

1 总线有关

1.1 AHb有关概念

Cortex-M系统设计工具包为示例系统提供了为低功耗和低延迟设计而设计的AHB和APB组件。
首先,是总线的架构。

AHB:Advanced High-performance Bus,用于高性能、高时钟工作频率模块。
ASB:Advanced System Bus,用于高性能系统模块。
APB:Advanced Peripheral Bus,用于慢速外设模块。
AMBA AHB是一种总线接口,适用于高性能的可综合设计。它定义了接口,between components, such as masters, interconnects, and slaves.
最常见的AHB从机是内部存储器设备、外部存储器接口和高带宽外围设备。尽管低带宽外设可以作为AHB从设备包括在内,但由于系统性能原因,它们通常驻留在AMBA高级外设总线(APB)上。更高性能的AHB和APB之间的桥接是使用AHB slaves完成的,称为APB桥。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

1.2 需要用到的部分部件

Basic AHB components 列出来default slave,example AHB slave。
APB components 列出来 deal-input timers。
Advanced AHB components 列出来 Bus matrix。(当然还需要了解AHB to APB asynchronous bridge,AHB to AHB synchronous bridge,AHB to AHB sync-down bridg,AHB to AHB sync-up bridge。)
对于没有贴出来的不同components的需要可以参考trm进行选择。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

1.3关于remap

接下来提到address remap。
The address map is explained at the remap state REMAP = 0001 as follows:
• Normally, the address map, MI0, appears at two non-contiguous regions, 0x40000000 and
0x70000000. When you set remap bit to 0, 0x40000000 region is removed because the
remapping parameter is set to move and MI0 appears at the new remap region 0x00000000
to 0x1FFFFFFF. The MI0 region at 0x70000000 is not removed because its remapping
parameter is declared as alias.
• When you set remap bit to 0, MI1 appears at the new remap region, 0x50000000 to
0x5FFFFFFF. The 0x80000000 region did not change because its remapping is set to none.
• MI2 did not change even though its remapping is declared as move, because it is associated
with remap bit one. Remap bit one is not set at the current remap state.
• MI3 is moved to a new base address 0xC0000000.
You can consider MI0 as ROM and MI3 as RAM. At boot time, the REMAP signal is set to
0001 and you can observe ROM at base address 0x00000000. After booting, the REMAP signal
is set to 0000, the RAM now appears at 0x00000000, and the ROM is moved up in the address
space to 0x40000000.
在这里插入图片描述
在这里插入图片描述

2 实现示例

2.1 步骤总结

到此为止,基础的知识基本就是够了。可以生成总线, 主要有接下来的几步,详细可参考2.2。
1、设计具体的总线矩阵映射关系
2、修改XML文件(需要注意对于bus matrix来说 slave和master不要颠倒)
3、修改makefile文件
4、通过WSL执行make
5、设计完成 在目录下查看是否成功。
接下来,按照整体步骤逐一进行即可。

2.2 详细步骤

利用spinnaker的system AHB address map修改XML文件
spinnaker system address map
关于WSL(Windows Subsystem for Linux),是一个在Windows 10上能够运行原生Linux二进制可执行文件(ELF格式)的兼容层。由于Linux系统比较麻烦,所以就用WSL完成接下来的工作内容。

这里贴出来修改后的XML代码
代码如下(部分地址映射):

<?xml version="1.0" encoding="iso-8859-1" ?>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
<!-- 7:purpose is defining an interconnext for 1 master and 4 slaves (AHB)   -->
<cfgfile>

  <!-- - - - - *** DO NOT MODIFY ABOVE THIS LINE *** - - - - - - - - - - -  -->

  <!-- Global definitions -->

  <architecture_version>ahb2</architecture_version>
  <arbitration_scheme>fixed</arbitration_scheme>
  <routing_data_width>32</routing_data_width>
  <routing_address_width>32</routing_address_width>
  <user_signal_width>32</user_signal_width>
  <bus_matrix_name>cmsdk_meiqi2Matrix</bus_matrix_name>
  <input_stage_name>cmsdk_MyInputName</input_stage_name>
  <matrix_decode_name>cmsdk_MyDecoderName</matrix_decode_name>
  <output_arbiter_name>cmsdk_MyArbiterName</output_arbiter_name>
  <output_stage_name>cmsdk_MyOutputName</output_stage_name>

<!-- 7:for natrix: mater interface to AHB slaves,such as RAM -->

  <!-- Slave interface definitions -->
  <!-- 7:just 1 slave interface (Cortex-M4)-->
  
  <!-- Slave S0 Cortex-M4 -->
  <slave_interface name="S0">
  <sparse_connect interface="M0"/>
  <sparse_connect interface="M1"/>
  <sparse_connect interface="M2"/>
  <sparse_connect interface="M3"/>
  <address_region interface="M0" mem_lo="10000000" mem_hi='10ffffff' remapping='none'/>
  <address_region interface="M1" mem_lo="11000000" mem_hi='1effffff' remapping='none'/>
  <address_region interface="M2" mem_lo="30000000" mem_hi='3fffffff' remapping='none'/>
  <address_region interface="M3" mem_lo="00000000" mem_hi='007fffff' remapping='none'/>
  
  
  </slave_interface>

  <!-- Master interface definitions -->
  <!-- master M0 CC -->
  <!-- master M1 Timer -->
  <!-- master M2 DMA -->
  <!-- master M3 flash -->
  <master_interface name="M0"/>
  <master_interface name="M1"/>
  <master_interface name="M2"/>
  <master_interface name="M3"/>
 
</cfgfile>

修改完成正确的XML文件执行完成如下图所示
修改xml之后
makefile代码如下

all:
  sudo bin/BuildBusMatrix.pl -xmldir xml -cfg example1x4_sparse.xml -over -verbose

可以看到生成的.v文件如下图
生成bus matrix文件
最后,可以添加Bus Matrix到整个工程中,连接Cortex-M4作为AHB唯一的master,CC、DMA、dual timer和default slave作为AHB slave。
至此,完成利用CMSDK搭建基于CortexM4的SoC。

Notes:在实现的时候,注意对于matrix来说,slave interface是连CPU的,master interface是连外设啊ram啊什么的。下图是一个错误的实例。
错误示例(代码地址映射颠倒)


总结

例如:本文简单介绍利用CSMK生成bus matrix的有关步骤,没有提及的部分或错误地方,先感谢指正。
  • 5
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值