C++ for Marine Streamer Positioning and Navigation - ACCU 2011

42
C++ for Marine Streamer Positioning & Navigation Mike Long Schlumberger Western Geco

description

The slides from my ACCU 2011 conference presentation.

Transcript of C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Page 1: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ for Marine Streamer Positioning & Navigation

Mike LongSchlumberger Western Geco

Page 2: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Western Geco

Well Testing

Well Services

Integrated Project Management

Schlumberger Information Solutions

Data & Consulting Services

Our Technologies and Services

Reservoir Characterization

Reservoir Production

Reservoir Management

Drilling & Measurements

Completions

Wireline

Artificial Lift

Page 3: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Western Geco : Seismic acquistion

You Tube - marine seismic acquisition

Page 4: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Deployment Configuration

Page 5: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Streamer Navigation & Positioning

Page 6: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Western Geco : Technical Challenges

Data VolumeTens of thousands of sensors acquiring real time data (+ranging and status)

PowerPhysically long streamers

CostProprietary hardware systemsCustom chip development

Page 7: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ On a ShoestringBuilding a gcc cross compile toolchain for the Stellaris LM3S8962 Cortex-M3

Page 8: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Topics

What is a toolchain and how to choose one?Building your own gcc cross compile toolchain.Stacks & Heaps: Linker ScriptsProgramming and On-chip debuggingThe time before "int main()"C++ on a dietTestable Embedded C++

Page 9: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

What makes up a toolchain?

Page 10: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

What makes up a toolchain

Page 11: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

What makes up a toolchain

Page 12: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

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 availabilityExtended life products will benefit from source availability

Page 13: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

How to choose a toolchain

Given that we make long-lived products, source availability is desirable. So: are there any companies providing toolchains?

Page 14: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

How to choose a toolchain

Given that we make long-lived products, source availability is desirable. So: are there any companies providing toolchains?

Page 15: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

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

Page 16: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

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-extrasIf 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)

Page 17: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

How to choose a toolchain

Page 18: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Crosstool-NG

crosstool-NG is a tool to build cross-toolchains

Kernel-like menuconfig interfaceLarge number of supported architecturesuClibc-, glibc- or eglibc-based toolchain supportedCan create toolchains that target linux and bare-metalSupports both soft- and hard- float toolchainsDebug facilities (native and cross gdb, gdbserver)

Watch out though, the default configuration for cortex-m3 doesn't enable gdb. Remember to adjust the config!

Page 19: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Crosstool-NG#install crosstool-ngbzip2 -d crosstool-ng-1.8.1.tar.bz2tar -xf crosstool-ng-1.8.1.tarcd crosstool-ng-1.8.1/sudo apt-get install awksudo apt-get install gawksudo apt-get install bisonsudo apt-get install flexsudo apt-get install automakesudo apt-get install libtoolsudo apt-get install libncurses-devsudo apt-get install zlib1g-dev./configuremakesudo make installmkdir /home/user1/arm-eabi/cd /home/user1/arm-eabi/#copy sample file for baremetal build to new directorycp /home/user1/downloads/crosstool-ng-1.8.1/samples/arm-bare_newlib_cortex_m3_nommu-eabi/crosstool.config .config#build the entire toolchainct-ng build

Page 20: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Crosstool-NG

Kernel-like menuconfig interfaceLarge number of supported architecturesuClibc-, glibc- or eglibc-based toolchain supportedCan create toolchains that target linux and bare-metalSupports both soft- and hard- float toolchainsDebug facilities (native and cross gdb, gdbserver)

Watch out though, the default configuration for cortex-m3 doesn't enable gdb. Remember to adjust the config!

Page 21: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Page 22: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Gcc uses a linker script to decide what goes where, and when:

Page 23: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Page 24: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Page 25: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Page 26: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Stacks & Heaps: Linker Scripts

Page 27: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

From link-time to run-time:Programming and On-chip debugging

Page 28: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

The time before "int main()"

Page 29: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

The time before "int main()"

Page 30: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

The time before "int main()"

Page 31: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ on a diet

Page 32: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

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?

Page 33: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ on a diet

-fno-rtti

-fno-exceptions

-nostdlib

-nostartfiles

-Xlinker --no-gc-sections

Page 34: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ on a diet

Page 35: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ on a diet

Page 36: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

C++ on a diet

Page 37: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Testable Embedded C++

Page 38: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Testable Embedded C++: HIL

Page 39: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Conclusions

Why would anyone do this?Time consumingDifficult to estimateHard

Page 40: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

Conclusions

Why would anyone do this?Time consumingDifficult to estimateHard

Why would anyone do this?Vendor IndependenceFull sourceNo "magic"Fully configurableGreat learning experience

Page 41: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

http://www.westerngeco.com/http://meekrosoft.wordpress.com/@meekrosoft

Page 42: C++ for Marine Streamer Positioning and Navigation - ACCU 2011

CreditsOpenOCDhttps://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/

Burgerhttp://www.flickr.com/photos/derusha/561781801/

Saladhttp://www.flickr.com/photos/freddy/39340695/

Go the right way:http://www.flickr.com/photos/elenahneshcuetphotography/4438510791/