Skip to content

Commit ea583aa

Browse files
committed
DTNN-132 Update README; rm scripts
1 parent 0674914 commit ea583aa

15 files changed

+97
-435
lines changed

README.md

+97-69
Original file line numberDiff line numberDiff line change
@@ -39,99 +39,120 @@ library.
3939

4040
#### Prerequisites
4141

42-
1. The build requires the __cmake__ build system and a compiler toolchain (by default __gcc__).
42+
1. The build requires Ubuntu 22.04.4 LTS, the __cmake__ build system and a compiler toolchain (by default __gcc__).
4343

4444
Additionally, the __pkg-config__ tool is used to manage the flags required for dependencies.
4545

4646
These can typically be installed via the built-in package management system on most Linux
4747
distributions.
4848

49-
On Debian/Ubuntu and derivatives:
49+
The required packages on Ubuntu 22.04 are: cmake, pkg-config, and build-essential.
5050

51-
Note: The scripts on this page are available as example scripts in bplib/doc/example-scripts. The example scripts mimic the BPLib GitHub Actions and Workflows. The scripts have bash `trap` and `set -o pipefail` statements to help if errors occur. The names of the example scripts are used as labels here. For example `bplib/doc/example-scripts/install-toolchain` contains `install-toolchain` (part 1) and `install-toolchain` (part 2).
51+
The versions used may change. The versions as of the last update of this document are:
5252

53-
`install-toolchain` (part 1)
54-
```sh
55-
sudo apt install cmake pkg-config build-essential
56-
```
53+
- cmake version 3.22.1
54+
- pkg-config 0.29.1
55+
- gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
56+
57+
2. Install tinycbor if it is not already installed.
58+
See https://github.com/intel/tinycbor.git.
5759

58-
2. For BPv7 this uses the TinyCBOR library at https://github.com/intel/tinycbor. As any
59-
distribution-packaged version may be outdated, it is recommended to compile this from source.
60-
As of this writing, the library uses a simple Makefile that will install into `/usr/local`.
61-
This installation prefix can be changed by editing the Makefile before building. Otherwise,
62-
to install into the default location, steps are as follows:
60+
- tinycbor version 0.6.0
61+
62+
#### Build bplib with cFS
63+
3. Create a subdirectory for building bplib. Run CMake to set up the build tree. Build bplib by running __make__ in the build subdirectory:
6364

64-
`install-toolchain` (part 2)
6565
```sh
66-
git clone https://github.com/intel/tinycbor.git tinycbor-source
67-
mkdir tinycbor-staging
68-
pushd tinycbor-source
69-
make all && make DESTDIR=../tinycbor-staging install
70-
popd
71-
# Install from tinycbor-staging to /usr/local/include, lib, and bin
72-
sudo cp -rv -t / tinycbor-staging/*
66+
git clone https://github.com/nasa/cFS cfs_bundle
67+
cd ./cfs_bundle
68+
git submodule init
69+
git submodule update
70+
git clone https://github.com/nasa/bp ./apps/bp
71+
git clone https://github.com/nasa/bplib ./libs/bplib
7372
```
7473

75-
3. Setup OSAL. See `bplib/doc/example-scripts/setup-osal`.
74+
3. Setup OSAL.
7675

