Skip to content

Commit f69757c

Browse files
authored
Merge pull request #2384 from fpistm/stm32_assert
feat: support stm32 assert
2 parents 73f7d29 + 5388978 commit f69757c

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Diff for: 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 */

Diff for: cores/arduino/stm32/stm32_def.h

+2
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ void SystemClock_Config(void);
133133
#if !defined(_Error_Handler)
134134
#define _Error_Handler(str, value) \
135135
while (1) {\
136+
(void)str;\
137+
(void)value;\
136138
}
137139
#endif
138140
#if !defined(Error_Handler)

Diff for: 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)