real-time programming to the masses Per Lindgren Professor Embedded - - PowerPoint PPT Presentation

real time programming to the masses
SMART_READER_LITE
LIVE PREVIEW

real-time programming to the masses Per Lindgren Professor Embedded - - PowerPoint PPT Presentation

Bringing resource efficient real-time programming to the masses Per Lindgren Professor Embedded Systems Why Focus on Software 40 billion devices in 2020 (Artemis) Their functionality is to a large extent defined by their embedded


slide-1
SLIDE 1

Bringing resource efficient real-time programming to the masses Per Lindgren Professor Embedded Systems

slide-2
SLIDE 2

Why Focus on Software

  • 40 billion devices in 2020 (Artemis)
  • Their functionality is to a large extent defined

by their embedded software.

  • More versions of software than hardware

(many different applications can be run on the same platform, we want flexibility)

  • More versions of hardware than software

(we want compatibility over different platforms, we want code re-use)

slide-3
SLIDE 3

Why Focus on Software

  • Embedded programming is different from

general purpose programming.

– Lots of interaction with the environment (HW) – (Hard) timing constraints – Resource limitations

  • Memory
  • Power

– Requirements

  • Safety (error containment, etc.)
slide-4
SLIDE 4

Huge efforts are spent

  • Fact 1, Often dominating cost for development of ES
  • Fact 2, C is the dominating programming language
  • Fact 3, (Real-Time) Operating Systems offer (some) help

– Thread OS model not necessary the right abstraction

  • Definitely not corresponding to HW intuition

– Still hard to verify (lots of testing) – Analysis is not available to the masses, e.g.,

  • NEAVA (Ericsson/Huawei, low level programming … no analysis)
  • Abelko, Microbit, Optronic, D-Flow, … no analysis
  • …. Just testing testing testing testing
  • It’s not because our companies are bad, why then … we’ll come to this
slide-5
SLIDE 5

(Real-Time) Operating System

  • For resource constained systems

FreeRTOS, TinyOS, Contiki, etc. Offer infrastructure, like a road with traffic lights, road signs, and police… however

– Manual coding is chosen when:

  • OS not needed/too complicated/wrong abstraction
  • Too high overhead

– Other approaches required

  • Guarantees/proofs are required
slide-6
SLIDE 6

Formal methods (analysis)

  • Typically requires expert knowledge
  • Non-standard programming models

– Synchronuous languages (Esterel) – Time triggered models (Giotto) – etc. far from industrial C background

  • Difficult/Expensive/Time consuming

not available to the masses

slide-7
SLIDE 7

RTFM: Real Time For the Masses

  • Simple reactive system model
  • Simple C-programming API

– Static jobs (interrupts), resources (critical sections)

  • Simple Scheduler

– Uses the interrupt hardware efficiently

  • Simple Analysis Possible

– Derives configuration for the scheduler – Compile time stack/heap memory analysis – Schedulablity test, (response time analysis)

slide-8
SLIDE 8

RTFM: Step 1, past

  • SIES 2013 Real-Time For the Masses: Step 1. Programming API

and Static Priority SRP Kernel Primitives

– Motivation – Related work – Roadmap – Task model (theoretical underpinning) – Programmer’s API – Kernel implementation (zero/constant overhead can be obtained) – Kernel configuration and tool for basic analysis – Evaluation (comparison to FreeRTOS faster by magnitues) & future work SUB MICRO SECOND RESPONSE TIME ALLOWS REAL-TIME APPLICATIONS TO RUN AT MHz SPEED IN SOFTWARE

slide-9
SLIDE 9

RTFM: Step2, present

  • Adding Virtual Interrupts

– Constant time mechanism for virtual interrupts (used in cases the application specifies larger number of tasks then the number of (free) interrupt sources provided by the underlying HW)

  • Adding queues to RTFM

– Tasks invoked by parameters (can be seen as messages) – Hugely facilitates programming – We have a highly efficient, constant time mechanism

  • In place access for both sender and receiver

– Extending memory analysis to cope with messages

  • Queue lengths are determined at compile time

– An important step towards supporting TinyTimber (CRO model)

slide-10
SLIDE 10

RTFM: Step 3, future

  • Adding timing constraints to tasks

– Facilitates development of real-time systems – A direct match to the notion of time underlying Timber/CRO

  • Use as infrastructure for executing TinyTimber programs

– Mapping of TinyTimber API to RTFM

  • Make use of the time constrained tasks with parameters
  • Make use of analysis (memory/schedulability etc.)
  • RTFM language

– An imperative language that combines the notion of concurrent reactive objects (CRO) with a sub-set of C – Make a CRO->TinyTimber compiler (executed by RTFM) – Facilitate programming, preserve efficiency, easy to analyse

slide-11
SLIDE 11

RTFM: Current & Future work/Activites

  • It is already useful (ARM Cortex M0/M3 supported, i.e. the

next gen Freescale-MULLE). Available now.

  • Works directly within LPCXpresso toolchain

(Phillips ARM division) List of contributors (so far…)

  • Per Lindgren
  • Johan Eriksson
  • Simon Aittamaa
  • Andrey Kruglyak
  • Fredrik Häggström
  • (Henrik Mäkitaavola, future?)
  • your name here…
slide-12
SLIDE 12
  • Get you people that develop low level code involved.
  • We can support you get going.

– You get real time performance, and analysis – We get use cases

  • What we need to do is to set up a RTFM site (LTU hosted?)

– Scope/motivation, roadmap, status – Wiki for developers and users – Git/Svn for code base and examples

RTFM: Current & Future work/Activites

slide-13
SLIDE 13

RTFM & Related activities

  • Projects at EISLAB concerning embedded software

– SVK (Modeling/Simulation) – EMC2 (Arcticus effort 500 kEuro, LTU will match) – ESIS 2.5 D-FLOW/Neava (verification) – Arrowhead/SKF (supporting software)

  • (Dependable) Communication and computation systems
  • Control Systems
  • Mobile Systems

I.E., embedded software is the backbone/infrastructure

slide-14
SLIDE 14

RTFM: So what is it?

Inputs Outputs

slide-15
SLIDE 15

RTFM: So what is it?

Reacts to external and internal events

Inputs Outputs

Sensors CAN BUS Ethernet Wireless 802.4 CAN BUS Wireless 802.4 Ethernet Actuators Zigbee Zigbee

slide-16
SLIDE 16

Externally triggered tasks

Inputs Outputs

Res A Res B Res C

slide-17
SLIDE 17

Resources might be shared e.g., Resource B

Inputs Outputs

Res B

slide-18
SLIDE 18

Tasks, internally triggered

Inputs Outputs

slide-19
SLIDE 19

Tasks, internally triggered, periodic

Inputs Outputs

After 10 us Reset (one-shot)

slide-20
SLIDE 20

RTFM: API (Super Simple!!!!!)

slide-21
SLIDE 21

RTFM: Binding to environment

slide-22
SLIDE 22

Inputs Outputs

RTFM: Binding to environment

slide-23
SLIDE 23

RTFM: Task description C-code

slide-24
SLIDE 24

Inputs Outputs

RTFM: Task description C-code

slide-25
SLIDE 25

RTFM: Shared resource

slide-26
SLIDE 26

RTFM: Shared resource

Inputs Outputs

slide-27
SLIDE 27

RTFM: Internally triggered task

slide-28
SLIDE 28

Inputs Outputs

RTFM: Internally triggered task

slide-29
SLIDE 29

RTFM: Internal task with shared resource

slide-30
SLIDE 30

Inputs Outputs

RTFM: Internal task with shared resource

slide-31
SLIDE 31

Tasks, internally triggered, with timing constraints (after, before) Step 3

Inputs Outputs

slide-32
SLIDE 32

RTFM: Kernel (Super Simple!!!!!)

slide-33
SLIDE 33

Scheduling by interrupt HW

slide-34
SLIDE 34

RTFM: Resource protection

slide-35
SLIDE 35

4 byte OH per LOCK

slide-36
SLIDE 36

Single instruction OH, for LOCK/UNLOCK

slide-37
SLIDE 37

Enforcing consistency (required by HW)

slide-38
SLIDE 38

Single instruction job request

slide-39
SLIDE 39

Evaluation

Unbeatable performance, even by manual coding!!! Cycles => Time, Cycles => Power, Memory => Size, Mem => Cost, Mem => Power

slide-40
SLIDE 40

RTFM: Real Time For the Masses, it’s here!!! And Real-Time Comes for Free

  • Builds of the Bulk of Theoretical Results from Academia
  • Stack Resource Policy
  • Draws on complete understanding of the Hardware
  • Simple C-Code API
  • GCC compatible, i.e., works inside industrial Tool Chains
  • Comes with Safe Schedulabilty (Response Time Analysis)
  • Comes with Safe Stack-depth analysis
  • Future work
  • Messages with payloads, Timers, etc. as discussed
  • Exploit Low-Power potential.
  • Additional analysis (offset based, etc. tighter results)
  • Mapping from TinyOS/TinyTimber/REKO/Rubus
slide-41
SLIDE 41

Thank you for listening now RTFM!