Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mauropm/34abbcb198ae4e555d5a5b5bbec1462b to your computer and use it in GitHub Desktop.

Select an option

Save mauropm/34abbcb198ae4e555d5a5b5bbec1462b to your computer and use it in GitHub Desktop.
prompt to check if current folder has compatibility with the m5stack cardputer (original)

Claude Code Prompt — Analyze Current Folder for M5Stack Cardputer Compatibility

You are an expert embedded systems engineer specializing in ESP32, ESP-IDF, Arduino, PlatformIO, LVGL, FreeRTOS, and M5Stack devices.

Your task is to analyze the ENTIRE current folder recursively and determine if this project can run correctly on the M5Stack Cardputer.

Official hardware documentation:

Important hardware details of the Cardputer:

  • ESP32-S3FN8 dual-core Xtensa LX7 @ 240 MHz

  • 8 MB Flash

  • ST7789V2 display (240x135)

  • 56-key keyboard

  • Built-in speaker + MEMS microphone

  • microSD slot

  • Grove HY2.0-4P port

  • USB OTG

  • ESP-IDF / Arduino / PlatformIO supported

  • No PSRAM on standard Cardputer model

  • Uses ESP32-S3 architecture

  • Display and peripherals use custom GPIO mappings

  • Typical frameworks:

    • ESP-IDF
    • Arduino
    • PlatformIO
  • The Cardputer uses the M5Cardputer library and M5Unified ecosystem for many examples. (M5Stack Docs)

Perform the following tasks carefully and systematically.


PHASE 1 — PROJECT DISCOVERY

Analyze recursively:

  • source files
  • build system files
  • configuration files
  • manifests
  • libraries
  • scripts
  • assets
  • partition tables
  • linker scripts
  • sdkconfig files
  • platformio.ini
  • CMakeLists.txt
  • component manifests
  • Arduino configuration
  • LVGL configuration
  • dependencies
  • binary blobs
  • firmware packaging scripts

Detect automatically:

  • Framework used
  • ESP-IDF version
  • Arduino Core version
  • PlatformIO environment
  • Target chip
  • Memory assumptions
  • Display drivers
  • Input drivers
  • Audio drivers
  • Filesystem usage
  • Network stack usage
  • BLE/WiFi usage
  • USB usage
  • PSRAM assumptions
  • External peripherals

Generate a concise architecture summary.


PHASE 2 — CARDPUTER COMPATIBILITY ANALYSIS

Determine whether the codebase is compatible with:

  • ESP32-S3
  • Cardputer display
  • Cardputer keyboard
  • Cardputer memory limits
  • Cardputer flash size
  • Cardputer GPIO assignments
  • Cardputer power limitations
  • Cardputer filesystem layout
  • Cardputer audio hardware
  • Cardputer SD card subsystem

Specifically detect:

  • hardcoded GPIO conflicts
  • unsupported peripherals
  • unsupported display drivers
  • incompatible PSRAM requirements
  • memory overflows
  • unsupported USB modes
  • unsupported DMA assumptions
  • timing assumptions
  • incompatible partition tables
  • unsupported board definitions
  • invalid sdkconfig options
  • unsupported Arduino board targets
  • incompatible LVGL framebuffer sizing
  • unsupported I2S/I2C/SPI pin mappings

Check compatibility with:

  • ESP-IDF
  • Arduino
  • PlatformIO
  • M5Unified
  • M5Cardputer libraries

PHASE 3 — DISPLAY + INPUT VALIDATION

Validate compatibility with the Cardputer hardware:

Display

Expected display:

  • ST7789V2
  • 240x135
  • SPI interface

Expected pins:

  • LCD_CS = GPIO37
  • LCD_SCLK = GPIO36
  • LCD_MOSI = GPIO35
  • LCD_DC = GPIO34
  • LCD_RST = GPIO33
  • LCD_BL = GPIO38

Verify:

  • resolution
  • color depth
  • LVGL buffer sizes
  • DMA usage
  • SPI frequency
  • framebuffer allocation
  • display rotation assumptions

Keyboard

Verify compatibility with:

  • 56-key keyboard matrix
  • Cardputer keyboard drivers
  • M5Cardputer keyboard APIs

Audio

Verify:

  • I2S compatibility
  • microphone usage
  • speaker pin assumptions

PHASE 4 — MEMORY ANALYSIS

The standard Cardputer DOES NOT include PSRAM. (M5Stack Docs)

Perform a full memory analysis:

  • heap usage
  • static allocations
  • framebuffer allocations
  • LVGL memory usage
  • task stack sizes
  • filesystem buffers
  • network buffers
  • JSON parsing buffers
  • TLS memory usage
  • audio buffers

Estimate:

  • flash usage
  • RAM usage
  • stack pressure

Identify all code that assumes PSRAM exists.

Report:

  • SAFE
  • RISKY
  • INCOMPATIBLE

for each subsystem.


PHASE 5 — BUILD VALIDATION

Attempt to determine if the project can compile for:

  • esp32-s3
  • m5stack-cardputer
  • esp32-s3-devkitc-1

Validate:

  • sdkconfig
  • board definitions
  • linker scripts
  • partition tables
  • upload settings
  • flash mode
  • flash size
  • USB CDC/JTAG settings

If PlatformIO is used, verify:

  • correct board target
  • framework compatibility
  • required build flags

Expected typical PlatformIO settings:

  • board = esp32-s3-devkitc-1
  • framework = espidf OR arduino
  • USB CDC enabled
  • ESP32-S3 target enabled

PHASE 6 — REQUIRED CHANGES

If incompatible:

  • generate a COMPLETE migration plan
  • generate required patches
  • generate exact file modifications
  • generate sdkconfig changes
  • generate platformio.ini changes
  • generate CMake changes
  • generate dependency changes

Include:

  • minimal fixes
  • recommended fixes
  • optimal Cardputer-native fixes

PHASE 7 — OUTPUT FORMAT

Generate the following files:

  1. CARDPUTER_COMPATIBILITY_REPORT.md

    • executive summary
    • compatibility status
    • detected issues
    • risks
    • estimated effort
    • subsystem compatibility matrix
  2. CARDPUTER_REQUIRED_PATCHES.md

    • exact fixes required
    • code snippets
    • config changes
  3. CARDPUTER_MEMORY_ANALYSIS.md

    • RAM analysis
    • flash analysis
    • PSRAM assumptions
    • task stack analysis
  4. CARDPUTER_BUILD_INSTRUCTIONS.md

    • exact build instructions
    • flashing instructions
    • monitor instructions
    • dependencies
    • required SDK versions
  5. CARDPUTER_GPIO_MAP.md

    • detected GPIO usage
    • conflicts
    • recommended remapping
  6. CARDPUTER_FINAL_VERDICT.md Final answer:

    • WILL RUN
    • WILL RUN WITH PATCHES
    • NOT COMPATIBLE

Include technical justification.


IMPORTANT RULES

  • Do NOT guess.
  • Verify everything from source code.
  • Trace macro definitions.
  • Trace conditional compilation.
  • Trace build flags.
  • Trace sdkconfig options.
  • Trace memory allocations carefully.
  • Be extremely strict about PSRAM assumptions.
  • Be strict about ESP32-S3 compatibility.
  • Detect hidden incompatibilities.
  • Prefer ESP-IDF-native solutions when possible.
  • Prefer M5Unified/M5Cardputer integrations when appropriate.
  • Assume this project may eventually be production firmware.

At the end, provide:

  • estimated probability of successful deployment
  • top 10 blockers
  • top 10 easiest fixes
  • overall risk score from 1–10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment