skullc-peripherals/Utility/Inc/utility_assert.hpp
Erki 82f62d1650
All checks were successful
continuous-integration/drone/push Build is passing
Initial commit
2021-09-19 15:42:37 +03:00

41 lines
736 B
C++

/*
* utility_assert.hpp
*
* Created on: Jun 25, 2021
* Author: erki
*/
#ifndef UTILITY_INC_UTILITY_ASSERT_HPP_
#define UTILITY_INC_UTILITY_ASSERT_HPP_
#ifdef __cplusplus
extern "C" {
#endif
__attribute__((weak)) void SkullC_AssertHandler(const char* file, int line, const char* func, const char* failed_expr)
{
}
void __assert_func(const char* file, int line, const char* func, const char* failed_expr)
{
#ifdef SKULLC_UTILITY_ASSERT_TO_ERRORHANDLER
Error_Handler();
#else
__disable_irq();
__asm("bkpt");
#ifdef SKULLC_UTILITY_ASSERT_CUSTOM_HANDLER
SkullC_AssertHandler(file, line, func, failed_expr);
#endif
while (1)
;
#endif
}
#ifdef __cplusplus
}
#endif
#endif /* UTILITY_INC_UTILITY_ASSERT_HPP_ */