Skip to main content
Min-Kyoung Kim
Associate III
May 10, 2019
Question

Why doesn't "While" work after adding "-u_printf_float"?

  • May 10, 2019
  • 1 reply
  • 963 views

I tried to use "sprintf" printing float value.

So I added "-u_printf_float" on the Miscellaneous->Linker flags.

(-specs=nosys.specs -specs=nano.specs -u_printf_float) <- like this

After that, my code doesn't run "while".

Did I use the wrong way?

++ Using stm32L4

++ Tool Chain : Ac6 STM32 MCU GCC

++ Code

while{
 sprintf((char*)debugmsgbuf, "gx : %.3f gy : %.3f gz : %.3f ax : %.3f ay : %.3f az : %.3f\r\n",gx, gy, gz, ax, ay, az);
 
 create_debugmsgNull((char*)debugmsgbuf);
}
 
 
void create_debugmsgNull(char* msg)
{
	uint32_t i, j;
	char* ptr;
 
	i = 0;
	ptr = msg;
	j = debugindexWrite;
	while(*ptr != '\0') debugmsg[j][i++] = *ptr++;
 
	debugmsglength[j] = i;
	j++;
	if(j >= DEBUGMSG_CUELENGTH) j = 0;
	debugindexWrite = j;
}

This topic has been closed for replies.

1 reply

Ozone
Principal
May 10, 2019

There is no code below.

Information about the MCU and the used toolchain would be helpful, too.

Perhaps a stack overflow.

Min-Kyoung Kim
Associate III
May 13, 2019

Thank you for the reply.

I edited my post.

Thank you

Tesla DeLorean
Guru
May 13, 2019

Syntax of while looks wrong. So what happens when executing? Ends up in Hard Fault? FPU enabled?​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..