2019-05-10 12:50 AM
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;
}
2019-05-10 01:17 AM
There is no code below.
Information about the MCU and the used toolchain would be helpful, too.
Perhaps a stack overflow.
2019-05-12 08:31 PM
Thank you for the reply.
I edited my post.
Thank you
2019-05-12 11:03 PM
Syntax of while looks wrong. So what happens when executing? Ends up in Hard Fault? FPU enabled?
2019-05-12 11:42 PM
i tried to check what kind of fault occurred.
But i can't find any fault.
I check like this below. (all faults check done)
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
USART1->TDR = 'H';
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_HardFault_IRQn 0 */
/* USER CODE END W1_HardFault_IRQn 0 */
}
}
When I erase "-u_printf_float" on Linker flags, It works!
But I can't use float values..