Task doesn't complete

mmsanchez wrote on Monday, May 06, 2013:


I created a task, which should write to a memory position an incrementing value as follows:

static void prvRead_Task( void *pvParameters )
	pointer = (int*)0x3000000;
	*pointer = 0;
	for (;;)
		//void (*p)(void) = address;
			*pointer = i;
		xil_printf("Script Successfully Excecuted!\r\n");

The problem is that if I run the task, the last value it writes is 0x0031fda3… This is the task with the highest priority, so here is no other task running at the moment.

How can this problem be fixed??


richard_damon wrote on Monday, May 06, 2013:

I don’t see a definition of pointer here, I assume it is an int*.

is the address 0x3000000 used by anyone? If this is in your ram space, if something has been placed here (like a FreeRTOS control structure), you may crash something.

mmsanchez wrote on Monday, May 06, 2013:

Hi richard. Thank you for your answer.
Yes… the pointer is defined as an int *

	int * pointer;

And no… I don’t have anything on this ram space… if I write a fixed value it works…
If I use for example for(i=0;i<0x1000;i++) It works fine… but with a big number the task doesn’t finish (I think that is what is happening) and writes until certain value and stops…


rtel wrote on Monday, May 06, 2013:


1) That the code works as expected when FreeRTOS is not running, then, assuming it does
2) That nothing else is using this RAM space when FreeRTOS is running.
3) That the code works (or not) when that is the only task that is running.
4) That sizeof( i ) is at least 4.  If you are using a Microblaze, it probably isn’t and you will need to make i an long rather than int.


richard_damon wrote on Tuesday, May 07, 2013:

Sounds like the problem is that if you take over a certain amount of time things have problems. It could be that the location is being used by an interrupt (have you checked you link map that the location is unused). It could be some interrupt corrupting something that causes this to crash.