StackOverflow while Debugging one task

patrickecr wrote on Friday, December 16, 2011:

Hi

I’m debugging a new project which runs with FreeRTOS and have got an problem during debugging the source.

Problem:
Everytime I set a breakpoint in one task, there are three taks running (quasi-)parallel, it stops there and next time never gets to this BP again. When I stop the application I see, that the vApplicationStackOverflowHook()-function was called. The other 2 tasks are still running fine. But the task I want to debug, is now in the endless-for-loop…

I can also do the same with one of the two other running tasks, which also stops then after reaching the overflow-function…

Any suggestions?

Best regards
Patrick

davedoors wrote on Friday, December 16, 2011:

Any suggestions?

Yes - tell us which chip and compiler you are using.

patrickecr wrote on Monday, December 19, 2011:

Omg … bad job from my side to forget it.

I use MCF52259 (on MCF52259EVB) from Freescale. IDE CW 10.1, I use the included Coldfire-Compiler there.

The code I use is the following:

#define Queue_Active 	0
	
unsigned int counter;
unsigned int counter_T2;
xQueueHandle xQueue1;
static portTASK_FUNCTION(vMainTask, pvParameters) {
	const portTickType xDelay = 2/portTICK_RATE_MS;
	portTickType xActual = 0;
#if Queue_Active 
	counter = 0;
	xQueue1 = xQueueCreate(4, sizeof(unsigned int));
	
	if(xQueueSend(xQueue1,&counter,10) != pdPASS ){
		portNOP();
	}
#endif
	
	for(;;){
		xActual = xTaskGetTickCount();
		vTaskDelayUntil(&xActual,xDelay);
#if Queue_Active 			
		portENTER_CRITICAL();
#endif		
		Bit1_NegVal();	
#if Queue_Active 		
		xQueueReceive(xQueue1,&counter,1);
		counter++;
		xQueueSend(xQueue1,&counter,1);
		counter = 0;	
		portEXIT_CRITICAL();
#endif		
	}	
}
static portTASK_FUNCTION(vMainTask2, pvParameters) {
	const portTickType xDelay = 2/portTICK_RATE_MS;
	
	for(;;){
		vTaskDelay(xDelay);
#if Queue_Active 			
		portENTER_CRITICAL();
#endif			
		Bit2_NegVal();
#if Queue_Active 		
		xQueueReceive(xQueue1,&counter_T2,1);
		counter_T2++;
		xQueueSend(xQueue1,&counter_T2,1);
		counter_T2 = 0;	
		portEXIT_CRITICAL();
#endif	
	}
}
static portTASK_FUNCTION(vMainTask3, pvParameters) {
	const portTickType xDelay = 10/portTICK_RATE_MS;
	
	for(;;){
		vTaskDelay(xDelay);
		Bit3_NegVal();
	}
}

I already tried to increase stack ov all and of certain tasks (from standard 600 to 2.4k) but without success.

Thx!

Best regards
Patrick