赞
踩
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
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
安装 Mono 快结束时有个预编译的过程,这需要花费是十几分钟的时间。
参考:
sudo apt-get install policykit-1 libgtk2.0-0 screen uml-utilities gtk-sharp2 libc6-dev
打开下载页面 https://github.com/renode/renode/releases/latest ,下载 renode_1.7.1_amd64.deb
。
sudo dpkg -i renode_1.7.1_amd64.deb
命令行输入 renode 运行。
renode
运行之后,renode 会开启新的命令窗口用作renode 命令输入,原来的命令行窗口作为renode的日志输出窗口使用。
以下命令均在 renode 命令窗口输入。
创建机器,然后加载平台描述文件,这里是 STM32F4Discovery开发板的平台描述文件。
mach create
machine LoadPlatformDescription @platforms/boards/stm32f4_discovery-kit
.repl
输入 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>
机器创建好了以后,就可以用 LoadELF
命令加载程序了。
sysbus LoadELF @http://antmicro.com/projects/renode/stm32f4discovery.elf-s_445441-827a0dedd3790f4559d7518320006613768b5e72
输入 start
命令启动模拟器。
start
pause
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。