当前位置:   article > 正文

开源模拟器 Renode 初体验

开源模拟器

开源模拟器 Renode 初体验

Renode 是开源的模拟器,可以模拟 Cortex-M、RISC-V 等微控制器,不仅可以模拟 CPU指令,还可以模拟外设,甚至可以模拟板载的外设。官网:https://renode.io/ 。指令模拟器使用 C 语言编写,外设模拟器使用 C# 语言编写,兼顾了运行效率和开发效率。

https://blog.csdn.net/zoomdy/article/details/95445329
zoomdy at 163 dot com

环境:

$ uname -a
Linux vbox 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • 1
  • 2

安装

安装 Mono

sudo apt update
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-complete
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

安装 Mono 快结束时有个预编译的过程,这需要花费是十几分钟的时间。

参考:

安装其它依赖包

sudo apt-get install policykit-1 libgtk2.0-0 screen uml-utilities gtk-sharp2 libc6-dev
  • 1

下载 Renode

打开下载页面 https://github.com/renode/renode/releases/latest ,下载 renode_1.7.1_amd64.deb

安装 Renode

sudo dpkg -i renode_1.7.1_amd64.deb
  • 1

运行 Renode

命令行输入 renode 运行。

renode
  • 1

运行之后,renode 会开启新的命令窗口用作renode 命令输入,原来的命令行窗口作为renode的日志输出窗口使用。

创建 machine

以下命令均在 renode 命令窗口输入。

创建机器,然后加载平台描述文件,这里是 STM32F4Discovery开发板的平台描述文件。

mach create
machine LoadPlatformDescription @platforms/boards/stm32f4_discovery-kit
.repl 
  • 1
  • 2
  • 3

查看外设

输入 peripherals 命令查看外设。

(machine-0) peripherals 
Available peripherals:
  sysbus (SystemBus)
  │   
  ├── can0 (STMCAN)
  │     <0x40006400, 0x400067FF>
  │       
  ├── cpu (CortexM)
  │     Slot: 0
  │       
  ├── dma1 (STM32DMA)
  │     <0x40026000, 0x400263FF>
  │       
  ├── dma2 (STM32DMA)
  │     <0x40023400, 0x400237FF>
  │       
  ├── ethernet (SynopsysEthernetMAC)
  │   │ <0x40028000, 0x400293FF>
  │   │   
  │   ├── phy (EthernetPhysicalLayer)
  │   │     Address: 0
  │   │       
  │   └── phy1 (EthernetPhysicalLayer)
  │         Address: 1
  │           
  ├── exti (EXTI)
  │     <0x40013C00, 0x40013FFE>
  │       
  ├── flash (MappedMemory)
  │     <0x08000000, 0x081FFFFF>
  │       
  ├── fscmBank1 (MappedMemory)
  │     <0x60000000, 0x6FFFFFFF>
  │       
  ├── gpioPortA (STM32F4GPIOPort)
  │   │ <0x40020000, 0x400203FF>
  │   │   
  │   ├── UserButton (Button)
  │   │       
  │   ├── externalButton (Button)
  │   │       
  │   └── externalLed (LED)
  │           
  ├── gpioPortB (STM32F4GPIOPort)
  │     <0x40020400, 0x400207FF>
  │       
  ├── gpioPortC (STM32F4GPIOPort)
  │     <0x40020800, 0x40020BFF>
  │       
  ├── gpioPortD (STM32F4GPIOPort)
  │   │ <0x40020C00, 0x40020FFF>
  │   │   
  │   └── UserLED (LED)
  │           
  ├── gpioPortE (STM32F4GPIOPort)
  │     <0x40021000, 0x400213FF>
  │       
  ├── gpioPortF (STM32F4GPIOPort)
  │     <0x40021400, 0x400217FF>
  │       
  ├── nvic (NVIC)
  │     <0xE000E000, 0xE000EFFF>
  │       
  ├── rng (STM32F4_RNG)
  │     <0x50060800, 0x50060BFF>
  │       
  ├── rom (MappedMemory)
  │     <0x1FFF0000, 0x1FFFFFFF>
  │       
  ├── spi1 (STM32SPI)
  │     <0x40013000, 0x400133FF>
  │       
  ├── spi2 (STM32SPI)
  │     <0x40003800, 0x40003BFF>
  │       
  ├── spi3 (STM32SPI)
  │     <0x40003C00, 0x40003FFF>
  │       
  ├── sram (MappedMemory)
  │     <0x20000000, 0x2003FFFF>
  │       
  ├── uart1 (STM32_UART)
  │     <0x40011000, 0x400110FF>
  │       
  ├── uart2 (STM32_UART)
  │     <0x40004400, 0x400044FF>
  │       
  ├── uart3 (STM32_UART)
  │     <0x40004800, 0x400048FF>
  │       
  ├── uart4 (STM32_UART)
  │     <0x40004C00, 0x40004CFF>
  │       
  └── uart5 (STM32_UART)
        <0x40005000, 0x400050FF>
  • 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
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95

加载程序

机器创建好了以后,就可以用 LoadELF 命令加载程序了。

sysbus LoadELF @http://antmicro.com/projects/renode/stm32f4discovery.elf-s_445441-827a0dedd3790f4559d7518320006613768b5e72
  • 1

启动模拟器

输入 start 命令启动模拟器。

start
  • 1

暂停模拟

pause
  • 1

参考

官方帮助文件:https://renode.readthedocs.io/en/latest/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/853700
推荐阅读
相关标签
  

闽ICP备14008679号