FreeRTOS without any interrupt source?

michaelmoese wrote on Friday, March 14, 2014:

Hello Everybody.
I’m currently evaluating options for implementing some functionality for a custom FPGA-based CPU. I’d strongly prefer using FreeRTOS over some homegrown solution. However, my processor, while being perfectly suitable for my task, does not provide me any interrupt handling. For the target application, this would be fine. Also, pure Cooperative Multitasking would be fine (I know I can’t preempt without timer interrupt).
Now to my question: Will I be able to successfully port FreeRTOS to my CPU, even if it does not support interrupts?
I got sources for my CPU, so I could add interrupts to the processor - however I’m a software developer who is happy when being able to connect two IP-cores inside an FPGA design… I’m pretty sure I will have a hard time adding interrupts to the CPU.

rtel wrote on Saturday, March 15, 2014:

I have never tried it, but presumably you could use a pure cooperative scheme (with configUSE_PREEMPTION set to 0) provided you don’t ever try to delay. For example, without modifying the code you would not be able to call things like vTaskDelay(), or specify a block time to a queue, semaphore or event group function.

If you had a free running time source that didn’t generate interrupts you could potentially add some time management into a trace macro that gets called each time a yield was performed. That would be somewhat non-trivial as you would need to figure out how much time had passed between successive yields, then manually call the ‘increment tick’ function that many times in a loop.


michaelmoese wrote on Monday, March 17, 2014:

Thanks for your reply. I’m aware of not being able to block tasks when no timer interrupt is available. However, due to the lack of interrupts, I wouldn’t even need real semaphores - I could just use variables for event notifications, and I would never need to protect any critical sections, as no preemption could happen.
I think I will just try this out, porting of FreeRTOS does not seem a too difficult task.

I’ll keep you updated.