mini-os: build fixes for lwip 1.3.2
PATCH 1/1 mini-os: build fixes for lwip 1.3.2
From: David Vrabel <[email protected]>
Various fixes to mini-os needed to build lwip 1.3.2:
- Don't build the tests.
- Endianness macros #defined in arch/cc.h.
- free() is called via a function pointer so it needs to be a real function.
Signed-off-by David Vrabel <[email protected]>
--- extras/mini-os/Makefile | 2 +- extras/mini-os/README | 2 +- extras/mini-os/include/arch/cc.h | 4 ++++ extras/mini-os/include/xmalloc.h | 3 ++- extras/mini-os/lib/xmalloc.c | 5 +++++ 5 files changed, 13 insertions(+), 3 deletions(-)
extras/mini-os/Makefile +1 -1
@@ -136,7 +136,7 @@ arch_lib: ifeq ($(CONFIG_LWIP),y) # lwIP library -LWC := $(shell find $(LWIPDIR)/ -type f -name '*.c') +LWC := $(shell find $(LWIPDIR)/src -type f -name '*.c') LWC := $(filter-out %6.c %ip6_addr.c %ethernetif.c, $(LWC)) LWO := $(patsubst %.c,%.o,$(LWC)) LWO += $(OBJ_DIR)/lwip-arch.o
extras/mini-os/README +1 -1
@@ -19,7 +19,7 @@ This includes: - to build it just type make. -- to build it with TCP/IP support, download LWIP 1.3 source code and type +- to build it with TCP/IP support, download LWIP 1.3.2 source code and type make LWIPDIR=/path/to/lwip/source
extras/mini-os/include/arch/cc.h +4 -0
@@ -63,6 +63,10 @@ extern void lwip_die(char *fmt, ...);#include <endian.h> #endif +#define BYTE_ORDER __BYTE_ORDER +#define BIG_ENDIAN __BIG_ENDIAN +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#include <inttypes.h> #define S16_F PRIi16#define U16_F PRIu16
extras/mini-os/include/xmalloc.h +2 -1
@@ -15,9 +15,10 @@#define DEFAULT_ALIGN (sizeof(unsigned long))#define malloc (size) _xmalloc(size, DEFAULT_ALIGN) -#define free (ptr) xfree(ptr)#define realloc (ptr, size) _realloc(ptr, size) +extern void free (void *ptr); +/* Free any of the above. */ extern void xfree (const void *);
extras/mini-os/lib/xmalloc.c +5 -0
@@ -296,6 +296,11 @@ void *_realloc(void *ptr, size_t size) return new; } + +void free (void *ptr) +{ +xfree (ptr); +}#endif /*
Signature · 1 line
1.7.2.5
Quoted 1 line · David Vrabel, le Mon 28 Jan 2013 15:39:12 +0000, a écrit :
- Endianness macros #defined in
arch/cc.h.
These should rather go to endian.h, I guess lwip would be able to find them there, shouldn't it?
Quoted 2 lines
-
free()is called via a function pointer so it needs to be a real function.
For coherency, could you do the same with malloc and realloc?
Quoted 3 lines
#define malloc(size)
_xmalloc(size, DEFAULT_ALIGN)
-#define free(ptr) xfree(ptr)
#definerealloc(ptr, size)_realloc(ptr, size)
Samuel