3 ms·
It's worth it. I played with Propeller chips a while back. They have multiple cores and a shared memory but no interrupts. They can work, but you dedicate an en
by R0b0t1 5y ago
It's worth it. I played with Propeller chips a while back. They have multiple cores and a shared memory but no interrupts. They can work, but you dedicate an entire CPU (expensive!) to a task, usually. The scant times you don't need to is because you poured time into a more difficult cooperative multitasking solution that isn't flexible.
You don't need to implement a nested vectored interrupt controller. Even just a timer/counter with overflow interrupt would solve your current issues with lockup by allowing you to implement preemptive multitasking. Once you do that it would be easy-ish to extend to the serial controller.
Basically, on interrupt flag = 1,
1. Disable further interrupts (no nesting). This makes things easier to implement.
2. Save register state. For speed a special set of shadow registers can be used, or you can put register state on the stack.
3. Jump to interrupt routine code start.
4. Let interrupt handler run, clear interrupt flag, then return.
In the simplest case an input flag simply causes a CALL (push pc, jump to address). In that case the interrupt handler needs to know to save state. You can test flags between instructions to see if you need to inject the push/jump.