I am writing code for an embedded system (Cortex M0) and do not have all the luxury items of mutexes / studs / etc. Is there an easy way to add data to a shared buffer (log file) that will be flushed to disk from my Main () loop?
If there is only one producer (1 interrupt) and one consumer (main loop), I could use a simple buffer where the producer increases the "head" and the consumer "tail". And it will be completely safe. But now that I have a few producers (interrupts), it looks like I'm stuck.
I could let everyone interrupt their own buffer and combine them into Main (), but this will require a lot of additional RAM and complexity.
source
share