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

Post on 24-Jun-2015

2,896 views 0 download

Tags:

description

The slides from my ACCU 2011 conference presentation.

transcript

C++ for Marine Streamer Positioning & Navigation

Mike LongSchlumberger Western Geco

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

Western Geco : Seismic acquistion

You Tube - marine seismic acquisition

Deployment Configuration

Streamer Navigation & Positioning

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

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

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++

What makes up a toolchain?

What makes up a toolchain

What makes up a toolchain

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

How to choose a toolchain

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

How to choose a toolchain

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

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

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)

How to choose a toolchain

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!

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

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!

Stacks & Heaps: Linker Scripts

Stacks & Heaps: Linker Scripts

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

Stacks & Heaps: Linker Scripts

Stacks & Heaps: Linker Scripts

Stacks & Heaps: Linker Scripts

Stacks & Heaps: Linker Scripts

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

The time before "int main()"

The time before "int main()"

The time before "int main()"

C++ on a diet

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?

C++ on a diet

-fno-rtti

-fno-exceptions

-nostdlib

-nostartfiles

-Xlinker --no-gc-sections

C++ on a diet

C++ on a diet

C++ on a diet

Testable Embedded C++

Testable Embedded C++: HIL

Conclusions

Why would anyone do this?Time consumingDifficult to estimateHard

Conclusions

Why would anyone do this?Time consumingDifficult to estimateHard

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

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

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/