Skip to main content

A pure Python ARM processor emulator

Project description

Description

A pure python ARM emulator

Installation

Install the last released version using pip:

python3 -m pip install --user -U armulator

Or install the latest version from sources:

git clone git@github.com:matan1008/armulator.git
cd pyiosbackup
python3 -m pip install --user -U -e .

Usage

To create a processor object, you need to import it first:

from armulator.armv6.arm_v6 import ArmV6

Then you can just create it:

arm = ArmV6()

Getting familiar with the Memory controller concept is crucial for using the processor.
In short, there is one "hub" to which you can connect several controllers.
A "Memory Controller" can be a stick of RAM, Memory mapped LCD screen or whatever you wish.

For example, let's create a RAM controller:

from armulator.armv6.memory_types import RAM
from armulator.armv6.memory_controller_hub import MemoryController

mem = RAM(0x100)
mc = MemoryController(mem, 0xF0000000, 0xF0000100)
arm.mem.memories.append(mc)

Now, trying to access a memory between 0xF0000000 and 0xF0000100, will access the mem object.
You can also change the memory manually:

mem.write(0, 2, "\xfe\xe7")

Another useful feature is playing with the memory protection or management unit, for example cancelling memory protection will look like:

arm.registers.sctlr.m = 0
arm.take_reset()

Please note that after changing internal features it is recommended to reset the processor.

When running the armulator, you will probably want to start from a defined address, so:

arm.registers.branch_to(0x100)

The last thing we need to do is to really run the processor, which can be done with:

arm.emulate_cycle()

Running the tests

Running the tests can be done easily with pytest:

python3 -m pytest tests -vv

Acknowledgments

  • At first, I did it to learn the ARM architecture better. I guess I was carried away.
  • Feel free to report bugs.
  • Feel free to ask for more features.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

armulator-1.1.2.tar.gz (122.8 kB view details)

Uploaded Source

Built Distribution

armulator-1.1.2-py3-none-any.whl (537.4 kB view details)

Uploaded Python 3

File details

Details for the file armulator-1.1.2.tar.gz.

File metadata

  • Download URL: armulator-1.1.2.tar.gz
  • Upload date:
  • Size: 122.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for armulator-1.1.2.tar.gz
Algorithm Hash digest
SHA256 7f087427a47282a4ab6e248844bc4a2277e8b953bf6604709448f378e6cf3b73
MD5 972f63c5fd0acfac9b3c0aba5deb1eba
BLAKE2b-256 1933e5d35c8da8f6cac179dbc426c28d7adbf3dee81b57a0482c28e5c2f77a85

See more details on using hashes here.

File details

Details for the file armulator-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: armulator-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 537.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for armulator-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a711a493ede4b4d1c0f90d060e6991f77d7f4d73425c0c4526c6ae776c3c05e2
MD5 3b3dd75677bb51c46c81e2638047ef65
BLAKE2b-256 7df3b9f5390ab89ba27fe9776ca08e7d6ab51d626b14f745d13d5595ed8fdde5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page