[RSB 5 PATCH 3/3] rtems/bsps: Optionally support arch/bsp if used

chrisj at rtems.org chrisj at rtems.org
Fri Sep 30 07:15:15 UTC 2022


From: Chris Johns <chrisj at rtems.org>

Updates #4717
---
 rtems/config/rtems-bsp.cfg | 55 ++++++++++++++++++++++++++++----------
 1 file changed, 41 insertions(+), 14 deletions(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index 801cd5c..af9ad3d 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -39,6 +39,44 @@
 %{pkgconfig crosscompile yes}
 %{pkgconfig filter-flags yes}
 
+#
+# We need a BSP from the user.
+#
+%ifn %{defined with_rtems_bsp}
+ %if %{rtems_bsp_error}
+  %error No RTEMS BSP specified: --with-rtems-bsp=bsp
+ %endif
+ %define with_rtems_bsp sparc/erc32
+%endif
+%define rtems_bsp %{with_rtems_bsp}
+
+#
+# If the BSP(s) have a '/' it is the arch/bsp notation.
+#
+%define is_arch_bsp %(echo %{rtems_bsp} | sed -e 's/.*\/.*/yes/g')
+%if %{is_arch_bsp} == yes
+ %define rtems_ab_bsps \
+          %(x=''; \
+	    for b in %{rtems_bsp}; do x="$x "$(echo $b | sed -e 's/.*\///g'); done; \
+	    echo $x)
+ %define rtems_ab_archs  \
+          %(x=''; \
+	    for b in %{rtems_bsp}; do x="$x "$(echo $b | sed -e 's/\/.*//g'); done; \
+	    echo $x | tr ' ' '\n' | sort | uniq)
+ %define rtems_arch_count %(echo %{rtems_ab_archs} | tr ' ' '\n' | wc -l)
+ %if %{rtems_arch_count} != 1
+  %error Invalid BSP architecture count
+ %endif
+ %define rtems_bsp    %{rtems_ab_bsps}
+ %define rtems_target %{rtems_ab_archs}-rtems%{rtems_version}
+ %define rtems_host   %{rtems_target}
+%endif
+
+%define rtems_bsp_count %(echo %{rtems_bsp} | tr ' ' '\n' | wc -l)
+%if %{rtems_bsp_count} != 1
+  %error Building packages with more than one BSP is not supported
+%endif
+
 #
 # We need a host from the user to specifiy the RTEMS architecture and major
 # version. It can be defined in rtems_host.
@@ -52,17 +90,6 @@
  %endif
 %endif
 
-#
-# We need a BSP from the user.
-#
-%ifn %{defined with_rtems_bsp}
- %if %{rtems_bsp_error}
-  %error No RTEMS BSP specified: --with-rtems-bsp=bsp
- %endif
- %define with_rtems_bsp sparc/erc32
-%endif
-%define rtems_bsp %{with_rtems_bsp}
-
 #
 # If no tools or RTEMS provided use the prefix. If staging use the staging
 # root.
@@ -215,14 +242,14 @@
 #
 # Note: default BSP flags include the standard RTEMS libraries.
 #
-%define rtems-dep-check %(%{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc}
+%define rtems-dep-check %{_sbdir}/sb/rtems-build-dep -c %{with_tools}/bin/%{rtems_bsp_cc}
 
-%define rtems-libbsd %{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a)
+%define rtems-libbsd %(%{rtems-dep-check} -L %{rtems_bsp_libpath} -l libbsd.a)
 %if %{rtems-libbsd} == found
  %define rtems_bsp_libs %{rtems_bsp_libs} -lbsd -lm -lz
 %endif
 
-%define rtems-defaultconfig %{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a)
+%define rtems-defaultconfig %(%{rtems-dep-check} -L %{rtems_bsp_libpath} -l librtemsdefaultconfig.a)
 %if %{rtems-defaultconfig} == found
  %define rtems_bsp_libs %{rtems_bsp_libs} -lrtemsdefaultconfig
 %endif
-- 
2.37.1



More information about the devel mailing list