FreeRTOS & IAR Debug on the IAR Simulator

brakova wrote on Thursday, October 27, 2011:


I have spent a lot of time tring to setup my IAR 6 EWARM environment to use the FreeRTOS source in my projects. I’d be glad if you could refer me to some working tutorials.

I want to build the project for AT91SAM7X256 or AT91SAM7X512.
I’ve downloaded the FreeRTOS Source and explored the uIP Demo that is included - It runs with no problems on my target but it fails with the IAR Simulator, because the IAR port cannot be exuted using the IAR simulator.
What do I have to do in order to run it with the Simulator?

I have IAR EWARM KickStart and in the IAR site it’s said that it includes -
•RTOS plugins available from IAR Systems and RTOS vendors
However in the installation directory …\arm\plugins\rtos I don’t see a FreeRTOS folder but I do have it in the project Options > Debugger > Plugins tab.
Do I have to install anything additional in order to get thing running with the RTOS? I want to be able to debug with the Simulator without deploying on the target.

Thank you very much for your help!

rtel wrote on Thursday, October 27, 2011:

I don’t know about the IAR simulator specifically, but the only simulator (for any architecture) I have ever successfully run FreeRTOS in without having to change anything is the Keil one.  That is because most simulators only simulate the core.  If the code does something like configure a PLL and wait for it to lock, the code will just hang, as there is no PLL simulation.  You can normally spot that because if you stop the simulator and look at which code it is executing you will find it is sat in a tight loop waiting for a register to change - when the register does not even exist in the simulation (that often happens even before main() has been called).  You can work around this by selectively commenting out bits of code, but I don’t think you will get the Ethernet working in the simulator whatever.

If you have V6.21 of the IAR tools then I don’t think you need to change or install anything to use the plug-in - it is shipped with IAR pre-installed.  As you say, under the debug options, on the plug-ins tab (from memory) you just check the box next to FreeRTOS (some versions may call it OpenRTOS), then start a debug session.


brakova wrote on Thursday, October 27, 2011:

Thank you Richard,

Do you know if I can manage to set up my project properties in order to run one of the simple examples in the FreeRTOS Practical guide. For example I want to have two task executing with equal priorities. Here is my main()

xTaskCreate( vTask1, “Task 1”, 200, NULL, 1, NULL );
xTaskCreate( vTask2, “Task 2”, 200, NULL, 1, NULL );

What changes to the project settings do I need in order to get this simple demo to work with the Simulator?
I’ve been trying the last few days but most of the time I hit the following error:

User error: UNPREDICTABLE behavior: Tried to execute an MSR instruction that writes to SPSR in a mode that does not have an SPSR. Instuction address: 0x001037E4 CPSR value: 0x2$001037E4

Thanks very much again!