Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support stm32 assert #2384

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading