cancel
Showing results for 
Search instead for 
Did you mean: 

compiling twoo many syscalls.c ?

T J
Lead
Posted on June 03, 2018 at 09:10

There is syscalls.c in the Project folder generated by the cube

and in the project path, I have syscalls.c in nano libraries.

I want to sprintf with floating point, that's why I included the nano library

Trying without nano..

it compiles now...

totally clean build from the cube:

I added this into main.c and it compiles:

      printf('asd %f', 1.34);

but where does it print to ?

(Hoping to have my PCB by Tuesday for testing

:(

)

#compiler #nano
1 REPLY 1
john doe
Lead
Posted on June 03, 2018 at 13:16

I didnt think nano did floating point.  quite the opposite - i have to remove it from the options in order to print fp.

>but where does it print to ?

where are you telling it to print to?

I put this in my function prototypes user code area:

#ifdef __GNUC__

#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)

#else

#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)

#endif /* __GNUC__ */

and i put this in user code 4 area:

PUTCHAR_PROTOTYPE

{

  /* Place your implementation of fputc here */

  /* e.g. write a character to the USART2 and Loop until the end of transmission */

  HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFF);

  return ch;

}

the nucleo boards all seem to have the stlink on uart2, but my f769i discovery board has it on uart1.  check the manual.