using sprintf on LPC2468, possible stack overflow?

Hello I’m want to use sprintf function in my task and I’ve got some problems with it. Here’s the code:
void vMyTask(void *pvParameters)
{
while(1)
{
char mytext[50];
sprintf(mytext, "blah blah");
char *pointer = mytext;

xQueueSend(Global_Queue_Handle, &pointer, 1000);
vTaskDelay(5000);
}
}
So far, the sprintf function works, data is being sent to httpd-cgi and then to web interface, where it displays “blah blah” text just fine. But if I put some integer in the code, say:

char mytext[50];
int value=123;
sprintf(mytext, "%d blah blah", value);
char *pointer = mytext;
It doesn’t work – code compiles fine, but the web interface doesn’t even start. I did some searching and found, that this could be a problem with stack overflow, so I’ve increased the stack:

xTaskCreate(vMyTask, "MyTask", configMINIMAL_STACK_SIZE, NULL, 1, NULL ); //original
xTaskCreate(vMyTask, "MyTask", 50000, NULL, 1, NULL ); //modified
So now the web interface displays fine, but there is no expected “123 blah blah”. And what’s more, if I go back to simple “blah blah” (no integer), it doesn’t display as well – I have to go back to configMINIMALSTACKSIZE in order for it to display. And this is where I’ve got so far. What can I do in order to make it work? I’ve seen that there is a low memory cost implementation printf-stdarg. Do I use it? How do I use it? I’m fine with any solution that allows me to convert integers (no floats in my code) into chars. I’m running the code on FreeRTOS v7.5.2 and LPC2468 – 16MB SDRAM seems plenty… Regards, George

using sprintf on LPC2468, possible stack overflow?

code compiles fine, but the web interface doesn’t even start.
If you view the contents of the mytext buffer in the debugger, does it contain the expected string?
did some searching and found, that this could be a problem with stack overflow
Enabling stack overflow protection would tell you if that was the case.
So now the web interface displays fine, but there is no expected “123 blah blah”
You have gone from a tiny stack to a massive stack in one step – is the task even being created? It won’t be unless your heap is in the 16 meg external RAM as you are trying to allocate a 195K stack on a device that has 98K or internal RAM. Checking the return value of xTaskCreate() and defining a malloc failed hook function will help you. To use printf-stdarg simply include the printf-stdarg C file in your build. Regards.

using sprintf on LPC2468, possible stack overflow?

To use printf-stdarg simply include the printf-stdarg C file in your build.
Well, that was easy. I was expecting having to make some deep changes in the project, so that was why I was asking. Anyway, it works! It’s not perfect, since I have to keep an eye on stack size, as it has a tendency to overflow, but it works! Using printf-stdarg influenced my rtos stats, which are not displaying since the sprintf function has been modified. But I think I’ll manage with restoring this functionality. Thank you for your help 🙂