#define ASSERT2(x, help) ((void)ASSERT(x))
#endif
+ #define IS_VALID_PTR(p) (LIKELY((void *)(p) >= (void *)CPU_RAM_START))
/**
* Check that the given pointer is either NULL or pointing to valid memory.
*
*
* \see ASSERT_VALID_PTR_OR_NULL()
*/
- #define ASSERT_VALID_PTR(p) ((void)(LIKELY((void *)(p) >= (void *)CPU_RAM_START) \
- ? 0 : __invalid_ptr(p, #p, THIS_FILE, __LINE__)))
+ #define ASSERT_VALID_PTR(p) (IS_VALID_PTR(p) \
+ ? 0 : __invalid_ptr(p, #p, THIS_FILE, __LINE__))
/**
* Check that the given pointer is not pointing to invalid memory.
#define ASSERT(x) ((void)0)
#endif /* ASSERT */
#define ASSERT2(x, help) ((void)0)
+ #define IS_VALID_PTR(p) (1)
#define ASSERT_VALID_PTR(p) ((void)0)
#define ASSERT_VALID_PTR_OR_NULL(p) ((void)0)
#define ASSERT_VALID_OBJ(_t, _o) ((void)0)
#else // CONFIG_KERN_HEAP
/* Stack must have been provided by the user */
- ASSERT_VALID_PTR(stack_base);
- ASSERT(stack_size);
+ ASSERT2(IS_VALID_PTR(stack_base), "Invalid stack pointer. Did you forget to \
+ enable CONFIG_KERN_HEAP?");
+ ASSERT2(stack_size, "Stack size cannot be 0.");
#endif // CONFIG_KERN_HEAP