Skip to content

Add PICO_MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED (defaults to 1) to allow mutlicore_lockout to work before core 1 is started#3019

Merged
kilograham merged 9 commits into
developfrom
flash-multicore
Jun 24, 2026
Merged

Add PICO_MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED (defaults to 1) to allow mutlicore_lockout to work before core 1 is started#3019
kilograham merged 9 commits into
developfrom
flash-multicore

Conversation

@kilograham

Copy link
Copy Markdown
Contributor

fixes #2639

…low mutlicore_lockout to work before core 1 is started
@kilograham kilograham added this to the 2.2.1 milestone Jun 18, 2026
@kilograham kilograham requested a review from will-v-pi June 18, 2026 22:19
@kilograham

Copy link
Copy Markdown
Contributor Author

it slightly irks me that this adds code to multicore_launch_core1 even if multicore_lockout functions aren't called (this was true before actually, its just now two places)

@kilograham kilograham marked this pull request as draft June 18, 2026 22:21
@kilograham

Copy link
Copy Markdown
Contributor Author

oops, converting to draft, as I need to add a "multicore_lockout_can_be_called()" or whatever

Comment thread src/rp2_common/pico_multicore/multicore.c Outdated
@peterharperuk

peterharperuk commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

It still asserts in default_enter_safe_zone_timeout_ms. configNUMBER_OF_CORES=1, running freertos on core 0 which calls flash_safe_execute_core_init. Core 1 not started. Is that right?

I've been using this example to reproduce the issue raspberrypi/pico-examples#762

@kilograham

Copy link
Copy Markdown
Contributor Author

It still asserts in default_enter_safe_zone_timeout_ms. configNUMBER_OF_CORES=1, running freertos on core 0 which calls flash_safe_execute_core_init. Core 1 not started. Is that right?

I've been using this example to reproduce the issue raspberrypi/pico-examples#762

yeah - as per draft comment, it is missing a bit to make it work; i'll try the example... i'm going back and forth as to whether i want this, or to force people to call a method to setup core 1!

… off new support to save the extra bit of code needed
@kilograham kilograham marked this pull request as ready for review June 19, 2026 22:41
Comment thread src/rp2_common/pico_multicore/multicore.c Outdated
CRT0_FAR_CALLS and MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED hadn't been implemented correctly (so were always excluded), and THREAD_LOCAL was missing from docs
#
# \param\ INCLUDE The items to include
# \param\ EXCLUDE The items to exclude
function(pico_minimize_runtime TARGET)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed a commit to fix this, as both CRT0_FAR_CALLS and MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED weren't implemented correctly, so were always excluded

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx

will-v-pi
will-v-pi previously approved these changes Jun 24, 2026

@will-v-pi will-v-pi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - tested it works with the flash_progam example. If you link pico_multicore, without this PR it panics, and with this PR it now works fine.

Comment thread src/rp2_common/pico_flash/flash.c Outdated
Comment thread src/rp2_common/pico_multicore/include/pico/multicore.h Outdated
#endif

// PICO_CONFIG: PICO_MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED, Allow multicore_lockout functions called from core 0 to succeed if core1 has not been started, default=1, group=pico_multicore
#ifndef PICO_MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could be PICO_SUPPORT_MULTICORE_LOCKOUT_BEFORE_CORE1_STARTED but perhaps that's a bit long 😉

Comment thread src/rp2_common/pico_multicore/include/pico/multicore.h Outdated
Co-authored-by: Andrew Scheller <lurch@durge.org>
will-v-pi
will-v-pi previously approved these changes Jun 24, 2026
Comment thread src/rp2_common/pico_multicore/multicore.c Outdated
Comment thread src/rp2_common/pico_runtime/CMakeLists.txt Outdated
Co-authored-by: Andrew Scheller <andrew.scheller@raspberrypi.com>
@kilograham kilograham merged commit a183b84 into develop Jun 24, 2026
14 checks passed
@kilograham kilograham deleted the flash-multicore branch June 24, 2026 17:08
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.

4 participants