Skip to content

Building precompiled module for itsybitsy esp32 gives incompatible .mpy arch #9471

Open
@graeme-winter

Description

@graeme-winter

CircuitPython version

Adafruit CircuitPython 9.1.1-5-g901dd228cb-dirty on 2024-07-28; Adafruit ItsyBitsy ESP32 with ESP32

Code/REPL

import mandelbrot

Behavior

>>> import mandelbrot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: incompatible .mpy arch

Description

Building a C-based extension module for circuitpython based on one for micropython, works fine one ARM e.g. itsybitsy M4, grand central M4, Teensy 4.1 but fails on ESP32 due to misalignment in the chain between the magic number to report the architecture and the circuitpython validation

Think the header is correct:

header: 43:06:29:1f

In Makefile I have ARCH = xtensawin which I think is correct?

Additional information

At this commit

commit 901dd228cbdb2069e66fae8c2108d44466ab1e7f (HEAD -> 9.1.x, origin/9.1.x)
Merge: 0b6b746779 a05584281e
Author: Scott Shawcroft <[email protected]>
Date:   Fri Jul 26 10:02:44 2024 -0700

    Merge pull request #9466 from jepler/issue9465-91x
    
    Only use pyi files for autoapi doc generation
  • this delta
diff --git a/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h b/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
index 9b20c5f73e..706bf07230 100644
--- a/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
+++ b/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
@@ -11,6 +11,8 @@
 #define MICROPY_HW_BOARD_NAME       "Adafruit ItsyBitsy ESP32"
 #define MICROPY_HW_MCU_NAME         "ESP32"
 
+#define MICROPY_PY_UCTYPES (1)
+
 #define MICROPY_HW_NEOPIXEL (&pin_GPIO0)
 #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2)
 
diff --git a/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.mk b/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.mk
index a32c17b806..a485d6d017 100644
--- a/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.mk
+++ b/ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.mk
@@ -10,3 +10,6 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB
 CIRCUITPY_ESP_PSRAM_SIZE = 2MB
 CIRCUITPY_ESP_PSRAM_MODE = qio
 CIRCUITPY_ESP_PSRAM_FREQ = 40m
+
+CIRCUITPY_ENABLE_MPY_NATIVE = 1
+MICROPY_ENABLE_DYNRUNTIME = 1

Tried debugging this myself but couldn't find where the logic was going sideways: the absence of printf or equivalent from the C layer & my inability to run this inside a debugger makes it hard to figure out why the failure is happening...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions