Stack-Problem on LPC2290

lucky-joe wrote on Wednesday, March 14, 2007:

Hi @all,

i have the FreeRTOS running on a LPC2290-Board and up to now it works fine. Additionally i have added the newlib-lpc-port from Aeolus and it also runs fine. For developing I’m using the WinARM-distribution.

Now i have tried to extend the system with an proprietary CAN-driver and the i get abort-errors and some strange behaviour. I’m still debugging with a GBD-Insight with segger-JLink and my gdg told me, the may be stack is corrupted or I got the message “cannot access the memory address 0x11111111” which is the regvalue of r11.

I think, that stacksizes are big enough, 0x2000 for IRQ and SVC !

At the moment I don’t have any idea how to catch this problem, does anyone have an idea how to find this error ?

regards

Joe

lucky-joe wrote on Wednesday, March 14, 2007:

additional information:

the error occurrs only after a CAN-Interrupt and only when I call function ins the CAN-isr.

nobody wrote on Wednesday, March 14, 2007:

Does the CAN ISR use a lot of stack?
Has the CAN ISR been written using the required syntax (naked attributes, portENTER_SWITCHING_ISR(), only declaring variables ater the call to portENTER_SWITCHING_ISR(), etc)?

In the Data Abort handler, inspect the value of pxCurrentTCB to find out the location of the stack being used.  If there are no 0xA5’s left in the stack then it has overflowed.

lucky-joe wrote on Wednesday, March 14, 2007:

I don’t want to switch in the CAN-Isr only proceed my CAN-driver

the ISR ist attributed with the follwoing statement:

void  __attribute__((interrupt("IRQ"))) v_lpc22xx_CanIsrRxBus1 (void)

I think it seems to be OK !

I also tried to use the Macros : portSAVE_CONTEXT & portRESTORE_CONTEXT but that crashed immediately :frowning:

Joe

nobody wrote on Wednesday, March 14, 2007:

> I don’t want to switch in the CAN-Isr only proceed my CAN-driver

Not sure what this is meaning.

portSAVE_CONTEXT & portRESTORE_CONTEXT should not be used in an IRQ.

portENTER_SWITCHING_ISR() portEXIT_SWITCHING_ISR() can only be used in naked functions.

Does not help with your problem.  Just clarification.

lucky-joe wrote on Wednesday, March 14, 2007:

the problem is solved :slight_smile: after adding the macros to the isr the system is running and I also understand why
the macros are so neccessary

thank you for helping

regards
Joe