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

SDK • Multicore lockout and FreeRTOS

$
0
0
Friends,

I'd like to use the flash for durable storage. The documentation tells me I'm not allowed to program the flash if the other core might be reading it, so I think I want to run a function like this:

Code:

  template <typename F>  static void WithSingleCoreAndInterruptsSuppressed(F &&f) {    multicore_lockout_start_blocking();    taskENTER_CRITICAL();    taskDISABLE_INTERRUPTS();    f();    taskENABLE_INTERRUPTS();    taskEXIT_CRITICAL();    multicore_lockout_end_blocking();  }
Inside f(), we'd do the flash programming. My question is whether this is truly the best way to do this in FreeRTOS. Is there a function in the Pico FreeRTOS port that will accomplish all this with a little less boilerplate? And preferably without me having to manually initialize the two cores as lockout victims?

Statistics: Posted by jags84 — Sat May 04, 2024 7:51 pm



Viewing all articles
Browse latest Browse all 4861

Trending Articles