[PATCH rtems-lwip v2 1/6] lwip.py: Add compile flags

Kinsey Moore kinsey.moore at oarcorp.com
Wed Aug 24 15:47:26 UTC 2022


This alters rtems-lwip to follow the RTEMS convention of compiling with
function sections for linking optimization and dead code removal.
---
 lwip.py | 10 ++++++++++
 wscript |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lwip.py b/lwip.py
index f565deb..d235e95 100644
--- a/lwip.py
+++ b/lwip.py
@@ -173,3 +173,13 @@ 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):
+    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