diff --git a/cores/arduino/stm32/stm32_assert.h b/cores/arduino/stm32/stm32_assert.h new file mode 100644 index 0000000000..275dc3d536 --- /dev/null +++ b/cores/arduino/stm32/stm32_assert.h @@ -0,0 +1,10 @@ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef STM32_ASSERT_H +#define STM32_ASSERT_H + +/* + * Header file required by LL layer but as USE_HAL_DRIVER is defined + * assert definitions are provided by stm32yyxx_hal_conf_default + */ + +#endif /* STM32_ASSERT_H */ diff --git a/cores/arduino/stm32/stm32_def.h b/cores/arduino/stm32/stm32_def.h index 00113faa89..f77538e4a7 100644 --- a/cores/arduino/stm32/stm32_def.h +++ b/cores/arduino/stm32/stm32_def.h @@ -133,6 +133,8 @@ void SystemClock_Config(void); #if !defined(_Error_Handler) #define _Error_Handler(str, value) \ while (1) {\ + (void)str;\ + (void)value;\ } #endif #if !defined(Error_Handler) diff --git a/libraries/SrcWrapper/src/stm32/stm32_def.c b/libraries/SrcWrapper/src/stm32/stm32_def.c index 1ea4fa6c82..3c12041914 100644 --- a/libraries/SrcWrapper/src/stm32/stm32_def.c +++ b/libraries/SrcWrapper/src/stm32/stm32_def.c @@ -20,6 +20,20 @@ WEAK void _Error_Handler(const char *msg, int val) } #endif +#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 + */ +WEAK void assert_failed(uint8_t *file, uint32_t line) +{ + _Error_Handler((const char *)file, line); +} +#endif /* USE_FULL_ASSERT */ + #ifdef __cplusplus } #endif