Continuing my Cisco router journey, Im working on a port for m68k. I have FreeRTOS running now, I can create tasks and start the scheduler, I see my tick interrupts firing, and I am calling into xTaskIncrementTick() from there.
But the tasks never seem to start after I start the scheduler. By this I mean that I have some code in each task that blips an IO line, but I never see these blips on my oscilloscope.
xTaskIncrementTick() always seems to return false as well.
Where could I start looking to figure out why the tasks are seemingly never started?
I don’t see the IO line being toggled, which should happen when the RTE instruction is executed because that should then start executing the tasks code and it’s the very first thing that should happen.
And I’m not getting any bus errors or otherwise odd behaviour or crashes that you might see if it was jumping off to some other random location.
Unfortunately I don’t really have a means of stepping through code right now as this is an entirely bare metal project, but I’m looking into options to be able to do this even if it means creating something myself. For now I’m getting away with toggling an IO line, but that will only get me so far.
That should help RTE do the right thing, and maybe your task code will actually run!
PS I can’t decide which is better, you trying to create a port for a CPU that predates FreeRTOS and many of its users, with no debugger, or the fact that the FreeRTOS team jumped in to help! Go Gaurav!
oof! Thats a damn good catch! Completely overlooked the stack frame format…!
I do now see my tasks starting up, but after a couple of ticks Im getting bus errors.
Ive put some crude debugging capability into my serial bootloader to dump registers/stack frame/a bit of the stack on an exception, so this will help with debugging.
I had some issues with my context switching code which I think was leading to stack corruption. After adding some nesting control my tasks are running perfectly now.
Awesome you got it working. When I saw you were doing 68k I thought – he’s crazy. And immediately I wanted to help! I have a “seasoned” love of 68k/CPU32 stuff.
I really do appreciate your help in pointing out that missing word, I still cant believe how much time and anguish that has saved!
It is a very nice architecture I must say!
Ive done a bit of work with Z80 as well (no, I wont try porting FreeRTOS to that, I promise), and for an 8 bit’er its a nice processor (I think so anyway), but the 68k really is very nice and Im quickly growing very fond of it, so I can understand why so many others love it too. Shame x86 won out in the end haha.
I have a few DIP64 68000’s in a tube packed away somewhere that Ive been wanting to do something with (kind of want to build a VME style system because the bus arbitration seems like an interesting challenge to do in some CPLDs), but this Cisco router just presented a nice opportunity to do something with a pre-built system, and its a good distraction from the goings on of the world at the moment.
Now I should formalise my documentation and notes of what Ive discovered of this router so far.
Just be sure to be on the new_task_switch branch as this contains a significatnt fix, but I havent yet merged it into master (Ive been debating whether I should maintain a full FreeRTOS fork, or only the port itself - Im leaning towards the later).