Embedded Systems interview questions

Embedded Systems Interview Questions

Following are some of the most frequently asked Embedded Systems interview questions in the interview, here are the answers for them.

How does combination of functions reduce memory requirements in embedded systems?

The amount of code that has to be dealt with is reduced thus easing the overhead and redundancy is eliminated in case if there is anything common among the functions.

Memory allocation is another aspect that is optimized and it also makes sense to group a set of functions related in some way as one single unit rather than having them to be dispersed in the whole program.

In case of interactive systems display of menu list and reading in the choices of user’s could be encapsulated as a single unit.

How does, taking the address of local variable result in unoptimized code?

The most powerful optimization for compliler is register allocation. That is it operates the variable from register, than memory.

Generally local variables are allocated in registers. However if we take the address of a local variable, compiler will not allocate the variable to register.

What is a pure function in ARM terminology?

Pure functions are those which return a result which depends only on their arguments.

They can be thought of as mathematical functions: they always return the same result if the arguments are the same. To tell the compiler that a function is pure, use the special declaration keyword __pure.

__pure int square(int x)

{ return x * x;

}

Compiler does optimization for pure functions. For example, the values which are allocated to memory can be safely cached in registers, instead of being written to memory before a call and reloaded afterwards.

Is 8085 an embedded system?

It’s not an embedded system. Because it will be a part of an embedded system and it does not work on any software.

 What is the role of segment register?

In the 8086 processor architecture, memory addresses are specified in two parts called the segment and the offset. Segment values are stored in the segment registers. There are four or more segment registers: Code Segment (CS) contains segment of the current instruction (IP is the offset), Stack segment (SS) contain stack of the segment (SP is the offset), DS is the segment used by default for most data operations; ES is an extra segment register.

What type of registers contains an INTEL CPU?

Special function registers like accumulator, program controller (PC), data pointer (DPTR), TMOD and TCON (timing registers), 3 register banks with r0 to r7, Bit addressable registers like B.

 What is the difference between microprocessor and micro controller?

Microprocessor is managers of the resources (I/O, memory) which lie out-side of its architecture.

Micro controllers have I/O, memory etc. built into it and specifically designed for control.

DMA deals with which address (physical/virtual addresses)?

DMA deals with physical addresses. DMA controller is a device which directly drives the data and address bus during data transfer. So it is purely physical address.

Which is better a char, short or int type for optimization?

Where possible, it is best to avoid using char and short as local variables. For the types char and short the compiler needs to reduce the size of the local variable to 8 or 16 bits after each assignment. This is called sign-extending for signed variables and zeroextending for unsigned variables.

It is implemented by shifting the register left by 24 or 16 bits, followed by a signed or unsigned shift right by the same amount, taking two instructions (zero-extension of an unsigned char takes one instruction).

These shifts can be avoided by using int and unsigned int for local variables. This is particularly important for calculations which first load data into local variables and then process the data inside the local variables.

Even if data is input and output as 8- or 16-bit quantities, it is worth considering processing them as 32-bit quantities

What are inline functions?

The ARM compilers support inline functions with the keyword __inline.

These results in each call to an inline function being substituted by its body, instead of a normal call.

This results in faster code, but it adversely affects code size, particularly if the inline function is large and used often.

Why do we need virtual device drivers when we have physical device drivers?

Device drivers are basically a set of modules/routines so as to handle a device for which a direct way of communication is not possible through the user’s application program and these can be thought of as an interface thus keeping the system small providing for minimalistic of additions of code, if any.

Physical device drivers can’t perform all the logical operations needed in a system in cases like IPC, Signals and so on…

The main reason for having virtual device drivers is to mimic the behaviour of certain hardware devices without it actually being present and these could be attributed to the high cost of the devices or the unavailability of such devices.

These basically create an illusion for the users as if they are using the actual hardware and enable them to carry out their simulation results.

Examples could be the use of virtual drivers in case of Network simulators, also the support of virtual device drivers in case a user runs an additional OS in a virtual box kind of software.

What is the need for an infinite loop in Embedded systems?

Infinite Loops are those program constructs where in there is no break statement so as to get out of the loop, it just keeps looping over the statements within the block defined.

Example:

While(Boolean True) OR for(;;);

{

//Code

}

Embedded systems need infinite loops for repeatedly processing/monitoring the state of the program. One example could be the case of a program state continuously being checked for any exceptional errors that might just occur during run time such as memory outage or divide by zero etc.,

For e.g. Customer care Telephone systems where in a pre-recorded audio file is played in case the dialer is put on hold.

Also circuits being responsible for indicating that a particular component is active/alive during its operation by means of LED’s.

What is Dirac delta function and its Fourier transform and its importance?

Dirac delta function is a continuous time function with unit are and infinite amplitude at t=0.

The Fourier transform of Dirac delta function is 1.

Using Dirac delta as an input to the system, we can get the system response. It is used to study the behaviour of the circuit. We can use this system behaviour to find the output for any input.

What is the difference between testing and verification?

Verification is a front end process and testing is a post silicon process. Verification is to verify the functionality of the design during the design cycle. Testing is find manufacturing faults.

a &= ~BIT3;

}

Some people prefer to define a mask together with manifest constants for the set and clear values. This is also acceptable. The element that I’m looking for is the use of manifest constants, together with the |= and &= ~ constructs

#define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?

In this case the cat(x,y) is the macro which is defined by using the preprocessor directive , this will be substituted only at the place where it is called in this example it happens like this

cat(1,2)##3 which will once again become 1##2##3

here if we use ## in between we can join or concatenat only two variables that why it gives a preprocessor warning

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on Embedded Systems interview questions"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Support


    Please leave a message and we'll get back to you soon.

    3 + 5