FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2009 Threads] Parameter corruption with xTaskCreatePosted 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 xTaskCreatePosted 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 xTaskCreatePosted 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 xTaskCreatePosted 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 xTaskCreatePosted by MEdwards on June 17, 2009 Which port are you using? MCU and compiler.
RE: Parameter corruption with xTaskCreatePosted by Alexandre Malo on June 17, 2009 Im working with CodeWarrior.
My micro-c is MCF5282. (M5282LITE)
RE: Parameter corruption with xTaskCreatePosted 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 xTaskCreatePosted 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!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|