[PATCH rtems-lwip v2] lwip.py: Build BSD compatibility as part of lwIP

Kinsey Moore kinsey.moore at oarcorp.com
Fri Aug 26 21:03:56 UTC 2022


Include the BSD compatibility functions as part of lwIP to be provided
to consumers of this network stack and install the headers so they can
be compiled against.
---
 lwip.py                                     | 7 ++++++-
 rtemslwip/bsd_compat/rtems-kernel-program.c | 5 +----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lwip.py b/lwip.py
index 70c9471..4767910 100644
--- a/lwip.py
+++ b/lwip.py
@@ -68,6 +68,8 @@ def build(bld):
     common_includes = './lwip/src/include ./uLan/ports/os/rtems ./rtemslwip/include '
     driver_source = []
     drv_incl = ' '
+    bsd_compat_sources = ["rtemslwip/bsd_compat/netdb.c", "rtemslwip/bsd_compat/ifaddrs.c", "rtemslwip/bsd_compat/rtems-kernel-program.c"]
+    bsd_compat_incl = './rtemslwip/bsd_compat_include '
 
     arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
                                             bld.env.RTEMS_ARCH_BSP)
@@ -81,6 +83,7 @@ def build(bld):
     source_files.append('./rtemslwip/common/syslog.c')
     source_files.append('./rtemslwip/common/rtems_lwip_io.c')
     source_files.append('./rtemslwip/common/network_compat.c')
+    source_files.extend(bsd_compat_sources)
 
     def walk_sources(path):
         sources = []
@@ -155,7 +158,9 @@ def build(bld):
                     bld.install_files("${PREFIX}/" + arch_lib_path + "/include/" + subpath,
                         os.path.join(path,name))
 
-    [install_headers(path) for path in (drv_incl + common_includes).split(' ')[:-1]]
+    [install_headers(path) for path in common_includes.split(' ')[:-1]]
+    [install_headers(path) for path in drv_incl.split(' ')[:-1]]
+    [install_headers(path) for path in bsd_compat_incl.split(' ')[:-1]]
 
     bld.program(features='c',
                 target='networking01.exe',
diff --git a/rtemslwip/bsd_compat/rtems-kernel-program.c b/rtemslwip/bsd_compat/rtems-kernel-program.c
index ae80e51..6dd8028 100644
--- a/rtemslwip/bsd_compat/rtems-kernel-program.c
+++ b/rtemslwip/bsd_compat/rtems-kernel-program.c
@@ -30,10 +30,7 @@
 #include <sys/types.h>
 #include <sys/kernel.h>
 
-#undef printf
-#define RTEMS_BSD_PROGRAM_NO_STRDUP_WRAP
-#define RTEMS_BSD_PROGRAM_NO_STRNDUP_WRAP
-#include <machine/rtems-bsd-program.h>
+#include <stdio.h>
 
 #include <rtems/extension.h>
 #include <rtems/score/percpu.h>
-- 
2.30.2



More information about the devel mailing list