AnsweredAssumed Answered

Stack Corruption - FreeRTOS

Question asked by s.girish on Jan 2, 2012
Latest reply on Jan 18, 2012 by s.girish
We are working on the STM3220-G Evaluation Board.
We are using IAR compiler [V6.2] and running a test application with FreeRTOS [7.0.2] and following is the issue:

1. Used sample application code from ST library - \STM32F2x7_ETH_LwIP_V1.1.0\Project\FreeRTOS
2. Our test application is having just 2 tasks and they are scheduled and execute very well.
    There is only FreeRTOS and no LWIP component running
3. However, in one of the tasks, we have some local variables and they are not updated. the same function works quite well if taken outside the RTOS.
4. We have not modified any options/settings and are using the IAR

1. We feel it is stack corruption issue ?
2. Any settings to be done to get the right SP ?. The SP is within range of 0x20000000 to 0x20020000 for both with FreeRTOS and without.

Settings from portasm.s
 /* Use the NVIC offset register to locate the stack. */
 ldr r0, =0xE000ED08
 ldr r0, [r0]
 ldr r0, [r0]
 /* Set the msp back to the start of the stack. */
 msr msp, r0
 /* Call SVC to start the first task. */
 cpsie i
 svc 0

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
define symbol __ICFEDIT_intvec_start__ = 0x08000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
define symbol __ICFEDIT_region_ROM_end__   = 0x080FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__   = 0x20020000;
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_heap__   = 0x200;
/**** End of ICF editor section. ###ICF###*/

define memory mem with size = 4G;
define region ROM_region   = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];
define region RAM_region   = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };
define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { readwrite };
do not initialize  { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };
place in RAM_region   { readwrite,
                        block CSTACK, block HEAP };