[PATCH rtems-lwip] wscript: Build a header instead of using -D

Kinsey Moore kinsey.moore at oarcorp.com
Tue Mar 28 00:51:07 UTC 2023


On Mon, Mar 27, 2023 at 7:46 PM Chris Johns <chrisj at rtems.org> wrote:

> On 28/3/2023 2:28 am, Kinsey Moore wrote:
> > This change moves the use of items configured in config.ini from using
> > -D to set defines on the command line to using a header built by waf.
> > This also resolves an issue where configuration parameters were bleeding
> > between BSPs when multiple BSPs were configured.
> > ---
> >  rtemslwip/beaglebone/lwipopts.h |  2 ++
> >  rtemslwip/zynqmp/lwipopts.h     |  2 ++
> >  wscript                         | 19 ++++++++++++++++---
> >  3 files changed, 20 insertions(+), 3 deletions(-)
> >
> > diff --git a/rtemslwip/beaglebone/lwipopts.h
> b/rtemslwip/beaglebone/lwipopts.h
> > index 888fae4..71ddd9f 100644
> > --- a/rtemslwip/beaglebone/lwipopts.h
> > +++ b/rtemslwip/beaglebone/lwipopts.h
> > @@ -117,6 +117,8 @@
> >  #ifndef __LWIPOPTS_H__
> >  #define __LWIPOPTS_H__
> >
> > +#include <configuredlwipbspopts.h>
> > +
> >
> /*****************************************************************************
> >  **                           CONFIGURATIONS
> >
> *****************************************************************************/
> > diff --git a/rtemslwip/zynqmp/lwipopts.h b/rtemslwip/zynqmp/lwipopts.h
> > index feabe73..d1b7334 100644
> > --- a/rtemslwip/zynqmp/lwipopts.h
> > +++ b/rtemslwip/zynqmp/lwipopts.h
> > @@ -27,6 +27,8 @@
> >  #ifndef __LWIPOPTS_H__
> >  #define __LWIPOPTS_H__
> >
> > +#include <configuredlwipbspopts.h>
>
> What about something simpler like `lwip-config.h`?
>

I'll simplify it to that. This needs a v2 anyway due to a different issue.

>
> What include "zynqmp/lwipopts.h"? Sorry I do not know the lwip directory
> structure. Is this by arch or a -I trick to allow just lwipopts.h?
>
> lwipopts.h is included directly by lwIP code and the target is selected by
varying include paths based on BSP as configured by the JSON files under
defs/. Eventually, all BSPs will use the same lwipopts.h and bsp-specific
variations will be introduced by this configuration generated file and the
existing BSP-specific include.


> > +
> >  #define SYS_LIGHTWEIGHT_PROT 1
> >
> >  #define NO_SYS 0
> > diff --git a/wscript b/wscript
> > index f1b919e..5e30279 100644
> > --- a/wscript
> > +++ b/wscript
> > @@ -91,15 +91,23 @@ def get_configured_bsp_options(cp, arch, bsp):
> >      return options
> >
> >
> > +bsp_opts_target = "bsps/include/configuredlwipbspopts.h"
> > +
> > +
> >  def bsp_configure(conf, arch_bsp):
> >      cp = get_config()
> >      arch = rtems.arch(arch_bsp)
> >      bsp = rtems.bsp(arch_bsp)
> >      config_options = get_configured_bsp_options(cp, arch, bsp)
> >      for key, val in config_options.items():
> > -        flag = "-D"+key+"="+val
> > -        conf.env.CFLAGS.append(flag)
> > -        conf.env.CXXFLAGS.append(flag)
> > +        conf.define(key, val, quote=False)
> > +    conf.env.include_key = []
> > +    conf.write_config_header(
> > +        arch_bsp + "/" + bsp_opts_target,
>
> Is this a file name? If so should it be a bld.path.??? node?
>

This is based on how RTEMS generates its bspopts.h. I'll see if I can clean
it up a bit.

Thanks for the review!

Kinsey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20230327/878cb22a/attachment-0001.htm>


More information about the devel mailing list