coproc – COPROC Module

The coproc module adds ability to load and run programs on a co-processor or a different cpu core.

import coproc

shared_mem = coproc.CoprocMemory(address=0x500007fc, length=1024)

with open("program.bin", "rb") as f:
    program = coproc.Coproc(, memory=shared_mem)
# coproc.halt(program)

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Camera
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32-S3 TFT
  • Adafruit Feather ESP32S2
  • Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM
  • Adafruit Feather ESP32S3 No PSRAM
  • Adafruit FunHouse
  • Adafruit MagTag
  • Adafruit Metro ESP32S2
  • 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
  • CrumpS2
  • Cytron Maker Feather AIoT S3
  • ESP 12k NodeMCU
  • 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-N8
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-DevKitM-1-N8
  • ESP32-S3-EYE
  • ESP32-S3-USB-OTG-N8
  • Feather ESP32S2 without PSRAM
  • 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
  • HexKyS2
  • IoTs2
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • LOLIN S3 16MB Flash 8MB PSRAM
  • MORPHEANS MorphESP-240
  • Maker badge by Czech maker
  • MicroDev microS2
  • MixGo CE
  • Oak Dev Tech PixelWing ESP32S2
  • ProS3
  • S2Mini
  • S2Pico
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • TinyS2
  • TinyS3
  • Waveshare ESP32-S2-Pico
  • Waveshare ESP32-S2-Pico-LCD
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom*coproc: Coproc) None

Runs the loaded program.

coproc.halt(*coproc: Coproc) None

Halts the loaded program.

coproc.memory(*coproc: Coproc) CoprocMemory

Returns the shared memory as a bytearray.

class coproc.Coproc(buffer: circuitpython_typing.ReadableBuffer, memory: CoprocMemory)

Loads the program binary into memory.

  • buffer – The program binary to run on the core/co-processor

  • memory – The CoprocMemory object used to access shared memory

deinit() None

Releases control of the underlying hardware so other classes can use it.

__enter__() Coproc

No-op used in Context Managers.

__exit__() None

Close the request.

class coproc.CoprocMemory(address: int, length: int)

Initialize coproc shared memory.

  • address – address of shared memory

  • length – length of shared memory

__bool__() bool

coproc_memory is True if its length is greater than zero. This is an easy way to check for its existence.

__len__() int

Return the length. This is used by (len)

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

Returns the value at the given index.

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

Set the value at the given index.