AnsweredAssumed Answered

Problem example USART_Printf for Nucleo stm32f411re

Question asked by nicky on Aug 10, 2015
Latest reply on Aug 10, 2015 by nicky
Hello everyone !! I have a Nucleo-F411RE and use IAR with STM32F4 DSP and standard peripherals library . I did not understand how to run the following example
FW_STM32F3_F4_ST\STM32F4xx_DSP_StdPeriph_Lib_V1.5.1\Project\STM32F4xx_StdPeriph_Examples\USART\USART_Printf with IAR and NUCLEO-F411RE

#include "main.h"
#include <stdio.h>
#include <string.h>

static void USART_Config(void);

#ifdef __GNUC__
  #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
  #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif

static void USART_Config(void)
{
  USART_InitTypeDef USART_InitStructure;
  USART_InitStructure.USART_BaudRate = 115200;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  STM_EVAL_COMInit(COM1, &USART_InitStructure);
}

int main(void)
{
  USART_Config();
  printf("\n\rUSART Printf Example: retarget the C library printf function to the USART\n\r");
  while (1)
  {

  }
}

PUTCHAR_PROTOTYPE
{
 USART_SendData(EVAL_COM1, (uint8_t) ch);
  while (USART_GetFlagStatus(EVAL_COM1, USART_FLAG_TC) == RESET)
  {}
  return ch;
}

#ifdef  USE_FULL_ASSERT

void assert_failed(uint8_t* file, uint32_t line)
{
   while (1)
  {
  }
}
#endif

I get by iar:

Error[Pe020]: identifier "STM_EVAL_COMInit" is undefined FW_STM32F3_F4_ST\STM32F4xx_DSP_StdPeriph_Lib_V1.5.1\Project\STM32F4xx_StdPeriph_USART\main.c 62

Error[Pe020]: identifier "COM1" is undefined FW_STM32F3_F4_ST\STM32F4xx_DSP_StdPeriph_Lib_V1.5.1\Project\STM32F4xx_StdPeriph_USART\main.c 62

Error[Pe020]: identifier "EVAL_COM1" is undefined FW_STM32F3_F4_ST\STM32F4xx_DSP_StdPeriph_Lib_V1.5.1\Project\STM32F4xx_StdPeriph_USART\main.c 99

Error while running C/C++ Compiler 

How can I solve this problem?

Outcomes