77-
`setup-osal`
78-
```sh
79-
cd $CFS_HOME/../cfs-bundle/osal
76+
Define the OSAL definitions for CMake.
77+
Run CMake for OSAL.
78+
Run Make for OSAL with the destination directory `./osal-staging`.
79+
80+
```
81+
cd ./cfs-bundle/osal
8082
# cmake options from .github/actions/setup-osal/action.yml
8183
CMAKE_OSAL_DEFS="-DCMAKE_INSTALL_PREFIX=/usr/local -DOSAL_SYSTEM_BSPTYPE=generic-linux "
8284
# config-options:
8385
CMAKE_OSAL_DEFS+="-DCMAKE_BUILD_TYPE=Release -DOSAL_OMIT_DEPRECATED=TRUE "
8486
CMAKE_OSAL_DEFS+="-DENABLE_UNIT_TESTS=TRUE -DOSAL_CONFIG_DEBUG_PERMISSIVE_MODE=ON "
85-
cmake $CMAKE_OSAL_DEFS -B $CFS_HOME/osal-build
86-
cd $CFS_HOME/osal-build
87-
make DESTDIR=$CFS_HOME/osal-staging install
87+
cmake $CMAKE_OSAL_DEFS -B ../osal-build
88+
cd ../osal-build
89+
make DESTDIR=../osal-staging install
8890
```
8991

90-
#### Build bplib
91-
4. Create a subdirectory for building bplib. Run CMake to set up the build tree. Build bplib by running __make__ in the build subdirectory:
92+
4. Build the test runners
9293

93-
The bplib/doc/example-scripts/cfs-env-vars may be helpful during building.
94+
Note that the possible build folders are one of <Debug/Release>-<OSAL/POSIX> for the build type and operating system layer respectively.
9495

9596
```sh
96-
export CFS_HOME=~/cfs-home
97-
export CFS_REPO=~/repos/cfs-bundle
98-
export BP_SOURCE=$CFS_REPO/apps/bp
99-
export BPLIB_SOURCE=$CFS_REPO/libs/bplib
97+
# Create the build folder based on Debug/Release and OSAL/POSIX
98+
# MATRIX_BUILD_TYPE=[Debug|Release]
99+
# MATRIX_OS_LAYER=[OSAL|POSIX]
100+
# BPLIB_SOURCE=<path-to-cfs>/libs/bplib
101+
# BPLIB_BUILD=./bplib-build-matrix-<MATRIX_BUILD_TYPE>-<MATRIX_OS_LAYER>
102+
# one of:
103+
# BPLIB_BUILD=./bplib-build-matrix-Debug-OSAL
104+
# BPLIB_BUILD=./bplib-build-matrix-Debug-POSIX
105+
# BPLIB_BUILD=./bplib-build-matrix-Release-OSAL
106+
# BPLIB_BUILD=./bplib-build-matrix-Release-POSIX
107+
108+
cmake \
109+
-DCMAKE_BUILD_TYPE="${MATRIX_BUILD_TYPE}" \
110+
-DBPLIB_OS_LAYER="${MATRIX_OS_LAYER}" \
111+
-DCMAKE_PREFIX_PATH=/usr/local/lib/cmake \
112+
-S "${BPLIB_SOURCE}" -B "${BPLIB_BUILD}"
113+
114+
# Build bplib
115+
cd "${BPLIB_BUILD}"
116+
make all
100117
```
101118

102-
The cfs-env-vars file is just an example. In practice, if ~/.profile defines CFS_HOME, then `source $CFS_HOME/cfs-env-vars` will always set the environment variables.
119+
5. Test bplib
103120

104-
CFS_REPO is the folder containing the working copy of the https://github.com/nasa/cFS repository. In this case it was cloned and initialized with:
121+
#### Example Test
122+
123+
124+
```
125+
export NasaOsal_DIR=osal-staging/usr/local/lib/cmake
126+
cd ./bplib-build-matrix-Debug-OSAL
127+
common/ut-coverage/coverage-bplib_common-testrunner
128+
```
129+
130+
#### Build bplib Stand Alone
131+
6. Create a subdirectory for building bplib.
105132

106-
`initialize-cfs-bundle`
107133
```sh
108-
source "${CFS_HOME}/cfs-env-vars"
109-
git clone https://github.com/nasa/cFS "${CFS_REPO}"
110-
cd "${CFS_REPO}"
111-
git submodule init
112-
git submodule update
113-
git clone https://github.com/nasa/bp "${BP_SOURCE}"
114-
git clone https://github.com/nasa/bpib "${BPLIB_SOURCE}"
134+
git clone https://github.com/nasa/bplib ./bplib
115135
```
116136

117-
Most of the example scripts include `cd $CFS_HOME` because the example scripts should be copied to $CFS_HOME to be run.
137+
7. Build the test runners
138+
139+
Note that the possible build folders are one of <Debug/Release>-<OSAL/POSIX> for the build type and operating system layer respectively.
118140

119-
`bplib-testdriver`
120-
See `bplib/doc/example-scripts/bplib-testdriver`.
121-
The bplib build/unit test script
122-
Excerpted from `bplib/doc/example-scripts/bplib-unit-test-functional`
123141
```sh
124142
# Create the build folder based on Debug/Release and OSAL/POSIX
125-
# MATRIX_BUILD_TYPE=[Debug|Releas]
143+
# MATRIX_BUILD_TYPE=[Debug|Release]
126144
# MATRIX_OS_LAYER=[OSAL|POSIX]
127-
# BPLIB_SOURCE=<path>/cfs/libs/bplib
128-
# BPLIB_BUILD=$CFS_HOME/bplib-build-matrix-<MATRIX_BUILD_TYPE>-<MATRIX_OS_LAYER>
145+
# BPLIB_SOURCE=<path-to-cfs>/libs/bplib
146+
# BPLIB_BUILD=./bplib-build-matrix-<MATRIX_BUILD_TYPE>-<MATRIX_OS_LAYER>
129147
# one of:
130-
# BPLIB_BUILD=$CFS_HOME/bplib-build-matrix-Debug-OSAL
131-
# BPLIB_BUILD=$CFS_HOME/bplib-build-matrix-Debug-POSIX
132-
# BPLIB_BUILD=$CFS_HOME/bplib-build-matrix-Release-OSAL
133-
# BPLIB_BUILD=$CFS_HOME/bplib-build-matrix-Release-POSIX
148+
# BPLIB_BUILD=./bplib-build-matrix-Debug-OSAL
149+
# BPLIB_BUILD=./bplib-build-matrix-Debug-POSIX
150+
# BPLIB_BUILD=./bplib-build-matrix-Release-OSAL
151+
# BPLIB_BUILD=./bplib-build-matrix-Release-POSIX
134152

