Tool/software: Code Composer Studio
Hello,
for debugging purposes, I'd like to use printf() with the SCI2. To make debugging more comfortable to use, you suggested to implement an sci_printf() function:
the function sci_prinf(). But if I try to use this, the Controller crashs at the vsnprintf() part with an "dataEntry" Interrupt. I tried to increase the stack+heap, but no differences.
this is my main function.
int sbcMain(void)
{
sciInit();
gioInit();
gioSetBit(gioPORTB, 6, gioGetBit(gioPORTB, 6) ^ 1);
//works
uint8* text = "sciDisplayTest ";
sciDisplayText(sciREG1, text, sizeof(text));
//this is crashing with ... b dataEntry
sci_printf("Test %d", 42);
if (xTaskCreate(vTaskHeartbeat, "vTaskHeartbeat", configMINIMAL_STACK_SIZE,
NULL,
1, &xTask1Handle) != pdTRUE)
{
/* Task could not be created */
while (1)
;
}
if (xTaskCreate(vTask1, "Task1", configMINIMAL_STACK_SIZE, NULL, 1,
&xTask2Handle) != pdTRUE)
{
/* Task could not be created */
while (1)
;
}
vTaskStartScheduler();
while (42)
;
return 0;
}
int sci_printf(const char *_format, ...)
{
char str[128];
int length = -1;
va_list argList;
va_start(argList, _format);
// length = snprintf(str, sizeof(str), _format, argList);
length = vsnprintf(str, sizeof(str), _format, argList);
va_end(argList);
if (length > 0)
{
sciSend(sciREG1, (unsigned) length, (unsigned char*) str);
}
}
Could you give any hints for debugging this, please?