memorymap – Raw memory map access

The memorymap module allows you to read and write memory addresses in the address space seen from the processor running CircuitPython. It is usually the physical address space.

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Camera
  • Adafruit Feather ESP32 V2
  • Adafruit Feather ESP32-S2 Reverse TFT
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32-S3 Reverse TFT
  • Adafruit Feather ESP32-S3 TFT
  • Adafruit Feather ESP32S2
  • Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
  • Adafruit Feather ESP32S3 No PSRAM
  • Adafruit Feather HUZZAH32
  • Adafruit FunHouse
  • Adafruit MagTag
  • Adafruit Metro ESP32S2
  • Adafruit QT Py ESP32 PICO
  • Adafruit QT Py ESP32-S3 no psram
  • Adafruit QT Py ESP32S2
  • Artisense Reference Design RD00
  • BPI-Bit-S2
  • BPI-Leaf-S3
  • BPI-PicoW-S3
  • BastWiFi
  • Bee-Motion-S3
  • Bee-S3
  • CRCibernetica IdeaBoard
  • CrumpS2
  • Cytron Maker Feather AIoT S3
  • ESP 12k NodeMCU
  • ESP32 Devkit V1
  • ESP32-S2-DevKitC-1-N4
  • ESP32-S2-DevKitC-1-N4R2
  • ESP32-S2-DevKitC-1-N8R2
  • ESP32-S3-Box-2.5
  • ESP32-S3-Box-Lite
  • ESP32-S3-DevKitC-1-N32R8
  • ESP32-S3-DevKitC-1-N8
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-DevKitM-1-N8
  • ESP32-S3-EYE
  • ESP32-S3-USB-OTG-N8
  • Espressif ESP32-EYE
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • FeatherS3
  • Franzininho WIFI w/Wroom
  • Franzininho WIFI w/Wrover
  • Gravitech Cucumber M
  • Gravitech Cucumber MS
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • Hardkernel Odroid Go
  • HexKyS2
  • IoTs2
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • LOLIN S3 16MB Flash 8MB PSRAM
  • M5Stack Atom Echo
  • M5Stack Atom Lite
  • M5Stack Atom Matrix
  • M5Stack Atom U
  • M5Stack Core Basic
  • M5Stack Core Fire
  • M5Stack Stick C
  • MORPHEANS MorphESP-240
  • Maker badge by Czech maker
  • MicroDev microS2
  • MixGo CE
  • Neuron
  • Oak Dev Tech PixelWing ESP32S2
  • ProS3
  • S2Mini
  • S2Pico
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • TTGO T8 ESP32-S2-WROOM
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • TinyPICO
  • TinyPICO Nano
  • TinyS2
  • TinyS3
  • Waveshare ESP32-S2-Pico
  • Waveshare ESP32-S2-Pico-LCD
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom

class memorymap.AddressRange(*, start, length)

Presents a range of addresses as a bytearray.

The addresses may access memory or memory mapped peripherals.

Some address ranges may be protected by CircuitPython to prevent errors. An exception will be raised when constructing an AddressRange for an invalid or protected address.

Multiple AddressRanges may overlap. There is no “claiming” of addresses.

Example usage on ESP32-S2:

import memorymap
rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000)
rtc_slow_mem[0:3] = b"\xcc\x10\x00"

Constructs an address range starting at start and ending at start + length. An exception will be raised if any of the addresses are invalid or protected.

__bool__() bool
__len__() int

Return the length. This is used by (len)

__getitem__(index: slice) bytearray
__getitem__(index: int) int

Returns the value(s) at the given index.

1, 2, 4 and 8 byte aligned reads will be done in one transaction. All others may use multiple transactions.

__setitem__(index: slice, value: circuitpython_typing.ReadableBuffer) None
__setitem__(index: int, value: int) None

Set the value(s) at the given index.

1, 2, 4 and 8 byte aligned writes will be done in one transaction. All others may use multiple transactions.