[PATCH rtems-lwip v1 1/8] lwip.py: Add library and compile flags

Kinsey Moore kinsey.moore at oarcorp.com
Tue Aug 23 19:47:34 UTC 2022


This allows linking with libm and follows the RTEMS convention of
compiling with function sections for linking optimization and dead code
removal.
---
 lwip.py | 11 +++++++++++
 wscript |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lwip.py b/lwip.py
index f565deb..b97d273 100644
--- a/lwip.py
+++ b/lwip.py
@@ -173,3 +173,14 @@ def build(bld):
                 use='telnetd lwip rtemstest ftpd',
                 cflags='-g -Wall -O0',
                 includes=drv_incl + common_includes + './rtemslwip/test/ ' + os.path.relpath(os.path.join(arch_lib_path,'include')))
+
+def add_flags(flags, new_flags):
+    for flag in new_flags:
+        if flag not in flags:
+            flags.append(flag)
+
+def bsp_configure(conf, arch_bsp):
+    conf.env.LIB += ['m']
+    section_flags = ["-fdata-sections", "-ffunction-sections"]
+    add_flags(conf.env.CFLAGS, section_flags)
+    add_flags(conf.env.CXXFLAGS, section_flags)
diff --git a/wscript b/wscript
index 0393e8c..1546a3d 100644
--- a/wscript
+++ b/wscript
@@ -49,7 +49,7 @@ def options(opt):
 
 
 def configure(conf):
-    rtems.configure(conf)
+    rtems.configure(conf, lwip.bsp_configure)
 
 
 def build(bld):
-- 
2.30.2



More information about the devel mailing list