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:
Krishna Mohan Dani 2021-06-15 16:55:51 +05:30 committed by Anas Nashif
commit 4e53248ffa
2 changed files with 22 additions and 0 deletions

View file

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

View file

@ -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 */