dabort irq on 1st call to portSAVE_CONTEXT

nixw wrote on Friday, July 03, 2009:

Hello All,

I’m using the V4.2.0 ARM7_LPC2000 port of the FreeRTOS and am now getting the dabort irq on the first call to portSAVE_CONTEXT.  Previously I did not have this problem but I think I have changed something.  I am using source code control but reverting to a previous commit doesn’t seem to help.  I have been trying to work this out for a while now and have been browsing the forums for similar problems but have had no luck.  Does anyone have any ideas to what I have done?  Thanks in advance.

Nick

rtel wrote on Friday, July 03, 2009:

I presume to get that far the kernel was started correctly.  Which mode is the CPU in when portSAVE_CONTEXT is called. 

Regards.

nixw wrote on Sunday, July 05, 2009:

Yes the kernel seems to have started correctly.  The tick interrupt is working, memory seems to be successfully allocated to the tasks and the program runs into the last defined task.  I’ll check the CPU mode asap.

nixw wrote on Monday, July 06, 2009:

In the current task the CPSR register shows that it is in System mode and just before portSAVE_CONTEXT is called it is in Supervisor mode.  I have to break it on the line ‘asm volatile ( “ADD LR, LR, #4”);’ else it will not break and the board needs to be disconnected from the PC to get it to work again.

Cheers

nixw wrote on Monday, July 06, 2009:

In the current task the CPSR register shows that it is in System mode and just before portSAVE_CONTEXT is called it is in Supervisor mode.  I have to break it on the line ‘asm volatile ( “ADD LR, LR, #4”);’ else it will not break and the board needs to be disconnected from the PC to get it to work again.

Cheers

nixw wrote on Monday, July 06, 2009:

I discovered that for some reason the CPU mode had changed to FIQ after power up and before vTaskStartScheduler was being called.  This made me look at the start up files ‘Philips_LPC230X_Startup.s’ and ‘crt0.s’ and discovered that crt0.s had been changed (particularly the supervisor set up for some unknown reason) from the original project (unfortunately not currently under revision control).  Using the old version of the file from a backup fixed this problem.   Thanks heaps for your help Richard.  I wasn’t very familiar with the CPU modes and their use in OS design till you prompted me to look into it.  Cheers.