How assert_param macro work
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-29 12:50 AM
Posted on May 29, 2016 at 09:50
Hi,
I m using cubemx for stacks. In files i foundassert_param is used for parameter checking. I don't understand how it is work. Here is syntax and use of that.#define assert_param(expr) ((void)0)
assert_param(IS_UART_WORD_LENGTH(huart->Init.WordLength));
what will happen in both cases like
IS_UART_WORD_LENGTH returns 0 and 1.
#printf #assert #!cubemx #cubemx #debug
Labels:
- Labels:
-
DEBUG
-
STM32CubeMX
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-05-30 4:02 AM
Posted on May 30, 2016 at 13:02
Hi hobb.epy,
assert_param is used to check that a parameter that is passed to a firmware library function is in the valid range of values. Each call to assert_param uses another macro that checks the parameter is in that range. If it is in range, then assert_param does nothing. If it is a bad value, then assert_failed is called with the filename and line number. The assert_param function is disabled by default, and can be enabled by uncommenting the correspondent macro ( for example in Hal library , in stm32fxx_hal_conf.h : /* #define USE_FULL_ASSERT 1 */ ) -Hannibal-