Re: [PATCH rtems-lwip] wscript: Allow deeper lwIP configuration

2022-11-11 Thread Vijay Kumar Banerjee
This is great! This makes it more adaptable with different BSPS. Also,
thanks for the documentation. :)

On Fri, Nov 11, 2022 at 3:03 PM Kinsey Moore  wrote:
>
> This adds a basic configuration mechanism in config.ini to control which
> BSPs are enabled and to alter lwIP's define/macro-based configuration
> directives. Existing builds using --rtems-bsps are unaffected if
> config.ini is not used.
> ---
>  README  | 14 ++
>  wscript | 60 -
>  2 files changed, 73 insertions(+), 1 deletion(-)
>
> diff --git a/README b/README
> index 99800bf..a8cbc21 100644
> --- a/README
> +++ b/README
> @@ -30,3 +30,17 @@ git submodule update
>
>  More `waf` arguments can be found by using:
>  `./waf --help`
> +
> +Further Build Information
> +-
> +
> +The BSPs configured to build may be specified on the waf configure command 
> line
> +with --rtems-bsps or they may be configured in config.ini as in RTEMS. The
> +command line option will override the BSPs configured in config.ini, but 
> options
> +in config.ini will still be applied for enabled BSPs. Any additional
> +configuration options desired in lwipopts.h may be specified in config.ini 
> under
> +the appropriate section as key/value pairs like so:
> +
> +[aarch64/xilinx_zynqmp_lp64_zu3eg]
> +LWIP_IGMP=1
> +ZYNQMP_USE_SGMII=1
> diff --git a/wscript b/wscript
> index 1546a3d..f1b919e 100644
> --- a/wscript
> +++ b/wscript
> @@ -1,3 +1,5 @@
> +#!/usr/bin/env python
> +
>  #
>  # RTEMS Project (https://www.rtems.org/)
>  #
> @@ -28,7 +30,13 @@
>  from __future__ import print_function
>  from rtems_waf import rtems
>
> +try:
> +import configparser
> +except:
> +import ConfigParser as configparser
> +
>  import lwip
> +import os
>  import sys
>  top = '.'
>
> @@ -48,8 +56,58 @@ def options(opt):
>  rtems.options(opt)
>
>
> +def no_unicode(value):
> +if sys.version_info[0] > 2:
> +return value
> +if isinstance(value, unicode):
> +return str(value)
> +return value
> +
> +
> +def get_config():
> +cp = configparser.ConfigParser()
> +filename = "config.ini"
> +if filename not in cp.read([filename]):
> +return None
> +return cp
> +
> +
> +def get_configured_bsps(cp):
> +if not cp:
> +return "all"
> +bsps = []
> +for raw_bsp in cp.sections():
> +bsps.append(no_unicode(raw_bsp))
> +return ",".join(bsps)
> +
> +
> +def get_configured_bsp_options(cp, arch, bsp):
> +if not cp:
> +return {}
> +options = {}
> +for config_option in cp.items(os.path.join(arch, bsp)):
> +opt_name = config_option[0].upper()
> +options[opt_name] = config_option[1]
> +return options
> +
> +
> +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)
> +lwip.bsp_configure(conf, arch_bsp)
> +
> +
>  def configure(conf):
> -rtems.configure(conf, lwip.bsp_configure)
> +cp = get_config()
> +if conf.options.rtems_bsps == "all":
> +conf.options.rtems_bsps = get_configured_bsps(cp)
> +rtems.configure(conf, bsp_configure)
>
>
>  def build(bld):
> --
> 2.30.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-lwip] wscript: Allow deeper lwIP configuration

2022-11-11 Thread Kinsey Moore
This adds a basic configuration mechanism in config.ini to control which
BSPs are enabled and to alter lwIP's define/macro-based configuration
directives. Existing builds using --rtems-bsps are unaffected if
config.ini is not used.
---
 README  | 14 ++
 wscript | 60 -
 2 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/README b/README
index 99800bf..a8cbc21 100644
--- a/README
+++ b/README
@@ -30,3 +30,17 @@ git submodule update
 
 More `waf` arguments can be found by using:
 `./waf --help`
