From 40ae1f4e25d6aff805f2f5eb7b662dbbd4d3979b Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Thu, 12 Feb 2026 03:46:40 -0300 Subject: [PATCH] refactor: move lwIP port headers from src/net/lwip_port/ to include/net/ Moved lwipopts.h and arch/cc.h to include/net/ where they belong alongside other public headers. Updated Makefile include path from -Isrc/net/lwip_port to -Iinclude/net. Also fixed cc.h to use arch-conditional BYTE_ORDER instead of hardcoding x86 little-endian, supporting ARM, RISC-V, and MIPS targets. --- Makefile | 2 +- {src/net/lwip_port => include/net}/arch/cc.h | 8 +++++++- {src/net/lwip_port => include/net}/lwipopts.h | 0 3 files changed, 8 insertions(+), 2 deletions(-) rename {src/net/lwip_port => include/net}/arch/cc.h (75%) rename {src/net/lwip_port => include/net}/lwipopts.h (100%) diff --git a/Makefile b/Makefile index a12f42c..76d1edc 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ ifeq ($(ARCH),x86) C_SOURCES += $(NET_SOURCES) # Mandatory Architecture Flags - ARCH_CFLAGS := -m32 -ffreestanding -fno-builtin -U_FORTIFY_SOURCE -Iinclude -Isrc/net/lwip_port -Ithird_party/lwip/src/include + ARCH_CFLAGS := -m32 -ffreestanding -fno-builtin -U_FORTIFY_SOURCE -Iinclude -Iinclude/net -Ithird_party/lwip/src/include ARCH_LDFLAGS := -m elf_i386 -T $(SRC_DIR)/arch/x86/linker.ld ARCH_ASFLAGS := --32 diff --git a/src/net/lwip_port/arch/cc.h b/include/net/arch/cc.h similarity index 75% rename from src/net/lwip_port/arch/cc.h rename to include/net/arch/cc.h index 3b5070a..26cea98 100644 --- a/src/net/lwip_port/arch/cc.h +++ b/include/net/arch/cc.h @@ -4,8 +4,14 @@ #include #include -/* Define byte order for x86 (little-endian) */ +/* Define byte order based on target architecture */ +#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv) #define BYTE_ORDER LITTLE_ENDIAN +#elif defined(__MIPSEB__) || defined(__ARMEB__) +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* Use GCC-style struct packing */ #define PACK_STRUCT_FIELD(x) x diff --git a/src/net/lwip_port/lwipopts.h b/include/net/lwipopts.h similarity index 100% rename from src/net/lwip_port/lwipopts.h rename to include/net/lwipopts.h -- 2.43.0