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.

Download files

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

Source Distribution

devmem-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devmem-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file devmem-0.1.0.tar.gz.

File metadata

  • Download URL: devmem-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for devmem-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2e17f2fd3bb43fb811f4a3ae6a0869cac310f18081f5f00d56098a6e97affc49
MD5 92103728aefa5f7ff392eb5b86e555ee
BLAKE2b-256 c09a29cecea6d6e22020a94a49a493693f2872586cabc66070d62adc38f2f490

See more details on using hashes here.

File details

Details for the file devmem-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: devmem-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for devmem-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27821c7fb5ab84ed1e3f2807eae061534c3cf9500888378583a2befb75b7e219
MD5 ee4c4239f057165296b96be528b8c90a
BLAKE2b-256 77607eb6616f462c7286a056478fce5ff43eb05e902fba38cc8a714e975c50c6

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page