Chinaunix首页 | 论坛 | 博客
  • 博客访问: 160026
  • 博文数量: 20
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 120
  • 用 户 组: 普通用户
  • 注册时间: 2015-03-27 15:17
文章分类

全部博文(20)

文章存档

2016年(1)

2015年(19)

我的朋友

分类: C/C++

2015-04-22 22:30:00




Well within ST's model the assert_failed() normally gets added in main.c if USE_FULL_ASSERT is defined within the project, which might be done in stm32f30x_conf.h which also defines a void macro. Suggest you review some of the project templates ST supplies with it's libraries.

STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\MDK-ARM\Project.uvproj

USE_STDPERIPH_DRIVER STM32F30X USE_STM32303C_EVAL

STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\main.c

..
#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
..

STM32F30x_DSP_StdPeriph_Lib_V1.0.0\Project\STM32F30x_StdPeriph_Templates\stm32f30x_conf.h

..
/* Uncomment the line below to expanse the "assert_param" macro in the
   Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT    1 */

/* Exported macro ------------------------------------------------------------*/
#ifdef  USE_FULL_ASSERT

/**
  * @brief  The assert_param macro is used for function's parameters check.
  * @param  expr: If expr is false, it calls assert_failed function which reports
  *         the name of the source file and the source line number of the call
  *         that failed. If expr is true, it returns no value.
  * @retval None
  */
  #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
  void assert_failed(uint8_t* file, uint32_t line);
#else
  #define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
..
阅读(4428) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~