Skip to content

Build and run on single-core ESP32s (ESP32-C3) - #1260

Open
mrb wants to merge 2 commits into
shorepine:mainfrom
mrb:single-core-esp32
Open

mrb wants to merge 2 commits into
shorepine:mainfrom
mrb:single-core-esp32

Conversation

@mrb

@mrb mrb commented Nov 12, 2026 •

Copy link
Copy Markdown
  • amy_midi.c: UART_NUM_2 exists only on chips with 3 UARTs; guard it with SOC_UART_NUM > 2. Without this, the library doesn't compile for the C3 ('UART_NUM_2' undeclared).
  • amy.h: pin the fill-buffer task to core 1 only where there is a core 1. On single-core chips xTaskCreatePinnedToCore(..., 1) fails, and AMY crashed at boot on the C3.
  • patches.c: with config.platform.multicore off, place every voice from osc 0. Voice allocation starts even voices at AMY_OSCS/2, the half the second core renders, but with one render task that split does nothing. On the C3 a 2-voice piano took oscs 64-104, overlapping oscs the sketch drives directly (84 and up). Both played through the same oscs (audible glitches), and once the sketch freed its oscs, render_partials read a freed partial (Load access fault, crash loop). Multicore builds and Tulip are unchanged.

Tested: examples/BillieJeanDrums compiles for esp32c3 (failed before) and esp32s3 (arduino-esp32 3.3.12). The first two changes have run on ten ESP32-C3 boards for several days. With the third, the piano sits at oscs 0-81 next to sketch-driven oscs at 84+, plays without glitches, and no longer crashes; all ten boards run it.

🤖 Generated with Claude Code

- amy_midi.c: UART_NUM_2 exists only on chips with 3 UARTs; guard it with
  SOC_UART_NUM > 2. Without this, the library doesn't compile for the C3
  ('UART_NUM_2' undeclared).
- amy.h: pin the fill-buffer task to core 1 only where there is a core 1.
  On single-core chips xTaskCreatePinnedToCore(..., 1) fails, and AMY
  crashed at boot on the C3.

Tested: examples/BillieJeanDrums compiles for esp32c3 (failed before) and
esp32s3 (arduino-esp32 3.3.12); the same two changes have run on ten
ESP32-C3 boards for several days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T17:35:26.094545Z 378db61 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Voice allocation starts even voices at AMY_OSCS/2 so they land in the
half of the oscs that the second core renders (esp_render_on_cores).
With multicore off there is one render task and the split does nothing,
but voices still went to the top half. On an ESP32-C3 a 2-voice piano
(41 oscs a voice) took oscs 64-104, on top of oscs the sketch addressed
directly (84 and up): both played through the same oscs (audible
glitches), and once the sketch freed its oscs render_partials read a
freed partial (Load access fault, crash loop).

With multicore off, every voice now searches from osc 0, so voices pack
from the bottom and the top oscs stay free. Multicore builds and Tulip
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant