summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2023-04-19 06:29:57 +1000
committerKinseyMoore <48726349+KinseyMoore@users.noreply.github.com>2023-04-18 15:51:39 -0500
commit0750bed60e8232d317d709087531f7cd26c63325 (patch)
treee1abe446a04c1a927425ae6d791713cb9468efc8
parentlwip: Restore build and break out adapter source (diff)
downloadrtems-net-services-0750bed60e8232d317d709087531f7cd26c63325.tar.bz2
legacy: Build fixes
-rw-r--r--netservices.py28
-rw-r--r--stack/legacy/net_adapter.c36
-rw-r--r--ttcp/ttcp.c7
3 files changed, 52 insertions, 19 deletions
diff --git a/netservices.py b/netservices.py
index 27154e9..1876de4 100644
--- a/netservices.py
+++ b/netservices.py
@@ -55,6 +55,7 @@ def check_net_lib(conf, lib, name):
ldflags=['-lrtemsdefaultconfig'],
uselib_store=net_name, mandatory=False)
if 'LIB_' + net_name in conf.env:
+ conf.env['LDFLAGS_' + net_name] = []
conf.env.STACK_NAME = name
return True
return False
@@ -77,9 +78,10 @@ def bsp_configure(conf, arch_bsp):
if stack_count != 1:
conf.fatal('More than one networking stack found')
+
def build(bld):
stack_name = bld.env.STACK_NAME
-
+ stack_use = 'NET_' + stack_name.upper()
stack_def = 'RTEMS_NET_' + stack_name.upper()
stack_root = 'stack/' + stack_name
stack_inc = str(bld.path.find_node(stack_root + '/include'))
@@ -107,7 +109,7 @@ def build(bld):
includes=ntp_incl + [stack_inc + '/ntp'],
cflags=ns_cflags,
defines=[stack_def, 'HAVE_CONFIG_H=1'],
- use=[stack_name])
+ use=[stack_use])
bld.install_files("${PREFIX}/" + arch_lib_path, ["libntp.a"])
ttcp_incl = [stack_inc, stack_common_inc, 'ttcp/include']
@@ -120,7 +122,7 @@ def build(bld):
includes=ttcp_incl,
cflags=ns_cflags,
defines=[stack_def],
- use=[stack_name])
+ use=[stack_use])
bld.install_files("${PREFIX}/" + arch_lib_path, ["libttcp.a"])
def install_headers(root_path):
@@ -141,17 +143,11 @@ def build(bld):
[install_headers(path) for path in ntp_incl]
- # bring in knowledge of libraries from the installed BSP
- lib_path = os.path.join(bld.env.PREFIX, arch_lib_path)
- bld.read_stlib(stack_name, paths=[lib_path])
- bld.read_stlib('rtemstest', paths=[lib_path])
- bld.read_stlib('telnetd', paths=[lib_path])
-
- libs = ['m', 'rtemstest']
+ libs = ['rtemstest']
ntp_test_incl = ntp_incl + ['testsuites', stack_common_inc]
- ntp_test_sources = ['testsuites/ntp01/test_main.c']
- ntp_test_sources += [stack_adapter_source]
+ ntp_test_sources = ['testsuites/ntp01/test_main.c',
+ stack_adapter_source]
bld.program(features='c',
target='ntp01.exe',
@@ -160,7 +156,7 @@ def build(bld):
includes=ntp_test_incl,
defines=[stack_def],
lib=libs,
- use=['ntp', stack_name])
+ use=['ntp', stack_use])
ttcp_test_incl = ttcp_incl + ['testsuites', stack_common_inc]
ttcp_test_sources = ['testsuites/ttcpshell01/test_main.c']
@@ -173,7 +169,7 @@ def build(bld):
defines=[stack_def],
includes=ttcp_test_incl,
lib=libs,
- use=['ttcp', stack_name])
+ use=['ttcp', stack_use])
tlnt_test_incl = [stack_inc, stack_common_inc, 'testsuites']
tlnt_test_sources = ['testsuites/telnetd01/init.c']
@@ -185,5 +181,5 @@ def build(bld):
cflags=ns_cflags,
defines=[stack_def],
includes=tlnt_test_incl,
- lib=libs,
- use=['telnetd', stack_name])
+ lib=['telnetd'] + libs,
+ use=[stack_use])
diff --git a/stack/legacy/net_adapter.c b/stack/legacy/net_adapter.c
new file mode 100644
index 0000000..f1cf221
--- /dev/null
+++ b/stack/legacy/net_adapter.c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief This file contains the adapter necessary for network services tests to
+ * run on lwIP.
+ */
+
+/*
+ * Copyright (c) 2023. Chris Johns (chris@contemporary.software)
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include <net_adapter.h>
diff --git a/ttcp/ttcp.c b/ttcp/ttcp.c
index ae358d0..4add3fc 100644
--- a/ttcp/ttcp.c
+++ b/ttcp/ttcp.c
@@ -54,7 +54,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
-#ifndef __rtems__
+#ifndef RTEMS_NET_LWIP
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
@@ -67,13 +67,14 @@
#define __need_getopt_newlib
#include <getopt.h>
#include <rtems/shell.h>
+#endif /* __rtems__ */
+
#if RTEMS_NET_LWIP
#include <lwip/inet.h>
#include <lwip/netdb.h>
-#endif
#undef TCP_NODELAY
#define select lwip_select
-#endif
+#endif /* RTEMS_NET_LWIP */
#if defined(ENABLE_NANOSLEEP_DELAY)
#include <time.h>