Skip to content

Commit 000dad7

Browse files
committed
feat: support stm32 assert
Fixes #2375. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 73f7d29 commit 000dad7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

cores/arduino/stm32/stm32_assert.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Define to prevent recursive inclusion -------------------------------------*/
2+
#ifndef STM32_ASSERT_H
3+
#define STM32_ASSERT_H
4+
5+
/*
6+
* Header file required by LL layer but as USE_HAL_DRIVER is defined
7+
* assert definitions are provided by stm32yyxx_hal_conf_default
8+
*/
9+
10+
#endif /* STM32_ASSERT_H */

libraries/SrcWrapper/src/stm32/stm32_def.c

+14
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ WEAK void _Error_Handler(const char *msg, int val)
2020
}
2121
#endif
2222

23+
#ifdef USE_FULL_ASSERT
24+
/**
25+
* @brief Reports the name of the source file and the source line number
26+
* where the assert_param error has occurred.
27+
* @param file: pointer to the source file name
28+
* @param line: assert_param error line source number
29+
* @retval None
30+
*/
31+
WEAK void assert_failed(uint8_t *file, uint32_t line)
32+
{
33+
_Error_Handler((const char *)file, line);
34+
}
35+
#endif /* USE_FULL_ASSERT */
36+
2337
#ifdef __cplusplus
2438
}
2539
#endif

0 commit comments

Comments
 (0)