Skip to content

A simple armv4 emulator with embedded freertos and linux operating system support, Demo:

License

Notifications You must be signed in to change notification settings

hxdyxd/arm_emulator

Repository files navigation

arm_emulator

C/C++ CI

Introduction

Simple armv4 emulator with embedded freertos and linux operating system support

Currently supported features

  • All ARMv4 instructions
  • Interrupts (timer interrupt, 8250 serial interrupts)
  • Prefetch Abort, Data Abort, Undefined instruction, IRQ ,FIQ exceptions
  • CP15 coprocessor, Memory Management Unit(MMU) and Translation Lookaside Buffer(TLB)
  • Network support via serial port
  • Console support via serial port
  • Step by step running
  • Disassembler

Memory Mapping

Module Address Size (byte)
RAM 0x0000 0000---0x01FF FFFF 32M
INTC 0x4001 f040---0x4001 F047 8
Timer 0x4001 f020---0x4001 f027 8
UART0 0x4002 0000---0x4002 00FF 256
UART1_SLIP 0x4002 0100---0x4002 01FF 256
ROMFS 0x8000 0000---0x9FFF FFFF 512M

Dependency

dependency

Other codes

Usage Example

Run 'hello.bin' by step by step mode

armemulator -ds -m bin -f hello.bin

Show assembly code of 'hello.bin'

armemulator -m disassembly -f hello.bin

Run linux kernel

armemulator -m linux -f zImage -r rootfs.ext2
armemulator -m linux -f Image -t arm-emulator.dtb -r rootfs.ext2

Forward a host port to guest port

armemulator -m linux -f zImage -r rootfs.ext2 -n user,tcp::2222-:22
armemulator -m linux -f zImage -r rootfs.ext2 -n user,[tcp|udp]:[host_addr]:[host_port]-[guest_addr]:[guest_port],[...]

Usage

./armemulator

  usage:

  armemulator
       -m <mode>                  Select 'linux', 'bin' or 'disassembly' mode, default is 'bin'.
       -f <image_path>            Set image or binary programme file path.
       [-r <romfs_path>]          Set ROM filesystem path.
       [-t <device_tree_path>]    Set Devices tree path.
       [-n <net_mode>]            Select 'user' or 'tun' network mode, default is 'user'.
       [-d]                       Display debug message.
       [-s]                       Step by step mode.

       [-v]                       Verbose mode.
       [-h, --help]               Print this message.

  Build , [time]
  Reference: https://github.com/hxdyxd/arm_emulator

Step by step mode command:

  usage:

  armemulator
       m                Print MMU page table
       r [n]            Run skip n step
       d                Set/Clear debug message flag
       l                Print TLB table
       g                Print register table
       s                Set step by step flag, press ctrl+b to clear
       p[p|v] [a]       Print physical/virtual address at 0x[a]
       t                Print run time
       h                Print this message
       q                Quit program

  Build , [time]

Build armemulator

sudo apt-get install pkg-config libglib2.0-dev
git clone --recursive https://github.com/hxdyxd/arm_emulator.git
make
sudo make install

Build linux zImage with buildroot

sudo apt-get install libncurses-dev flex bison bc gcc g++
sudo apt-get install unzip rsync python3 texinfo
git clone https://github.com/hxdyxd/buildroot
cd buildroot
make armemulator_defconfig
make menuconfig
make
ls output/images/

Reference

About

A simple armv4 emulator with embedded freertos and linux operating system support, Demo:

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages