Add rp2040 task queue support for Core #1 #2634
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR re-implements the task queue using SDK-provided queue API. This allows code running on Core #1 to queue tasks for execution by Sming (which runs on Core #0).
Some care is required running both cores together so some notes have been added to the documentation.
Note: I had a need to run some simple background analogue processing for which core 1 was an ideal solution.
I put all the code in RAM, both for performance reasons and because XIP is suspended during flash erase/write operations (such as file writes). I avoided using floating-point code for the same reasons - FP routines are large so compile to flash.
The Cortex M0+ has hardware support for integer division but these routines compile to flash by default. They're small so have set the SDK
PICO_DIVIDER_IN_RAM
flag. It seems reasonable that integer arithmetic shouldn't require flash accesses.Note: There is also
PICO_INT64_OPS_IN_RAM
andPICO_MEM_IN_RAM
which probably warrant further investigation/consideration.