+
+Further Build Information
+-
+
+The BSPs configured to build may be specified on the waf configure command line
+with --rtems-bsps or they may be configured in config.ini as in RTEMS. The
+command line option will override the BSPs configured in config.ini, but 
options
+in config.ini will still be applied for enabled BSPs. Any additional
+configuration options desired in lwipopts.h may be specified in config.ini 
under
+the appropriate section as key/value pairs like so:
+
+[aarch64/xilinx_zynqmp_lp64_zu3eg]
+LWIP_IGMP=1
+ZYNQMP_USE_SGMII=1
diff --git a/wscript b/wscript
index 1546a3d..f1b919e 100644
--- a/wscript
+++ b/wscript
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
 #
 # RTEMS Project (https://www.rtems.org/)
 #
@@ -28,7 +30,13 @@
 from __future__ import print_function
 from rtems_waf import rtems
 
+try:
+import configparser
+except:
+import ConfigParser as configparser
+
 import lwip
+import os
 import sys
 top = '.'
 
@@ -48,8 +56,58 @@ def options(opt):
 rtems.options(opt)
 
 
+def no_unicode(value):
+if sys.version_info[0] > 2:
+return value
+if isinstance(value, unicode):
+return str(value)
+return value
+
+
+def get_config():
+cp = configparser.ConfigParser()
+filename = "config.ini"
+if filename not in cp.read([filename]):
+return None
+return cp
+
+
+def get_configured_bsps(cp):
+if not cp:
+return "all"
+bsps = []
+for raw_bsp in cp.sections():
+bsps.append(no_unicode(raw_bsp))
+return ",".join(bsps)
+
+
+def get_configured_bsp_options(cp, arch, bsp):
+if not cp:
+return {}
+options = {}
+for config_option in cp.items(os.path.join(arch, bsp)):
+opt_name = config_option[0].upper()
+options[opt_name] = config_option[1]
+return options
+
+
+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)
+lwip.bsp_configure(conf, arch_bsp)
+
+
 def configure(conf):
-rtems.configure(conf, lwip.bsp_configure)
+cp = get_config()
+if conf.options.rtems_bsps == "all":
+conf.options.rtems_bsps = get_configured_bsps(cp)
+rtems.configure(conf, bsp_configure)
 
 
 def build(bld):
-- 
2.30.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-lwip] zynqmp: Add support for the CFC-400X BSP

2022-11-11 Thread Vijay Kumar Banerjee
Looks great. It only affects the Zynqmp.

Thanks.

