Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

Parameter corruption with xTaskCreate

Posted by Alexandre Malo on June 17, 2009
Hi,

I want to create task and retrieve the handle, but when I call the xTaskCreate, the handle parameter get corrupted or is not passed correctly.

void vTDT_Init()
{
static unsigned char ucParamTrap;
int result;
xTaskHandle handle;

/* Start trap demo task */
result = xTaskCreate(vSendTrapTaskDemo,
(signed portCHAR*)"TRAP",
TRAP_TASK_STACK_SIZE,
&ucParamTrap,
TRAP_TASK_PRIO,
&handle
);
}

when in vTDT_Init() function, handle as a valid address. When pass to xTaskCreate, the address is change and become invalid.

Any idea why I get this behavior? This task is created in the main, so I doubt its a freeRTOS stack size problem...

Thanks

RE: Parameter corruption with xTaskCreate

Posted by Jack Peacock on June 17, 2009
The "handle" variable is allocated on the stack when you enter the vTDT_Init routine. When you exit the routine it no longer exists. Try making "handle" a global; move it out of the routine block.

RE: Parameter corruption with xTaskCreate

Posted by Alexandre Malo on June 17, 2009
Hi, I have also tried this. It's not working. There is still corruption

You say it's allocated on the stack. But wich stack? Is there a way to control that stack you are talking about? I guess it's the default micro-c stack...

Thanks

RE: Parameter corruption with xTaskCreate

Posted by Alexandre Malo on June 17, 2009
The corruption made when passing the arguments. Right in xTaskCreate the handle point to an invalid memory address.

The function stop there because there is an exception (trying to write to a protected space...)

I must put NULL atm. I can't use handles..

RE: Parameter corruption with xTaskCreate

Posted by MEdwards on June 17, 2009
Which port are you using? MCU and compiler.

RE: Parameter corruption with xTaskCreate

Posted by Alexandre Malo on June 17, 2009
Im working with CodeWarrior.

My micro-c is MCF5282. (M5282LITE)

RE: Parameter corruption with xTaskCreate

Posted by MEdwards on June 17, 2009
In which case check your compiler options. You can configure to use either register based parameter passing or stack based. Sounds like something is messed up somewhere.

RE: Parameter corruption with xTaskCreate

Posted by Alexandre Malo on June 17, 2009
You are right!! Thanks!!

My config was set to compact mode.. I guess there was a messed up in the settings.. I set it to register and its working..

I'll optimize later :)

Thanks a ton!


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists