Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3552

General • Re: why does core 1 pause while core 0 writes flash?

$
0
0
If your core1 program is merely pausing while the flash is programmed, then you aren't executing from the XIP at the time (that would cause it to crash totally).

However, if you haven't done anything special, then PICO_FLASH_SAFE_EXECUTE_PICO_SUPPORT_MULTICORE_LOCKOUT is enabled by default. This causes the SDK to install an interrupt handler on core1, using the SIO's FIFO link between the two cores: whenever flash is in use on core0 it interrupts core1 and core 1 sits in the interrupt handler until the flash op on core0 is finished.

You can override this by defining PICO_FLASH_ASSUME_CORE1_SAFE=1 in your build.

If you do that, then core1 will be left alone during flash operations - but you are then responsible for making sure that core1 never touches flash. This isn't quite as easy as it seems; aside from obvious things like calling library functions that are in flash, the compiler can put unexpected things in flash (for example, if it compiles a case statement using a jump table, the jump table gets put in .rodata which is normally in flash even if the .text.functionname containing the executable code has been arranged to be in flash. So if your core1 code is quite small it's best to read the .dis file manually to check that the compiler has in fact generated what you had in mind.

Statistics: Posted by arg001 — Tue Jul 16, 2024 1:50 pm



Viewing all articles
Browse latest Browse all 3552

Trending Articles