Skip to content

Commit

Permalink
Merge pull request #2384 from fpistm/stm32_assert
Browse files Browse the repository at this point in the history
feat: support stm32 assert
  • Loading branch information
fpistm committed May 28, 2024
2 parents 73f7d29 + 5388978 commit f69757c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cores/arduino/stm32/stm32_assert.h
Original file line number Diff line number Diff line change
@@ -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 */
2 changes: 2 additions & 0 deletions cores/arduino/stm32/stm32_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions libraries/SrcWrapper/src/stm32/stm32_def.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f69757c

Please sign in to comment.