This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FreeRtoss Using Stack

Hi,

I have a big problem about stack in FreeRTOS..I define two task.Task 1 has a stack and its name task1Stack_ and the other task2STACK_.Normally any task is not access to stack of the other stack.But when try this, task1 access to task2Stack_ and ı expect that dabort fault. In other words, task2Stack_ was used by task1 and it can change contents of the task2Stack..

The other problem is when i create a task with xTaskCreateRestricted() and give a memory region and I want to read only in this region but  when I write this region, process is not any return fault(Dabort), and write this region...Why ??

Thank you..

  • Hans,

    This might be one for the FreeRTOS forum. 

    I think you have to setup the MPU configuration manually when you create your tasks;  since the MPU settings are passed in the parameter  'xRegions'

    xTaskGenericCreate(pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )

    You'd think some areas might be auto configured (like the stack for each task) but I didn't spot any code that looks like it's doing this.  

    What are you doing for xRegions?

     EDIT:  It looks like the key function might be   'vPortStoreTaskMPUSettings' in os_port.c.

    Looks like if yoy don't have xRegions set, then the default is to open up the on-chip RAM to the task.
    If you do have xRegions set, it looks like the task stack area gets MPU region 0 and the remainder of the MPU settings are set according to xRegions.   Now that's my take after spending about 30 seconds skimming the code so it's probably wrong - but hope that helps point you toward a useful direction.