mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-13 11:47:00 +08:00
Added MEM_LIBC_MALLOC option as workaround for failing mem_malloc().
This commit is contained in:
@@ -43,12 +43,19 @@ typedef u16_t mem_size_t;
|
||||
#define MEM_SIZE_F U16_F
|
||||
#endif /* MEM_SIZE > 64000 */
|
||||
|
||||
|
||||
#if MEM_LIBC_MALLOC
|
||||
/* aliases for C library malloc() */
|
||||
#define mem_init()
|
||||
#define mem_free(x) free(x)
|
||||
#define mem_malloc(x) malloc(x)
|
||||
#define mem_realloc(x, size) realloc(x,size)
|
||||
#else
|
||||
/* lwIP alternative malloc */
|
||||
void mem_init(void);
|
||||
|
||||
void *mem_malloc(mem_size_t size);
|
||||
void mem_free(void *mem);
|
||||
void *mem_realloc(void *mem, mem_size_t size);
|
||||
#endif
|
||||
|
||||
#ifndef MEM_ALIGN_SIZE
|
||||
#define MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
|
||||
|
||||
@@ -53,6 +53,10 @@
|
||||
#define NO_SYS 0
|
||||
#endif
|
||||
/* ---------- Memory options ---------- */
|
||||
#ifndef MEM_LIBC_MALLOC
|
||||
#define MEM_LIBC_MALLOC 0
|
||||
#endif
|
||||
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
|
||||
Reference in New Issue
Block a user