STM32F30xx Standard Peripheral Library
...
#define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG)
== PWR_FLAG_SB))
If the expression passed to the assert_param macro is false, the assert_failed function is
called and returns the name of the source file and the source line number of the call that
failed. If the expression is true, no value is returned.
The assert_param macro is implemented in stm32f30x_conf.h:
/* 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 */
The assert_failed function is implemented in the main.c file or in any other user C file:
#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 */
printf("\n\r Wrong parameter value detected on\r\n");
printf(" file %s\r\n", file);
printf(" line %d\r\n", line);
/* Infinite loop */
while (1)
{
}
}
#endif /* USE_FULL_ASSERT */
Because of the overhead it introduces, it is recommended to use run-time checking during
application code development and debugging, and to remove it from the final application to
improve code size and speed.