This document discusses C++ development for marine streamer positioning and navigation. It covers Western Geco's seismic acquisition technologies and services. It then discusses the technical challenges of high data volume and power constraints for physically long streamers. The document proposes using C++ on resource-constrained embedded systems by building a custom GCC toolchain and employing techniques like disabling exceptions and RTTI, limiting standard library usage, and using a custom heap allocator. It emphasizes the benefits of vendor independence and full source code control.
C++ for Marine Streamer Positioning and Navigation - ACCU 2011
1. C++ for Marine Streamer
Positioning & Navigation
Mike Long
Schlumberger Western Geco
2. Our Technologies and Services
Schlumberger Information Western Geco
Solutions
Drilling &
Measurements
Data & Consulting
Services
Reservoir
Management Reservoir
Characterization
Integrated
Project Wireline
Management
Reservoir
Production
Artificial Lift Well Testing
Completions Well Services
3. Western Geco : Seismic acquistion
You Tube - marine seismic acquisition
6. Western Geco : Technical Challenges
Data Volume
Tens of thousands of sensors
acquiring real time data (+ranging
and status)
Power
Physically long streamers
Cost
Proprietary hardware systems
Custom chip development
7. C++ On a Shoestring
Building a gcc cross compile toolchain
for the Stellaris LM3S8962 Cortex-M3
8. Topics
What is a toolchain and how to
choose one?
Building your own gcc cross
compile toolchain.
Stacks & Heaps: Linker Scripts
Programming and On-chip
debugging
The time before "int main()"
C++ on a diet
Testable Embedded C++
12. How to choose a toolchain
Step 0, surveying the options:
Are there any options?
Paid or Free?
Are you paying for the compiler or for support?
Does the compiler require a license?
Step 1: what is the lifetime of the product/target?
Projects with a limited shelf life don't need to be too
concerned about source availability
Extended life products will benefit from source
availability
13. How to choose a toolchain
Given that we make long-lived products, source availability
is desirable. So: are there any companies providing
toolchains?
14. How to choose a toolchain
Given that we make long-lived products, source availability
is desirable. So: are there any companies providing
toolchains?
15. How to choose a toolchain
Given that we make long-lived products, source availability
is desirable. So: are there any companies providing
toolchains?
+ Up and running quickly
+ Tested and supported
- Proprietary startup code and libraries
- Licence management
16. How to choose a toolchain
Build from source:
Some companies provide a "lite" gcc toolchain for free with
full source.
Some popular targets already have a gcc cross compiler out
of the box.
If you are really lucky it might even be part of your
distribution:
#sudo apt-get install gcc-arm-linux-gnueabi qemu-kvm-extras
If you are particularly masochistic you can build each
component from the sources and independently verify each
component and the dependencies (not for the faint of heart).
Or you can use a toolchain builder (like crosstool-NG)
18. Crosstool-NG
crosstool-NG is a tool to build cross-toolchains
Kernel-like menuconfig interface
Large number of supported architectures
uClibc-, glibc- or eglibc-based toolchain supported
Can create toolchains that target linux and bare-metal
Supports both soft- and hard- float toolchains
Debug facilities (native and cross gdb, gdbserver)
Watch out though, the default configuration for cortex-
m3 doesn't enable gdb. Remember to adjust the config!
19. Crosstool-NG
#install crosstool-ng
bzip2 -d crosstool-ng-1.8.1.tar.bz2
tar -xf crosstool-ng-1.8.1.tar
cd crosstool-ng-1.8.1/
sudo apt-get install awk
sudo apt-get install gawk
sudo apt-get install bison
sudo apt-get install flex
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install libncurses-dev
sudo apt-get install zlib1g-dev
./configure
make
sudo make install
mkdir /home/user1/arm-eabi/
cd /home/user1/arm-eabi/
#copy sample file for baremetal build to new directory
cp /home/user1/downloads/crosstool-ng-1.8.1/samples/arm-bare_newlib_cortex_m3_nommu-
eabi/crosstool.config .config
#build the entire toolchain
ct-ng build
20. Crosstool-NG
Kernel-like menuconfig interface
Large number of supported architectures
uClibc-, glibc- or eglibc-based toolchain supported
Can create toolchains that target linux and bare-metal
Supports both soft- and hard- float toolchains
Debug facilities (native and cross gdb, gdbserver)
Watch out though, the default configuration for cortex-
m3 doesn't enable gdb. Remember to adjust the config!
32. C++ on a diet
The standard C and C++ runtime has many code and
data greedy features.
How to shave off some of the bloat?
Minimize standard library use?
Disable exceptions?
Restrict dynamic memory allocation?
Custom heap allocator?
Disable runtime type identification?
33. C++ on a diet
-fno-rtti
-fno-exceptions
-nostdlib
-nostartfiles
-Xlinker --no-gc-sections
40. Conclusions
Why would anyone do this? Why would anyone do this?
Time consuming Vendor Independence
Difficult to estimate Full source
Hard No "magic"
Fully configurable
Great learning experience
42. Credits
OpenOCD
https://sites.google.com/a/stf12.net/developer-sw-fw/eclipse-demo
Choose You:
http://www.flickr.com/photos/buzzbishop/3270420690/
Fish Stack:
http://www.flickr.com/photos/14903992@N08/4053566319/in/photostream/
Fish Heap
http://www.flickr.com/photos/bansal98/2389487868/
Burger
http://www.flickr.com/photos/derusha/561781801/
Salad
http://www.flickr.com/photos/freddy/39340695/
Go the right way:
http://www.flickr.com/photos/elenahneshcuetphotography/4438510791/