153+
# Run cmake from the current directory with the CMake folder
154+
# indicated by -S "$BPLIB_SOURCE}".
155+
135156
cmake \
136157
-DCMAKE_BUILD_TYPE="${MATRIX_BUILD_TYPE}" \
137158
-DBPLIB_OS_LAYER="${MATRIX_OS_LAYER}" \
@@ -143,21 +164,28 @@ Excerpted from `bplib/doc/example-scripts/bplib-unit-test-functional`
143164
make all
144165
```
145166

146-
4. Test bplib
147-
#### Example Application
148-
149-
For those that learn better through examples, an example application is provided in the
150-
`bplib-build-matrix-Debug-POSIX/app`
151-
directory. This example program is not intended to be complete, but provides a quick way to
152-
see how to use the library. After building and installing bplib on your system, the `bpcat`
153-
program provides a functionality similar to netcat for bplib.
167+
8. Test bplib stand alone
154168

155-
test-bpcat (not in example-scripts)
156-
```sh
157-
cd $CFS_HOME/bplib-build-matrix-Debug-POSIX/app # Must be POSIX.
169+
The example program `bpcat` is available in the bplib stand alone build
158170

159-
mkdir storage
160-
./bpcat -l ipn://101.1 -r ipn://201.1
171+
```
172+
$ ./bplib-build-matrix-Debug-POSIX/app/bpcat --help
173+
Usage: ./bplib-build-matrix-Debug-POSIX/app/bpcat [options]
174+
-l/--local-addr=ipn://<node>.<service> local address to use
175+
-r/--remote-addr=ipn://<node>.<service> remote address to use
176+
-i/--input-file=<filename> read input from given file instead of stdin
177+
-o/--output-file=<filename> write output to given file instead of stdout
178+
--local-cla-uri=udp://<ip>:<port> Bind local CLA to given IP:port
179+
--remote-cla-uri=udp://<ip>:<port> Send bundles to remote CLA at given IP:port
180+
-d/--delay=<msec> forced inter bundle send delay (20ms default)
181+
-s/--adu-size=stream chunk (ADU) size to pass to bplib (default and max=15864 bytes)
182+
183+
Creates a local BP agent with local IPN address as specified. All data
184+
received from standard input is forwarded over BP bundles, and all data
185+
received from bundles is forwarded to standard output.
186+
187+
Example:
188+
./bplib-build-matrix-Debug-POSIX/app/bpcat -l ipn://101.1 -r ipn://201.1
161189
```
162190

163191
----------------------------------------------------------------------

doc/example-scripts/README.md

-39
This file was deleted.

doc/example-scripts/bplib-clean

-27
This file was deleted.

doc/example-scripts/bplib-test-driver

-26
This file was deleted.

doc/example-scripts/bplib-unit-test-functional

-60
This file was deleted.

doc/example-scripts/cfs-env-vars

-4
This file was deleted.

doc/example-scripts/initialize-cfs-bundle

-14
This file was deleted.

0 commit comments

Comments
 (0)