asserts: stm32: Adding asserts
This commit adds the asserts symbol in Kconfig to enable/disable asserts functionality for stm32 series. These would be used in stm32cube hal & ll drivers. Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
This commit is contained in:
parent
bde592e91a
commit
4e53248ffa
2 changed files with 22 additions and 0 deletions
|
@ -15,3 +15,9 @@ config STM32_BACKUP_SRAM
|
|||
SOC_SERIES_STM32F7X || SOC_SERIES_STM32H7X
|
||||
help
|
||||
Enable support for STM32 backup SRAM.
|
||||
|
||||
config USE_STM32_ASSERT
|
||||
depends on ASSERT
|
||||
bool "STM32Cube HAL and LL drivers asserts"
|
||||
help
|
||||
Enable asserts in STM32Cube HAL and LL drivers.
|
||||
|
|
|
@ -35,3 +35,19 @@ void HAL_Delay(__IO uint32_t Delay)
|
|||
{
|
||||
k_msleep(Delay);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USE_STM32_ASSERT
|
||||
/**
|
||||
* @brief Generates an assert on STM32Cube HAL/LL assert trigger.
|
||||
* @param file: specifies the file name where assert expression failed.
|
||||
* @param line: specifies the line number where assert expression failed.
|
||||
* @return None
|
||||
*/
|
||||
void assert_failed(uint8_t *file, uint32_t line)
|
||||
{
|
||||
/* Assert condition have been verified at Cube level, force
|
||||
* generation here.
|
||||
*/
|
||||
__ASSERT(false, "Invalid value line %d @ %s\n", line, file);
|
||||
}
|
||||
#endif /* CONFIG_USE_STM32_ASSERT */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue