tdc2016sp - trilha linux embarcado

Post on 14-Jan-2017

56 Views

Category:

Education

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

COPYRIGHT 2016 – Fundação CERTI

C++ and Embedded Linux: a perfect matchVinicius Zein | Fundação CERTI

COPYRIGHT 2016 – Fundação CERTI

https://br.linkedin.com/in/viniciuszein

Vinicius Tadeu Zein R&D Coordinator @CERTI Foundation

•  Responsible for the Embedded Systems team

•  More than 10 years developing Embedded Systems

•  In companies like Atmel, LG Electronics and CERTI

COPYRIGHT 2016 – Fundação CERTI

R&D Institute

Founded in 1984 with the mission to develop technology solutions for products and processes

500 employees

Private, but results are reinvested in R&D

MCTI and SUFRAMA accredited – projects with “Lei de Informática”, “Lei do Bem” and Embrapii

More than 500 clients around the world

COPYRIGHT 2016 – Fundação CERTI

The information in this presentation was compiled from sources believed to be reliable for informational purposes only.Content includes opinions, presentations, articles, hyperlinks or other third party content (“Third Party Material”) that is not intended to, nor constitutes an endorsement by CERTI of the author or the Third Party Materials. The content and views within the Third Party Material are solely those of the third party and do not reflect the opinions of CERTI.The opinions expressed in this presentation and on the following slides are solely those of thepresenter and not necessarily those of CERTI. CERTI does not guarantee the accuracy orreliability of the information provided herein.

.Disclaimer

COPYRIGHT 2016 – Fundação CERTI

SU MMARY

CHAPTER 1

Embedded Linux

CHAPTER 2

C++

CHAPTER 3

Development tools and debugging

CHAPTER 4

Test frameworks

CHAPTER 5

Test driven development

CHAPTER 6

Final considerations

COPYRIGHT 2016 – Fundação CERTI

Embedded Linux

Chapter 1

COPYRIGHT 2016 – Fundação CERTI

CAPÍTULO 1 | LINUX EMBARCADO

COPYRIGHT 2016 – Fundação CERTI

Telephone exchanges

IP Phones and Smartphones

TVs and Set-top boxes

Printers

Electronic Control Units for cars

Cameras

Android systems

CHAPTER 1 | EMBEDDED LINUX

-à Se for muito importante esta imagem,

substituir por uma de maior qualidade

COPYRIGHT 2016 – Fundação CERTI

C++CHAPTER 2

COPYRIGHT 2016 – Fundação CERTI

C++ “cee plus plus”

CHAPTER 2 Multi-paradigm

Object oriented

Templates, inline functions

Metaprogramming

High-performative and powerfull

Lots of tools

Compatibility with C - just in case ;)

STL, Boost, ACE

Evolving language

CHAPTER 2 | C++

C++85 style "C with Classes”, C++98, C++03, C++11, C++14, C++17

COPYRIGHT 2016 – Fundação CERTI

Don’t lower your level of abstractionwithout a good reason! Lo

w-l

evel

impl

ies

Mo

re c

od

eM

ore

bug

sH

ighe

r m

aint

enan

ce c

ost

s

COPYRIGHT 2016 – Fundação CERTI

Embedded Linux

C++

Perfect match

CHAPTER 2 | C++

COPYRIGHT 2016 – Fundação CERTI

DEVELOPMENT TOOLS AND DEBUGGING

CHAPTER 3

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

“Making Embedded Linux EasyBuildroot is a simple, efficient

and easy-to-use tool to generate embedded Linux systems through

cross-compilation.”

Build systems > Buildroot

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

Build systems > Yocto Project

“It's not an embedded Linux distribution

– it creates a custom one for you”

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

Build systems > Autoconf

Rake

Boost.Build

Qmake

Scons

CMake

COPYRIGHT 2016 – Fundação CERTI

Sublime Text 2 QtCreator

JetBrains AppCode

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

IDEs * Code edition and navigation

VimEmacs

Sublime Text 2 Eclipse CDT

NetbeansSlickEdit

QtCreatorJetBrains AppCode

If debugging is the process of removing bugs, then programming must be the process of putting them in

Edsger Dijkstra

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

Debugging

LogsCommand Line Interface (CLI)gdb (post morten)gdb + gdbserverdddGoogle BreakPad

For each bug found, a new unit test.

COPYRIGHT 2016 – Fundação CERTI

CAPÍTULO 3 | FERRAMENTAS DESENVOLVIMENTO E DEBUGGING

Debugging > GDB

Post mortengdb <program> -c <core_file>

bt full -> backtraceprint <variable>

frame <frame_id>thread <thread_id>

COPYRIGHT 2016 – Fundação CERTI

COPYRIGHT 2016 – Fundação CERTI

COPYRIGHT 2016 – Fundação CERTI

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

Debugging > Breakpad

COPYRIGHT 2016 – Fundação CERTI

Debugging > Breakpad

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

COPYRIGHT 2016 – Fundação CERTI

Continuos integration

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

COPYRIGHT 2016 – Fundação CERTI

Other tools > Static annalysis coverity, cppcheck

Coverage– ccccValgrind, tcmalloc

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

COPYRIGHT 2016 – Fundação CERTI

COPYRIGHT 2016 – Fundação CERTI

Code coverage

CHAPTER 3 | DEVELOPMENT TOOLS AND DEBUGGING

COPYRIGHT 2016 – Fundação CERTI

Test frameworks for C++

CHAPTER 4

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 4 | TEST FRAMEWORKS FOR C++

Unit tests – gtest > Well documented

MultiplatformLinux, Windows, Mac OS X

Easy to use, easy to configure

1 execution > multiple failures

COPYRIGHT 2016 – Fundação CERTI Unit tests – gtest

COPYRIGHT 2016 – Fundação CERTI Unit tests – gtest

COPYRIGHT 2016 – Fundação CERTI Unit tests – gtest

COPYRIGHT 2016 – Fundação CERTI Unit tests – gtest

COPYRIGHT 2016 – Fundação CERTI Unit tests – gtest

COPYRIGHT 2016 – Fundação CERTI

gmock > Google Mocking Framework for tests in C++

Real targets are not always available

Simulating behavior

Creating emulators

CHAPTER 4 | TEST FRAMEWORKS FOR C++

COPYRIGHT 2016 – Fundação CERTI gmock

COPYRIGHT 2016 – Fundação CERTI gmock

COPYRIGHT 2016 – Fundação CERTI gmock

COPYRIGHT 2016 – Fundação CERTI gmock

COPYRIGHT 2016 – Fundação CERTI gmock

COPYRIGHT 2016 – Fundação CERTI

Google Benchmark

https://github.com/google/benchmark

Function benchmarking

CHAPTER 4 | TEST FRAMEWORKS FOR C++

COPYRIGHT 2016 – Fundação CERTI Google Benchmark

Test driven development

CHAPTER 5

COPYRIGHT 2016 – Fundação CERTI

CHAPTER 5 | TEST DRIVEN DEVELOPMENT

Final considerationsCHAPTER 6

COPYRIGHT 2016 – Fundação CERTI

Use smart pointers

std::shared_ptr,std::scoped_ptr,std::unique_ptr

COPYRIGHT 2016 – Fundação CERTI

RAIIRAII

COPYRIGHT 2016 – Fundação CERTI

CAPÍTULO 6 | Final considerations

RAII

RAIIResource Acquisition Is Initialization

COPYRIGHT 2016 – Fundação CERTI

Use a code standardh#p://www.chromium.org/developers/coding-styleh#p://google-styleguide.googlecode.com/svn/trunk/cppguide.xmlh#p://clang.llvm.org/docs/ClangFormat.html

COPYRIGHT 2016 – Fundação CERTI

Unit test firstThen code

>TDD

COPYRIGHT 2016 – Fundação CERTI

Prefere

STL/Boost

algorithms

COPYRIGHT 2016 – Fundação CERTI

?

COPYRIGHT 2016 – Fundação CERTI

Thanks!Vinicius Zein vtz@certi.org.br

COPYRIGHT 2016 – Fundação CERTI

ReferencesSlide 6 h#p://events.linuxfounda?on.org/sites/events/files/slides/csimmonds-embedded-linux-?meline-2013.pdf

Slide 11 h#p://ecn.channel9.msdn.com/events/GoingNa?ve12/GN12Cpp11Style.pdf

Slides 24, 25 and 26 h#ps://code.google.com/p/google-breakpad/wiki/GeJngStartedWithBreakpad

Slide 48 h#p://www.pathfindersolns.com/

top related