NUCLEO-STM32F767 debugging using Keil printf undefined

Thread Starter

zazas321

Joined Nov 29, 2015
936
Hello. I have bought this nucleo board and learning c programming. I am using internal st link to program the microcontroller. However, right off the bat I have noticed that I am not able to use printf function to output something. Do I need to modify the project settings to allow that or the internal st link is not capable of that?

I have generated project using CubeMX and imported to keil
1592640612697.png
 
Last edited:

Thread Starter

zazas321

Joined Nov 29, 2015
936
No I didint have but I did now. Same thing though.

I have tried to compile the stm32cubemx example code for usart_printf and that works. I am just not sure how they have implemented it

1592669974610.png
 
Last edited:

Thread Starter

zazas321

Joined Nov 29, 2015
936
UPDATE:

I have managed to get printf working on Keil by adding these functions to the code:

struct __FILE
{
int handle;
/* Whatever you require here. If the only file you are using is */
/* standard output using printf() for debugging, no file handling */
/* is required. */
};
/* FILE is typedef�d in stdio.h. */
FILE __stdout;

int ferror(FILE *f)
{
/* Your implementation of ferror(). */
return 0;
}

void test(void)
{
printf("Hello world\n");
}


int fputc(int ch, FILE *f)
{
/* Place your implementation of fputc here */
/* e.g. write a character to the USART1 and Loop until the end of transmission */
HAL_UART_Transmit(&huart3, (uint8_t *)&ch, 1, 0xFFFF);

return ch;
}



However, I have also tried to execute the same code using Stm32cubeIDE and the printf on that is not working. It is not executing putc or _write functions just skips through
 

Thread Starter

zazas321

Joined Nov 29, 2015
936
I am using Nucleo stm32f767 board
Hello. I have generated project cubemx project and compiling using cubeIDE. I am trying to printf something but I have noticed that the printf does not work. I have tried to step into the printf function to see where it goes but it just skips through and does not go anywhere. I was expecting the syscalls.c funcion _write to be executed but if I place breakpoint there I can see that it never executes. Did anyone else encounter this behaviour?
my main.c :
1592759382302.png

syscalls.c :
1592759399893.png
 
Top