This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

building problem


I am a started for Keil uvision5 and also the embbeded software. Now I have a problem with the builing under uvision5.
The project is created following the normal procedure, and the main.c file is used from the standard examples of STmicroelctronics,

\STM32F10x_StdPeriph_Examples\GPIO\IOToggle

But when I building the project, many of the indentifiers are reported as indecleard, seems the header file "STM32F10x_gpio.h" is not included sucessfully to the project. But in the main.c file, the header file "stm32f10x.h" is included. That is quite strange. Could anyboday can help me? Thanks in advance!

Here is the main.c file.

/**
  ******************************************************************************
  * @file    GPIO/IOToggle/main.c
  * @author  MCD Application Team
  * @version V3.5.0
  * @date    08-April-2011
  * @brief   Main program body.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
//#include "stm32_eval.h"

/** @addtogroup STM32F10x_StdPeriph_Examples
  * @{
  */

/** @addtogroup GPIO_IOToggle
  * @{
  */

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;

/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured,
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */

  /* GPIOD Periph clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);

  /* Configure PD0 and PD2 in output pushpull mode */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_2;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOD, &GPIO_InitStructure);

  /* To achieve GPIO toggling maximum frequency, the following  sequence is mandatory.
     You can monitor PD0 or PD2 on the scope to measure the output signal.
     If you need to fine tune this frequency, you can add more GPIO set/reset
     cycles to minimize more the infinite loop timing.
     This code needs to be compiled with high speed optimization option.  */
  while (1)
  {
    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;

    /* Set PD0 and PD2 */
    GPIOD->BSRR = 0x00000005;
    /* Reset PD0 and PD2 */
    GPIOD->BRR  = 0x00000005;
  }
}

#ifdef  USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}

#endif

/**
  * @}
  */

/**
  * @}
  */

/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

Parents
  • So - have you been a developer yet and spent some time looking at the used include file?

    State of USE_STDPERIPH_DRIVER?

    And existence of stm32f10x_conf.h with suitable content?

    You have two options - let everything be black magic, or take a closer look at how the example programs manages to do what they do.

Reply
  • So - have you been a developer yet and spent some time looking at the used include file?

    State of USE_STDPERIPH_DRIVER?

    And existence of stm32f10x_conf.h with suitable content?

    You have two options - let everything be black magic, or take a closer look at how the example programs manages to do what they do.

Children
  • No, I am a starter/learner for embeeded sofware and also the uvision5 toolset. Normaly I work as a hardware developer. But I am very interested in software and eager to learn it quickly.

    To use the USE_STDPERIPH_DRIVER, in my perception the only thing I need to do is to enable the relevant items under the "Manage Run-Time Environment --> Device -->stdPeriph Drivers", and to include the "stm32f10x.h" in my source code. But appraently you have different ideas.

    I am glad to take a closer look at the example programs, the example programs you mentioned here are the ones of pack examples in uvision5?

    And in this particular case, you also suggest me to take a look at the content of stm32f10x_conf.h?

  • With your reminding and after reading the stm32f10x.h file, I tried to add "#define USE_STDPERIPH_DRIVER" in my main.c file, now it solves the include problem, but the last errors are about the "assert_param", the detailed error messages are listed below, still keeping looking into this, but it will be better if you could inspire me a little.


    Rebuild target 'Target 1'
    compiling main.c...
    compiling misc.c...
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(99): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_PRIORITY_GROUP(NVIC_PriorityGroup));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(117): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NVIC_InitStruct->NVIC_IRQChannelCmd));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(159): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_VECTTAB(NVIC_VectTab));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(178): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_NVIC_LP(LowPowerMode));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c(202): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\misc.c: 5 warnings, 0 errors
    compiling stm32f10x_gpio.c...
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(111): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(178): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(286): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(308): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(324): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(346): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c(361): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_gpio.c

    ....

    assert_param(IS_FUNCTIONAL_STATE(NewState));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(882): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_RTCCLK_SOURCE(RCC_RTCCLKSource));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(896): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1067): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_AHB_PERIPH(RCC_AHBPeriph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1098): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1129): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1156): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_AHB_PERIPH_RESET(RCC_AHBPeriph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1188): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1219): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1240): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1253): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_FUNCTIONAL_STATE(NewState));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1285): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_MCO(RCC_MCO));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1332): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_FLAG(RCC_FLAG));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1406): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_GET_IT(RCC_IT));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c(1451): warning: #223-D: function "assert_param" declared implicitly assert_param(IS_RCC_CLEAR_IT(RCC_IT));
    C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.0.5\Device\StdPeriph_Driver\src\stm32f10x_rcc.c: 36 warnings, 0 errors
    assembling startup_stm32f10x_cl.s...
    compiling system_stm32f10x.c...
    linking...
    .\IO_Toggle.axf: Error: L6218E: Undefined symbol assert_param (referred from misc.o).
    Not enough information to list image symbols.
    Finished: 1 information, 0 warning and 1 error messages.
    ".\IO_Toggle.axf" - 1 Error(s), 57 Warning(s).
    Target not created


  • I think I find a mehtod to fix this problem,

    to define USE_STDPERIPH_DRIVER in Options->C/C++->preprocessor Symboles

    Thank you anyway for the time.