libsbp
v2.4.7
|
The libsbp source and release tarballs are available from GitHub, https://github.com/swift-nav/libsbp.
The latest development version of libsbp can be cloned from GitHub using the following command:
$ git clone git://github.com/swift-nav/libsbp.git
Libsbp is intended to have very few dependencies, to facilitate use in embedded environments. It has no runtime dependencies outside of the C standard library. The only build dependencies are the CMake build system and pkg-config.
On Debian-based systems (including Ubuntu 12.10 or later) you can get them with:
$ sudo apt-get install build-essential pkg-config cmake
On other systems, you can obtain CMake from your operating system package manager or from http://www.cmake.org/.
Once you have the dependencies installed, navigate to the libsbp root directory and create a build directory where the library will be built.
$ cd libsbp/c/ $ mkdir build $ cd build
First invoke CMake to configure the build.
$ cmake ../
Once the build has been configured you can build the source and install it as follows.
$ make $ sudo make install
By default libsbp will be built both as a shared library libsbp
and a static library libsbp-static
.
The latest version of the libsbp documentation should be available online at http://docs.swift-nav.com/libsbp/. The documentation iteself is built using Doxygen (http://www.doxygen.org)
To build the documentation, from inside your build directory run:
$ make docs
The compiled documentation will placed in build/docs/html
.
libsbp was designed from the ground up to be portable and with a view to being run on embedded systems. It should be easy to cross-compile for any target with a standards compliant C compiler.
To cross-compile we need to provide CMake with a few details about our cross-compilation toolchain. We achieve this with a toolchain file. For more details about toolchain files and how to prepare your own, see http://www.cmake.org/Wiki/CMake_Cross_Compiling.
Here we will walk through a cross-compilation for a Cortex-M4 microcontroller using the included toolchain file for the gcc-arm-embedded toolchain (https://launchpad.net/gcc-arm-embedded).
First make a build folder for our target, this can co-exist alongside a native build folder.
$ mkdir build_cm4 $ cd build_cm4
Then configure our build using CMake, specifying the toolchain file we are using.
$ cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-arm-embedded.cmake ../
Then we can build the source in the usual way.
$ make
If you wish you can install the library to your toolchain environment, this must be configured correctly in the toolchain file. For the included gcc-arm-embedded toolchain file this should work correctly.
$ make install
If your target environment does not support shared libraries then you should specify not to build shared libraries in your toolchain file as follows.
set(BUILD_SHARED_LIBS OFF)
When cross-compiling the generated libraries will have a suffix of the target processor name, e.g. libsbp-static-cortex-m4.a
.