Skip to content

Hang in malloc with Pico 2 after upgrade from SDK 2.0 to SDK 2.1 #2198

@ikjordan

Description

@ikjordan

I have an application that uses scanvideo on core 1 and processing logic on core 0. After update to SDK2.1 I see a likely race condition which sometimes results in core 1 hanging at the first malloc. Core 1 is blocked at mutex_enter_blocking(&malloc_mutex).

I have only seen this issue when using a Pico 2. This condition only manifests itself on the Pico 2 after a cold boot, with a release build. It does not occur when connected to a debugger, or if a reboot is triggered via the watchdog. The hanging line in malloc.c was identified by changing the pico LED state before and after the call.

The issue has been reproduced using the master and develop SDK2.1 branches. However, it does not occur if I move back to the version of the TinyUSB library that was in SDK 2.0. I therefore suspect that TinyUSB 17.0. may be triggering this. As further evidence of this, I can reproduce the issue with SDK 2.0 if I use it with the TinyUSB submodule version that is in SDK 2.1. It does not occur if I use SDK2.0 with the SDK 2.0 version of tinyUSB.

I am at a loss as to how to trace this further. For now my workaround is to use SDK2.1 with the TinyUSB submodule from 2.0. I've raised the issue in case others experience it too.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions