SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due...

Post on 04-Jan-2016

217 views 0 download

Transcript of SE-3910 Real-time Systems Week 5, Class 1 – Quick-Quiz (Ungraded) – Lab 4 turn-in up - due...

SE-3910Real-time Systems

• Week 5, Class 1– Quick-Quiz (Ungraded) – Lab 4 turn-in up - due Tuesday, Week 5– Select when to use Polling or Interrupts– Describe the interrupt handling process – Use conditional compilation to remove code from

compiling

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling, Some from Dr. Hornick, etc.1

Quick Quiz! What is the rise-time of this signal?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling2

0

5V

16ms10ms 13ms

Quick Quiz! Which of the following is correct?

void foo(struct bar2* b);…struct bar* b;And then….•foo((struct bar2*) b*)•foo((bar2*) *b)•foo((bar2*) b&)•foo((struct bar2*) &b)

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling3

When to Poll vs. Interrupt?• Polling

– Advantages• Lower latency (if

100% CPU)

– Disadvantages• High CPU• Low Punctuality

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling4

• Interrupts– Disadvantages

• Context switch cost

– Advantages• Low CPU• Higher Punctuality

Potential Problems• What happens if an unexpected interrupt

occurs and we have random garbage in the interrupt table?

• What happens if an interrupt handler doesn’t return?

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling5

The Clementine• In 1994, a deep space probe, the Clementine, was

launched to make observations of the moon and a large asteroid (1620 Geographos).

• After months of operation, a software exception caused a control thruster to fire for 11 minutes, which depleted most of the remaining fuel and caused the probe to rotate at 80 RPM.

• Control was eventually regained, but it was too late to successfully complete the mission.

6Watchdog Timers

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 7

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 8

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 9

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 10

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 11

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 12

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 13

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 14

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 15

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 16

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 17

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 18

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 19

Why use a watchdog timer?• Embedded systems must be able to cope

with both hardware and software anomalies to be truly robust.

• In many cases, embedded devices operate in total isolation and are not accessible to an operator.

• Manually resetting a device in this scenario when its software “hangs” is not possible.

• In extreme cases, this can result in damaged hardware or loss of life and incur significant cost impact.

Watchdog Timers 20

Watchdog Timer Structure

SE3910 Real Time Systems

Watchdog On the Beaglebone• http://beaglebone.cameon.net/home/watchd

og-timer• Open the file /dev/watchdog• Do not close the file• Write something (e.g. "\n") to the file at least

every 59 seconds to keep the system running

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling22

Conditional Compilation• #define DEBUG• #ifdef DEBUG• #endif

• #define LEVEL 5• #if LEVEL > 0• #endif

SE-3910 - Dr. Josiah YoderSlide style: Dr. Hornick

Much Material: Dr. Schilling23