Skip to content

zephyr-cp: raise the rpi_pico UDC thread stack in debug builds - #5

Open
tyeth wants to merge 1171 commits into
mainfrom
zephyr-cp-debug-udc-stack
Open

tyeth wants to merge 1171 commits into
mainfrom
zephyr-cp-debug-udc-stack

Conversation

@tyeth

@tyeth tyeth commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Independent of the Bluetooth work — affects any RP2040/RP2350 board built with DEBUG=1.

debug.conf raises the DWC2 and nRF UDC thread stacks (verbose logging with LOG_MODE_IMMEDIATE formats in-thread and needs the headroom) but the rpi_pico one was missed. It defaults to 512 bytes and overflows during USB enumeration on a Pico 2 W:

***** USAGE FAULT *****
  Stack overflow (context area not valid)
>>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
Current thread: 0x200034b0 (usbd@50110000)

The board dies partway through configuration, so it presents as a bad USB come-up rather than a stack problem — it cost a while to spot, hence splitting it out on its own.

Caught with HW_STACK_PROTECTION enabled; without the MPU guard this is silent stack corruption instead of a clean fault.

🤖 Generated with Claude Code

@tyeth

tyeth commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Part of the CYW43439 shared-bus Bluetooth work tracked in #15, which links every PR and open issue across the four forks.

🤖 Generated with Claude Code

@tyeth

tyeth commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main 121489fe70 (force-pushed with --force-with-lease). New head 5f0ea1254a, previously 3955657be8.

Clean rebase, no conflicts: debug.conf has not changed upstream. Nothing on this branch touched the board files that main moved to boards/<vendor>/<board>/, so the only effect here is a fresh base for #4 and #14, which are re-stacked on this commit.

🤖 Generated with Claude Code

@tyeth

tyeth commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

This fix is incomplete: it only covers debug builds, and release builds lose USB because of it. See #18.

CONFIG_UDC_RPI_PICO_STACK_SIZE=2048 here lives in debug.conf, so release images keep Zephyr's 512-byte default. On hardware (Pico 2 W, 10.3.0-51-g8031983fc9) a release build drops off USB entirely partway through a _bleio scan — CDC port and CIRCUITPY volume both gone, USB device/stack error on reset, recovered by an SWD reset run.

The original usbd@50110000 stack overflow this PR was written for therefore still affects the images we actually flash, which also explains the "USB came up badly" resets seen during the initial Pico 2 W bring-up.

Suggested change: move the line to prj.conf. Verified on hardware — with it, a 12 s active scan yielding 925 reports from 20 distinct devices completes with USB intact; without it the same workload kills the bus.

🤖 Generated with Claude Code

tannewt and others added 17 commits September 17, 2026 09:28
…ing-uartlogger2

Enable turbo loader on HalloWing M4 and UART Logger II
…eenable

Turn the native .mpy loader back on for all nRF52 boards
Make `MICROPY_PY_DOUBLE_TYPECODE` cover every `'d'` typecode path
Store ROM qstr strings in a blob with 16-bit offsets
- board_init() no longer deletes code.py or creates main.py: the Elioblocs
  editor now writes code.py.
- The default boot.py explains why the drive is read-only and how to
  change it.
- GPIO15-16 are free pins (no 32 kHz crystal), and the NeoPixel count
  anticipates the next board revision.
The artifact API token `ACTIONS_RUNTIME_TOKEN` is only given to action
steps, not `run:` steps, so calling the script with `node` found no
records at all. `ci_download_sizes.mjs` is now a module that an
`actions/github-script` step imports and calls; the install of
`@actions/artifact` stays a shell step.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…main

Translations update from Hosted Weblate
The free-flash filter defaulted to "under 1 KiB", which shows an empty
table when no board is that tight, as on main today. Default to "all";
the colour bands still mark the tight boards.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
tannewt and others added 29 commits October 1, 2026 15:04
Port-level never_reset tracking and bulk reset helpers are removed.
Objects own their hardware and free it via GC finalizers (__del__ ->
deinit).
Port-level never_reset tracking and bulk reset helpers are removed.
Objects own their hardware and free it via GC finalizers (__del__ ->
deinit).
Pin the dependency's one-shot GPTimer correction and version-gated GDMA
setup. MatrixPortal S3 hardware now displays correct one- through four-bit
patterns, including RGB ramps and pause/resume at three and four bits.

Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Keep the ABC and ESP32 refresh implementation while using the dependency's
minimal diff against its IDF6 base.

Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Update the Protomatter dependency for PR adafruit#92 targeting master with
IDF6 support and reliable ESP32 timer scheduling. The dependency source
tree matches the previously validated d51abd7 tree exactly.

Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Help define board.DISPLAY
Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
stm: switch to finalizer cleanup (CIRCUITPY_BULK_RESET = 0)
Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Reject invalid height, width, bit depth, tile count, and pin arguments before registering an RGBMatrix object in the static display-bus array. This avoids leaking a slot and leaving an incomplete object for reset handling when those checks raise an exception.

Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Expose RowAddressMode.BINARY and RowAddressMode.ABC and validate the
constructor argument with the standard CircuitPython enum helpers.
Keep binary addressing as the default and update the API documentation.

Co-authored-by: Limor Fried <ladyada@users.noreply.github.com>
Addresses review feedback: don't reference the old never-reset
implementation in comments, just explain how it works now.
nordic: switch to finalizer cleanup (CIRCUITPY_BULK_RESET = 0)
…xrt10xx

mimxrt10xx: switch to finalizer cleanup (CIRCUITPY_BULK_RESET = 0)
Updated the boot button definition for safe mode.
Boot button seems to be 28 (tested with a GPIO monitor script)
rgbmatrix: add serial ABC row-addressing mode
…x-argument-validation

Validate RGBMatrix arguments before reserving a display bus
debug.conf bumps the DWC2 and nRF UDC thread stacks because verbose
logging with LOG_MODE_IMMEDIATE formats in-thread and needs more stack,
but the rpi_pico one was missed. It defaults to 512 bytes, which
overflows during USB enumeration on a Pico 2 W:

  ***** USAGE FAULT *****
    Stack overflow (context area not valid)
  >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
  Current thread: 0x200034b0 (usbd@50110000)

The board dies partway through configuration, which looks like a bad USB
come-up rather than a stack problem. Independent of any Bluetooth work —
it affects any RP2040/RP2350 board built with DEBUG=1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tyeth
tyeth force-pushed the zephyr-cp-debug-udc-stack branch from 5f0ea12 to cfbb1c9 Compare October 3, 2026 13:39
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.