New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: provide dummy implementation of thread and mutex for riotboot #17959
Conversation
I think this is split out from #17379 and not 17341. |
There are some uncrustify comments, maybe @maribu could take a look at this one? |
I would like to see some safeguards, e.g. a I think @kaspar030 has a strong opinion on approaches like this. I personally do like this, though ;) |
If this is like, +26 lines as in this PR, I think it is ok. |
Ah sweet, I like this. We removed mutexes for RIOTBOOT, as well. ROM was tight and our hack was required to fit our RIOTBOOT in 8kB. |
oooooooooook. ;) |
Yeah, we are using an external SPI NOR flash to copy over new app images. This |
I think @maribu suggestion on providing static asserts is still missing. |
Added the |
Looks good to me, please squash. One last bike-shedding item: Does it really make sense to make |
Well the dummy mutex still works with threads enabled if there is only a single thread (that's how I tested it with a modified Since |
I understand that, but this seems to be an implementation detail to me. From the users point of view the mutex is always provided and always fulfills the API agreements. Maybe it would be better to haven an |
Yes this works well.
to some simple examples, e.g. for the riotboot use case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, code looks good and I am trusting your test results.
I really like this one!
This is intended for the bootloader module where we don't enter thread mode, so mutex must never attempt to switch context. Instead use a simple busy wait that is enough to make the possible mutex users (e.g. interrupt based SPI) in bootloader mode work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Contribution description
Riotboot does not enter thread mode.
It can still be desirable to use periph code in this environment, e.g. SPI drivers that make use of mutex.
Since there are no threads, the implementation can be very simple: Busy wait on lock with the expectation to be un-locked from e.g. the TX complete ISR.
mtd_spi_nor
nakes use ofthread_yield()
so provide a dummy implementation of that which is simple a no-op.Testing procedure
Add
to some single-threaded tests. You might have to bump
ISR_STACKSIZE
.Issues/PRs references
split off #17379