Skip to main content

Python DevMem

This is designed primarily for use with accessing /dev/mem on OMAP platforms. It should work on other platforms and work to mmap() files rather then just /dev/mem, but these use cases aren't well tested.

All file accesses are aligned to DevMem.word bytes, which is 4 bytes on ARM platforms to avoid data abort faults when accessing peripheral registers.

Usage

Usage: devmem.py [options]

Options:
  -h, --help            show this help message and exit
  -r ADDR, --read=ADDR  read a value
  -w ADDR VALUE, --write=ADDR VALUE
						write a value
  -n NUM, --num=NUM     number of words to read
  -s WORD_SIZE, --word-size=WORD_SIZE
						size of word when displayed
  -m FILE, --mmap=FILE  file to open with mmap()
  -v                    provide more information regarding operation
  -d                    provide debugging information

Speed

Initial testing on a BeagleBoard-xM (Cortex-A8 in a TI DM3730) shows that starting up the python interpreter is pretty slow:

# time (echo | python)

real    0m0.859s
user    0m0.750s
sys     0m0.102s

# time python ./pydevmem.py -r 0x4830a204 -n 8
0x4830a204:   1b89102f  00000000  00000000  000000f0
0x4830a214:   cafeb891  0c030016  015739eb  1ff00000

real    0m1.109s
user    0m0.977s
sys     0m0.133s

# time python -S ./pydevmem.py -r 0x4830a204 -n 8
0x4830a204:   1b89102f  00000000  00000000  000000f0
0x4830a214:   cafeb891  0c030016  015739eb  1ff00000

real    0m0.659s
user    0m0.602s
sys     0m0.047s

# time python -S ./pydevmem.pyc -r 0x4830a204 -n 8
0x4830a204:   1b89102f  00000000  00000000  000000f0
0x4830a214:   cafeb891  0c030016  015739eb  1ff00000

real    0m0.647s
user    0m0.508s
sys     0m0.133s

System information for those tests:

Linux omap 3.0.6-x3 #1 SMP Wed Oct 5 07:19:24 UTC 2011 armv7l GNU/Linux

python              2.7.2-7ubuntu2
python-configobj    4.7.2+ds-3
python-minimal      2.7.2-7ubuntu2
python2.7           2.7.2-5ubuntu1
python2.7-minimal   2.7.2-5ubuntu1

Something needs to be sped up to make python start-up in a reasonable amount of time.

Metadata

Release files for devmem 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devmem 0.1.0
File Size Uploaded
devmem-0.1.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for devmem 0.1.0
File Interpreter ABI Platform
devmem-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / devmem-0.1.0.tar.gz

Download URL devmem-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2e17f2fd3bb43fb811f4a3ae6a0869cac310f18081f5f00d56098a6e97affc49
BLAKE2b-256 checksum
How to use checksums
c09a29cecea6d6e22020a94a49a493693f2872586cabc66070d62adc38f2f490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release files / devmem-0.1.0-py3-none-any.whl

Download URL devmem-0.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27821c7fb5ab84ed1e3f2807eae061534c3cf9500888378583a2befb75b7e219
BLAKE2b-256 checksum
How to use checksums
77607eb6616f462c7286a056478fce5ff43eb05e902fba38cc8a714e975c50c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page