This week main project is to port FreeRTOS to the newer AEMB. In the previous weeks, the AEMB processor only fully utilizes one thread. It was the older version and the newer version actually fully utilizes two threads. I was instructed to make the necessary changes so that FreeRTOS will work on both of the two threads.
First of all, what are the main differences between the old AEMB and new AEMB? The main difference is the interrupts. On the older AEMB, interrupts only happen on 1 thread while the newer AEMB does on both threads.
AEMB runs on both threads alternatively. The 5 stages of the pipeline are done on each thread. Although both threads run the same instructions simultaneously, at one point thread 0 runs the instructions leading to FreeRTOS while thread 1 runs an infinite loop.
Looking at the assembly code compiled shows that FSL bit in the MSR was set. After it was cleared, the fetching process of thread 1 stop at an address which initiates the infinite loop. This means that thread 1 do not run any other instructions. There are experiments needed to be done to see if removing this loop will cause duplication or not.
Apart from this, a simple FreeRTOS program was simulated in the newer AEMB to see how interrupts from two threads affect it. From the simulation output, the first task was run once and then no other task run until weird symbols appear. Using GTKWave, it shows that an interrupt happened in thread 1 during the first task. Does this mean that the interrupt handler failed to call upon the second task in thread 1?
More experiments are needed to explain this problem.