+ All Categories
Home > Documents > Quick Overview of QP Frameworks & QM Modeling...

Quick Overview of QP Frameworks & QM Modeling...

Date post: 29-May-2020
Category:
Upload: others
View: 14 times
Download: 0 times
Share this document with a friend
30
state-machine.com Quick Overview of Quick Overview of QP Frameworks & QM Modeling Tool
Transcript
Page 1: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com

Quick Overview ofQuick Overview ofQP Frameworks & QM Modeling Tool

Page 2: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 2

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance

What is QP?

Page 3: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 3

What is QP?● Family of active object (actor) frameworks

for real-time embedded (RTE) systems

QP/C, QP/C++, and QP-nano

Page 4: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 4

Where does it run? (bare metal)● Single-chip 32-bit, 16-bit, and some 8-bit microcontrollers

32-bit (ARM): ARM Cortex-M, ARM7/9 (TI, NXP, Atmel, ST...)

32-bit (not ARM): Renesas RX, AVR32, PIC32, TI C28, C55 DSPs

16-bit: TI MSP430, Microchip PIC24/dsPIC, Renesas R8C

8-bit: AVRmega, 68HC08

Page 5: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 5

Where does it run? (OS/RTOS)

● QP/C and QP/C++ can run on top of an OS or RTOS

Big OS: POSIX (Linux, QNX, etc.), Win32

Big OS: Qt GUI and application framework

RTOS: ThreadX, uC/OS-II, ...

Page 6: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 6

Who is using it?● Millions of products: medical, defense, communication,

transportation, industrial, consumer, ...

Page 7: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 7

How is it licensed?● QP frameworks are available under dual-licensing model:

– GPL (v3) open source license

– Commercial closed source licenses

● QM modeling tool is freeware

NOTE: If your company has a policy forbidding open source in your product, QP can be licensed commercially

Page 8: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 8

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance

Active Objects (Actors) for RTE Systems

Page 9: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 9

Active Objects (Actors)● Active objects (actors) automatically enforce the

following best practices of concurrent programming(*):

1. Keep all of the task's data local, bound to the task itself and encapsulated from the rest of the system.

2. Communicate among tasks asynchronously via intermediary event objects. This avoids blocking tasks to wait on each other.

3. Tasks should spend their lifetime responding to incoming events, so their mainline should consist of an event loop.

4. Tasks should process events one at a time (to completion), thus avoiding any concurrency hazards within a task itself.

(*) Articles by: Herb Sutter, Edward E. Lee, dr. Dave Stewart, Jack Ganssle, ...

Page 10: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 10

Active Objects for Embedded MCUs● Active objects cannot operate in a vacuum and require a

software infrastructure (framework)

QP frameworks are smaller than typical bare-bones RTOSes

Page 11: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 11

Asynchronous Communication● All events are delivered asynchronously:

1. Each active object has its own event queue and receives all events exclusively through this queue.

2. Event producers merely post events to the AO queues but they don't wait in line for the processing of the events.

Page 12: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 12

True Encapsulation for Concurrency● Traditional encapsulation with synchronous methods

does not encapsulate anything in terms of concurrency

→ AOs are the most stringent form of object-oriented programming

Page 13: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 13

Run-to-Completion (RTC) Processing● AOs process events one at a time (to completion)

→ RTC should not be confused with thread preemption

→ AOs can preempt each other

Page 14: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 14

No Blocking (!)● Event-driven AOs don't block to wait for events

→ Therefore AOs remain responsive to events

→ Easy to add new events

→ In contrast, all RTOS inter-task communication and synchronization is based on blocking.

Page 15: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 15

Super-Fast Preemptive Kernel● Non-blocking AOs can work with non-blocking kernels

→ Preemptive multitasking with a single stack

→ Fully compatible with Rate-Monotonic Analysis (RMA)

→ Less CPU, less RAM, shorter latencies.

Page 16: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 16

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance

Hierarchical State Machines (UML Statecharts)

Page 17: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 17

Specifying Behavior of Active Objects● Each Active Object in QP has a state machine

→ Naturally handle events based on the type and the system state

→ Avoids “spaghetti code”--No 1. problem of event-driven systems.

Page 18: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 18

Transition Explosion in Traditional FSMs● Traditional Finite State Machines inflict repetitions

→ There is no way to capture similar transitions

Page 19: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 19

Reuse of Behavior Through State Nesting● Hierarchical State Machines support state nesting

→ Nested states inherit the behavior from the surrounding states

Page 20: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 20

Manual Coding of HSMs in QP/C++QState Calc::on(Calc *me, QEvt const *e) { switch (e->sig) { case Q_ENTRY_SIG: { // entry action BSP_message("on-ENTRY"); return Q_HANDLED(); } case Q_EXIT_SIG: { // exit action BSP_message("on-EXIT"); return Q_HANDLED(); } case Q_INIT_SIG: { // initial transition BSP_message("on-INIT"); return Q_TRAN(&Calc::ready); } case C_SIG: { // state transition BSP_clear(); // clear the display return Q_TRAN(&Calc::on); } case OFF_SIG: { // state transition return Q_TRAN(&Calc::final); } } return Q_SUPER(&QHsm::top); // superstate}

Page 21: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 21

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance

QM—Free Graphical and Code Generation Tool

Page 22: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 22

What is QM?• Free graphical modeling and code generation tool for QP

Page 23: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 23

How Does it Work?1. Create AO classes

2. Draw state machines

3. Add actions/guard code

4. Generate code

Page 24: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 24

What's Special about QM? Turning code generation“upside down”...

Page 25: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 25

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance

QS Software Tracing

Page 26: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 26

Why Software Tracing?Biggest problem: limited visibility into the embedded system

→ You need to observe the system live; not stopped in a debugger

Page 27: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 27

QS Software Tracing SystemQS (QP Spy ) tracing provides wealth of information:

→ All state machine activities (entering/exiting states, transitions,...)

→ All event posting, event queuing, event dispatching, …

→ Real-time Kernel scheduling, task switches, ...

Page 28: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 28

QSPY Host ApplicationQSPY host application receives and displays the QS data:

→ → Human-readable formatHuman-readable format

→ → Interface to MATLAB/GNU-OctaveInterface to MATLAB/GNU-Octave

→ → Interface to Message-Sequence-Chart (MSC) generator Interface to Message-Sequence-Chart (MSC) generator

Page 29: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 29

Presentation Outline

• What is QP?• Active Objects (Actors) for Real-Time Embedded Systems• Hierarchical State Machines (UML Statecharts)• QM--Free Graphical Modeling and Code Generation Tool• QS Software Tracing• MISRA Compliance MISRA Compliance

Page 30: Quick Overview of QP Frameworks & QM Modeling Toolold.state-machine.com/qp/QP-QM_Overview_Slides.pdf · state-machine.com 2 Presentation Outline • What is QP? • Active Objects

state-machine.com 30

MISRA ComplianceSafe subset of C or C++ for use in safety critical applications

→ → MISRA Compliance Matrices for QP/C, QP/C++, and QP-nanoMISRA Compliance Matrices for QP/C, QP/C++, and QP-nano

→ → Complete suite of scripts and tools to automate checking of Complete suite of scripts and tools to automate checking of comliance of the application-level code with PC-Lintcomliance of the application-level code with PC-Lint


Recommended