Add stack_check_collision() function

This commit is contained in:
Mario Hüttel 2020-04-23 00:09:44 +02:00
parent 8df0a6c774
commit b9a38549dc

View File

@ -29,6 +29,18 @@ int32_t stack_check_get_usage();
int32_t stack_check_get_free(); int32_t stack_check_get_free();
static inline int stack_check_collision()
{
int ret = 0;
int32_t free_space = stack_check_get_free();
if ((unsigned int)free_space < STACK_CHECK_MIN_HEAP_GAP) {
ret = -1;
}
return ret;
}
static inline uint32_t read_stack_pointer() static inline uint32_t read_stack_pointer()
{ {
uint32_t stack_pointer; uint32_t stack_pointer;