- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
sprintf causes code to hang during simulation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-05-2010 10:46 AM
When I try using the sprintf() function in my code the processor doesn't get past this command. Here's the command I'm using...
while (format[percent_search] && arg_counter < MAX_ARGS)
{
if (special_character)
{
special_character = FALSE;
}
else
{
switch (format[percent_search])
{
case '%':
args[arg_counter++] = va_arg(arg_list, uint_32);
break;
case '\\':
special_character = TRUE;
break;
};
} /* if (special_character) */
percent_search++;
} /* while */
va_end(arg_list);
/* Create final string to send */
sprintf(out_str, format, args[0],
args[1],
args[2],
args[3],
args[4],
args[5],
args[6],
args[7],
args[8],
args[9],
args[10]);
Has anyone out there had any problem with the sprintf() function? Any ideas on what would cause this problem?
Solved! Go to Solution.
Re: sprintf causes code to hang during simulation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-09-2012 04:13 PM
I got the same issue.
You have to use Microblaze library, my_sprintf(), defined in xil_printf.c like below:
/*------------------------------------------------
//
// This is the start of the file for other *printf functions
// that are used in the embedded system. For some reason,
// the standard printf functions provided in the Xilinx
// library do not seem to work.
//
int my_sprintf(char *buff, char *fmt, ... )
{
va_list ap;
int length;
va_start(ap, fmt);
length = xil_vsprintf(buff, fmt, ap);
va_end(ap);
return (length);
}











