Infotronik
HSLU - HS17 Systemstrukturierung und Programmierung von Embedded Systems
HSLU - HS17 Systemstrukturierung und Programmierung von Embedded Systems
Fichier Détails
Cartes-fiches | 185 |
---|---|
Langue | Deutsch |
Catégorie | Electronique |
Niveau | Université |
Crée / Actualisé | 08.10.2017 / 06.12.2018 |
Lien de web |
https://card2brain.ch/box/20171008_infotronik
|
Intégrer |
<iframe src="https://card2brain.ch/box/20171008_infotronik/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>
|
Explain reasons why we used a Shell in INTRO:
To communicate (i.e. inspect, configure, debug) our target.
In INTRO we implemented an 'Events' driver.
- (a) Why did we implement it as an array of bits?
- (b) What is the fundamental disadvantage of such an array of bits?
- (c) It implements critical section (e.g. to set an event bit) with EnterCritical() and ExitCritical(). Under which conditions such a critical section would not be required?
- (d) List reasons why an interrupt service routine should use such an Event module:
- (a) Um Ram zu sichern.
- (b) Die Bitmanipulation benötigt Laufzeit
- (c) Wenn es keine Möglichkeit gibt, dass die Operation unterbrochen werden kann, oder wenn die Operation atomar ist.
- (d) Reduzieren der Interrupt-Latenzzeit, es wird "nur" ein Bit gesetzt und die Hauptausführung wird dem dem main überlassen
An RTOS can be either preemptive or cooperative: Explain the difference:
Preemptive: Es wird immer der Task mit der höchsten Priorität ausgeführt. Task mit gleicher Priorität teilen sich die CPU-Zeit
Cooperativ: Kontextswitches treten nur auf, wenn ein Task blockiert oder explizit aufgerufen wird.
In an RTOS, each task can be in one of 5 fundamental states: List them:
- New
- Ready
- Running
- Waiting
- Stopped
What's the purpose of the scheduler in an RTOS?
Handling, welcher Task als nächstes ausgeführt wird, um die Wartezeit zu minimieren.
Provide a short definition of the term Interrupt Latency, and which factors/aspects are contributing to it:
- Zeit zwischen dem Ereignis selbst und bis zur Ausführung des ISR
- Faktoren stoppen / beenden den aktuellen Interrupt
- Interrupt-Zielberechnung /-arbitrierung*), Push-State und Umleitung zur ISR.
*) lösen von Zugriffskonflikte oder Zugriffskollisionen
Provide an example of a typical Reactive System, and explain why this is a reactive system:
Airbag, it reacts on external events.
A PWM signal on a H-Bridge is labeled as low active. Explain what this means and how this impacts the speed of a DC motor?
- low active means: Der Motor ist aktiv (Drehzahl > 0), wenn das Signal low ist
- Für PWM: Je länger der lower Zustand, desto höher die Spannung rsp. die Motorendrehzahl
Given the following program:
#define ADC_CONFIG (*(volatile uint8_t*) 0x123 )
static void Interrupt (void) {
uint8_t i ;
while (ADC_CONFIG & ~0x10 ) ;
for(i =0; i <10; i++) {
__asm( "nop" ) ;
}
}
This program is using
Your Eclipse project stores the make files, object files and the final (binary) application file in a sub folder inside your project. Are you going to store this folder and files in a version control system? Justify your answer:
- Conflict! Der Inhalt dieses Ordners/Dateien werden generiert (beinhaltet Rechnerspezifischen Code sowie auch Zeitstempels)
- Es ist nicht sinnvoll, abgeleitete Inhalte in einem Versionskontrollsystem zu speichern.
Processor Expert components are using the concept of Methods, Properties and Events. What would you expect for an ADC (Analog to Digital Converter) component?
(a) 2 typical Methods for an ADC component
(b) 2 typical Properties for of an ADC component:
(c) 2 typical Events for an ADC component:
- (a) Measure(), SetChannel(),...
- (b) Pin, sampling time, channel
- (c) OnSamplingStart(), OnConversionEnd(), OnError(), ...
Given following variable definition:
static char *string = "hello";
What is the difference between the two following usages
- sizeof(string)
- strlen(string)
In respect to the result and the expected code generated?
sizeof
- Gibt die Größe im Speicher an, die hier die Größe eines Zeigers hat (2 oder 4 Bytes, abhängig von der Maschine)
- sizeof() wird zur Kompilierzeit berechnet (Konstante)
strlen
- strlen() Die Läng ohne das zero-byte
- Is a library routine call (Ruft eine Bibliotheksroutine auf)
Given following interface implementation for a DC motor driver:
/* motor . h */
#include "LED. h" /* LED i n t e r f a c e */
#include "PWM. h" /* PWM i n t e r f a c e */
static uint16_t MOT_motorSpeed ;
void MOT_Init (void);
/* end o f motor . h */
Identify three issues with such an interface implementation (issues which could lead to linker/compiler failure, or things which are not considered as good programming style):
- No #ifndef...#define
- not necessary includes, static definition in header file.
Write in C code a single statement which only sets bit number 0 in variable var and let the other bits untouched (bit number 0 is the LSB):
var |= (1 << 0);
Provide an example of a typical Transforming System, and explain why this is a Transforming System:
- Radio --> Wandelt Daten in ein Hörbares Outputsignal
- Network router --> it transform packes and distributes them.
Explain why Optimized Memory Usage is a typical attribute for a Transforming System:
- Solche Systeme wandeln einen Eingabestrom in einen Ausgabestrom um
- Dies beinhaltet normalerweise eine grössere Menge an Speicher zum Puffern und Transformieren. Da Speicher teuer ist, müssen solche Systeme dafür optimiert werden.
Explain the reason why some processors push all their core registers onto the interrupt stack, and some only push a subset of the registers:
- Um die Interrupt-Latenz nicht zu erhöhen, falls viele Register vorhanden sind
- Und um die Wahrscheinlichkeit eines Stack-Überlaufs zu reduzieren.
What does it mean, if somebody says "I have masked the interrupts"?
The interrupts are disabled.
Explain multiple things which affects the interrupt latency time.
Die Latenzzeit hängt von
- der Geschwindigkeit der CPU,
- der Anzahl der zu ändernden Daten / -Register / Stapel für den Kontextwechsel und
- der Eintrittszeit innerhalb des ISR ab,
bis die ISR-Routine starten kann.
List the things a processor has to do in order to jump to an interrupt service routine and to return from it.
- aktuelle Ausführung stoppen (or undo or finish)
- Berechung der neuen Adresse basierend auf Vektor
- Speicher Status auf dem Stack
- Verzweige (brunch) zur ISR und Kontextswitch
- Dann alles Rückwärts durchlaufen, um von der ISR zurückzukehren.
List reasons, why a company would not allow any interrupt synchronization methods:
- Das Timing ist möglicherweise schwer berechnen bar
- Alles muss deterministisch sein.
- Problem mit Stack-Verbrauch, Timing-Problemen, verpasste Interrupts.
- Interrupts werden möglicherweise nicht bestätigt.
Does the ARM Cortex-M0+ support nested interrupts?
No!
What does it mean: the ARM Cortex M0+ supports nested interrupts?
Ein Interrupt mit niedrigerer Interrupt-Prioritätsnummer (höhere Interrupt-Prioritätsnummer) kann von einer Interrupt-Quelle mit höherer Priorität (untere Interrupt-Prioritätsnummer) unterbrochen werden.
Answer the questions for following C code, assuming default compiler settings:
typedef signed short MyType;
static unsigned char myVar[3];
typedef enum { RED=5, GREEN, YELLOW } Color s ;
(a) What gives sizeof(MyType) for the tinyK20/Remote board/project:
(b) What gives sizeof(MyType) for the Robot board/project?
(c) What gives sizeof(MyVar) for the tinyK20/Remote board/project?
(d) What gives sizeof(MyVar) for the Robot board/project?
(e) Which value has YELLOW?
- (a) 2
- (b) 2
- (c) 3
- (d) 3
- (e) 7
Given following source code:
uint16_t abcd [16];
uint8_t buf [10];
static uint16_t values [3];
(a) Determine the value of following expression:
- sizeof("abcd")
(b) Determine the value of following expression:
- sizeof(buf)
(c) Determine the value of following expression:
- sizeof(values)
- (a) 5
- (b) 10
- (c) 6