Skip to content

Commit 8a9b628

Browse files
thelunaticKinseyMoore
authored andcommitted
Initial Commit
This adds the rtems-waf submodule, minimal build infrastructure, and testsuite support files.
0 parents  commit 8a9b628

9 files changed

+647
-0
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
__pycache__
2+
.lock-waf*
3+
.waf*
4+
build/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "rtems_waf"]
2+
path = rtems_waf
3+
url = git://git.rtems.org/rtems_waf.git

README

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Overview
2+
--------
3+
4+
The rtems-net-services repository serves as a central location to manage
5+
libraries and tests that require network support, but can otherwise be shared
6+
across multiple network stacks.
7+
8+
File Origins
9+
------------
10+
11+
The sources presented here originate in one of several locations described by
12+
the ORIGIN.* files and whose license is described by the COPYING.* files.
13+
Commits adding such files should include the hash of the target repository if
14+
applicable.
15+
16+
Installation Instructions
17+
-------------------------
18+
1. Populate the git submodules:
19+
20+
```
21+
git submodule init
22+
git submodule update
23+
```
24+
2. Configure and build
25+
```
26+
./waf configure --prefix=INSTALL_PREFIX
27+
./waf
28+
./waf install
29+
```
30+
31+
More `waf` arguments can be found by using:
32+
`./waf --help`

netservices.py

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# SPDX-License-Identifier: BSD-2-Clause
2+
3+
# Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
4+
# Written by Kinsey Moore <kinsey.moore@oarcorp.com>
5+
#
6+
# Redistribution and use in source and binary forms, with or without
7+
# modification, are permitted provided that the following conditions
8+
# are met:
9+
# 1. Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# 2. Redistributions in binary form must reproduce the above copyright
12+
# notice, this list of conditions and the following disclaimer in the
13+
# documentation and/or other materials provided with the distribution.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
# POSSIBILITY OF SUCH DAMAGE.
26+
27+
from rtems_waf import rtems
28+
import json
29+
import os
30+
31+
32+
def removeprefix(data, prefix):
33+
if data.startswith(prefix):
34+
return data[len(prefix):]
35+
return data
36+
37+
38+
def build(bld):
39+
40+
arch_lib_path = rtems.arch_bsp_lib_path(bld.env.RTEMS_VERSION,
41+
bld.env.RTEMS_ARCH_BSP)
42+
43+
def install_headers(root_path):
44+
for root, dirs, files in os.walk(root_path):
45+
for name in files:
46+
ext = os.path.splitext(name)[1]
47+
src_root = os.path.split(root)
48+
path = os.path.join(src_root[0], src_root[1])
49+
if ext == '.h':
50+
subpath = removeprefix(removeprefix(path, root_path), "/")
51+
bld.install_files(
52+
os.path.join("${PREFIX}",
53+
arch_lib_path,
54+
"include",
55+
subpath),
56+
os.path.join(path, name)
57+
)
58+
59+
lib_path = os.path.join(bld.env.PREFIX, arch_lib_path)
60+
bld.read_stlib('lwip', paths=[lib_path])
61+
bld.read_stlib('rtemstest', paths=[lib_path])
62+
63+
64+
def add_flags(flags, new_flags):
65+
for flag in new_flags:
66+
if flag not in flags:
67+
flags.append(flag)
68+
69+
70+
def bsp_configure(conf, arch_bsp):
71+
conf.env.LIB += ['m']
72+
section_flags = ["-fdata-sections", "-ffunction-sections"]
73+
add_flags(conf.env.CFLAGS, section_flags)
74+
add_flags(conf.env.CXXFLAGS, section_flags)

rtems_waf

Submodule rtems_waf added at 1a118bb

testsuites/buffer_test_io.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Support for running the test output through a buffer
3+
*/
4+
5+
#ifndef __BUFFER_TEST_IO_h
6+
#define __BUFFER_TEST_IO_h
7+
8+
#include <rtems/test-info.h>
9+
10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
14+
#define TEST_BEGIN() rtems_test_begin(rtems_test_name, TEST_STATE)
15+
#define TEST_END() rtems_test_end(rtems_test_name)
16+
17+
#ifdef __cplusplus
18+
};
19+
#endif
20+
21+
#endif

0 commit comments

Comments
 (0)