On Thu, Nov 10, 2022 at 2:23 PM Kinsey Moore  wrote:
>
> This adds support for the CFC-400X BSP including an option to select
> SGMII instead of the default RGMII PHY interface and adds a way for
> ZynqMP BSPs to provide additional configuration via lwipbspopts.h.
> ---
>  .../aarch64/xilinx_zynqmp_lp64_cfc400x.json   | 11 
>  .../contrib/ports/xilinx/netif/xemacpsif_hw.c |  6 ++
>  rtemslwip/zynqmp/lwipopts.h   |  2 +
>  rtemslwip/zynqmp_cfc400x/lwipbspopts.h| 33 ++
>  rtemslwip/zynqmp_cfc400x/netstart.c   | 66 +++
>  rtemslwip/zynqmp_hardware/lwipbspopts.h   |  1 +
>  rtemslwip/zynqmp_qemu/lwipbspopts.h   |  1 +
>  7 files changed, 120 insertions(+)
>  create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json
>  create mode 100644 rtemslwip/zynqmp_cfc400x/lwipbspopts.h
>  create mode 100644 rtemslwip/zynqmp_cfc400x/netstart.c
>  create mode 100644 rtemslwip/zynqmp_hardware/lwipbspopts.h
>  create mode 100644 rtemslwip/zynqmp_qemu/lwipbspopts.h
>
> diff --git a/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json 
> b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json
> new file mode 100644
> index 000..5fe676c
> --- /dev/null
> +++ b/defs/bsps/aarch64/xilinx_zynqmp_lp64_cfc400x.json
> @@ -0,0 +1,11 @@
> +{
> +   "includes": [
> +   "xilinx_zynqmp_base"
> +   ],
> +   "header-paths-to-import": [
> +   "rtemslwip/zynqmp_cfc400x"
> +   ],
> +   "source-paths-to-import": [
> +   "rtemslwip/zynqmp_cfc400x"
> +   ]
> +}
> diff --git 
> a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c
>  
> b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c
> index a1fdeda..f0ddf84 100644
> --- 
> a/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c
> +++ 
> b/embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xemacpsif_hw.c
> @@ -74,6 +74,12 @@ void init_emacps(xemacpsif_s *xemacps, struct netif *netif)
>
> xemacpsp = >emacps;
>
> +#ifdef __rtems__
> +#ifdef ZYNQMP_USE_SGMII
> +   XEmacPs_SetOptions(xemacpsp, XEMACPS_SGMII_ENABLE_OPTION);
> +#endif
> +#endif
> +
>  #ifdef ZYNQMP_USE_JUMBO
> XEmacPs_SetOptions(xemacpsp, XEMACPS_JUMBO_ENABLE_OPTION);
>  #endif
> diff --git a/rtemslwip/zynqmp/lwipopts.h b/rtemslwip/zynqmp/lwipopts.h
> index b9fe277..feabe73 100644
> --- a/rtemslwip/zynqmp/lwipopts.h
> +++ b/rtemslwip/zynqmp/lwipopts.h
> @@ -123,4 +123,6 @@
>  #define portTICK_RATE_MS ( rtems_clock_get_ticks_per_second() * 1000 )
>  #define vTaskDelay( x ) sys_arch_delay( x )
>
> +#include 
> +
>  #endif /* __LWIPOPTS_H__ */
> diff --git a/rtemslwip/zynqmp_cfc400x/lwipbspopts.h 
> b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h
> new file mode 100644
> index 000..27eb6a9
> --- /dev/null
> +++ b/rtemslwip/zynqmp_cfc400x/lwipbspopts.h
> @@ -0,0 +1,33 @@
> +/*
> + * Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
> + * Written by Kinsey Moore 
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *notice, this list of conditions and the following disclaimer in the
> + *documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
> IS"
> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> + * POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +#ifndef RTEMSLWIP_LWIPBSPOPTS_H
> +#define RTEMSLWIP_LWIPBSPOPTS_H
> +
> +/* Use SGMII mode for all interfaces on the CFC-400X */
> +#define ZYNQMP_USE_SGMII
> +
> +#endif /* RTEMSLWIP_LWIPBSPOPTS_H */
> diff --git a/rtemslwip/zynqmp_cfc400x/netstart.c 
> b/rtemslwip/zynqmp_cfc400x/netstart.c
> new file mode 100644
> index 000..d19b36c
> --- /dev/null
> +++ b/rtemslwip/zynqmp_cfc400x/netstart.c
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (C) 2022 On-Line Applications 

Re: [rtems-docs commit] Update build system related sections for RTEMS 6

2022-11-11 Thread Chris Johns
On 11/11/22 6:39 pm, Sebastian Huber wrote:
> On 10/11/2022 01:30, Chris Johns wrote:
>> The first is the maintenance of embedded the version numbers in the
>> documentation. If we can avoid doing that the work per release or dot release
>> is less.
> 
> We could use a simple search and replace for this. Searching for 'rtems[0-9]'
> shows a couple of spots which need a more through rework. We even have stuff
> with rtems4.10.

That may work for some places but I found it useful to review the documentation
at the same time given things may have changed. In the end I am not fussed how
we make the change. :)

>> The second is the changing of `kernel` to `src`. The use of `kernel` was
>> specific because it removes any ambiguity when a new user attempts to build a
>> package like libbsd in the same tree. Source can mean it is the place where
>> all source is placed. I think `kernel` should be used and returned.
> 
> I usually place all Git repositories in a "src" directory.

Is there a per repo directory under src? I am fine with that. The important
point is having a consistent arrangement that can be used when building other
things like libbsd or the examples without needing to delete or change anything.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel