diff --git a/inc/stdlib.h b/inc/stdlib.h index 9969bfa..5549f73 100644 --- a/inc/stdlib.h +++ b/inc/stdlib.h @@ -26,6 +26,18 @@ #endif +#ifdef _RTLIBC_MALLOC_FREERTOS_ + +#define malloc_init() +#define msize() (0) + +#define malloc(size) pvPortMalloc(size) +#define free(ptr) vPortFree(ptr) + +#endif + + + uint64_t strtoul(const char *str, char **endptr, int32_t base); int64_t strtol(const char *str, char **endptr, int32_t base); diff --git a/readme.txt b/readme.txt index a6168ea..16232a6 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,6 @@ To enable asserts define _RTLIBC_ASSERT_ +To enable RTLIBC malloc() define _RTLIBC_MALLOC_ +To enable FreeRTOS malloc() define _RTLIBC_MALLOC_FREERTOS_ The following functions are weak and can be defined by the user: