Embedded Systems
Eng. Mohammed Sokkaree
Agenda
•   Introduction to embedded Systems
•   Why embedded C
•   Interview questions
•   Q&A
Computing Systems
What’s ES?
• System designed to do one or a few dedicated
  and/or specific functions.
• combination of computer hardware and software
 ▫   Mp3 player
 ▫   Mobile
 ▫   Medical testing systems
 ▫   Anti-Lock Brakes
Embedded SW
•   Portability
•   Optimization
•   Quality
•   Readability
•   Complexity
•   HW Compatibility “ HW knowledge”
•   Min. Resources
Why embedded C?
Question 1
   RTD
Question 1
• Real time System
 ▫ Hard
 ▫ Soft
• CBT
Question 2
   SWE
Question 2
• Testing
 ▫ Types of testing
• Debugging
Question 3
 Pointers
Pointers Pointers & Pointers
• Using the variable a, give definitions for the
  following:
  ▫  a) An integer
  ▫ b) A pointer to an integer
  ▫ c) A pointer to a pointer to an integer
  ▫ d) An array of 10 integers
  ▫ e) An array of 10 pointers to integers
  ▫ f) A pointer to an array of 10 integers
  ▫ g) A pointer to a function that takes an integer as an
    argument and returns an integer
  ▫ h) An array of ten pointers to functions that take an
    integer argument and return an integer
Answer
• a) int a;           // An integer
• b) int *a;          // A pointer to an integer
• c) int **a;        // A pointer to a pointer to an integer
• d) int a[10];      // An array of 10 integers
• e) int *a[10];     // An array of 10 pointers to integers
• f) int (*a)[10];    // A pointer to an array of 10 integers
• g) int (*a)(int); // A pointer to a function a that takes
  an                 integer argument and returns an
  integer
• h) int (*a[10])(int); // An array of 10 pointers to
  functions that take an integer argument and return an
  integer
Question 4
  Macros
Question 4
      Functions        Function like
                         macros
              How it works
             Input arguments
Question 4 (Cont.)
• Write a macro to set the MSB



#define MSB(X) ((X) | (1 << ((sizeof(X)<<3) -1))
Question 5
 Variables
Question 5
•   Local
•   Global
•   Static
•   Extern
Question 6
 Tracing
Question 6

int main()                      X   Y
                                2   1
{
int x=1,y=1;                    3   1
for(;y;printf("%d %dn",x,y))   4   1
y=x++<=5;                       5   1
return 0;                       6   1
                                7   0
}
Thank you
Connect via LinkedIn

 http://eg.linkedin.com/in/engmohammed
Hi all,
   I have a basic C programming query.
  For the program,
  #define MAX(x,y) (x)>(y)?(x):(y)
  void main( )
  {
  int i=10, j=5, k=0;
  k=MAX(i++,++j);
  printf("%d %d %d",i,j,k);
  }
  I get the output as 12,6,11
  whereas, when I modify the program as below
  int max_fn(a,b);
  void main( )
  {
  int i=10, j=5, k=0;
  k = max_fn(i++,++j);
  printf("%d %d %d",i,j,k);
  }
  int max_fn(a,b)
  {
  return((a)>(b)?(a):(b));
  }
  In this case, I get the output as 11,6,10.
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Embedded SW Interview Questions

  • 1.
  • 2.
    Agenda • Introduction to embedded Systems • Why embedded C • Interview questions • Q&A
  • 3.
  • 4.
    What’s ES? • Systemdesigned to do one or a few dedicated and/or specific functions. • combination of computer hardware and software ▫ Mp3 player ▫ Mobile ▫ Medical testing systems ▫ Anti-Lock Brakes
  • 5.
    Embedded SW • Portability • Optimization • Quality • Readability • Complexity • HW Compatibility “ HW knowledge” • Min. Resources
  • 6.
  • 7.
  • 8.
    Question 1 • Realtime System ▫ Hard ▫ Soft • CBT
  • 9.
  • 10.
    Question 2 • Testing ▫ Types of testing • Debugging
  • 11.
  • 12.
    Pointers Pointers &Pointers • Using the variable a, give definitions for the following: ▫ a) An integer ▫ b) A pointer to an integer ▫ c) A pointer to a pointer to an integer ▫ d) An array of 10 integers ▫ e) An array of 10 pointers to integers ▫ f) A pointer to an array of 10 integers ▫ g) A pointer to a function that takes an integer as an argument and returns an integer ▫ h) An array of ten pointers to functions that take an integer argument and return an integer
  • 13.
    Answer • a) inta; // An integer • b) int *a; // A pointer to an integer • c) int **a; // A pointer to a pointer to an integer • d) int a[10]; // An array of 10 integers • e) int *a[10]; // An array of 10 pointers to integers • f) int (*a)[10]; // A pointer to an array of 10 integers • g) int (*a)(int); // A pointer to a function a that takes an integer argument and returns an integer • h) int (*a[10])(int); // An array of 10 pointers to functions that take an integer argument and return an integer
  • 14.
  • 15.
    Question 4 Functions Function like macros How it works Input arguments
  • 16.
    Question 4 (Cont.) •Write a macro to set the MSB #define MSB(X) ((X) | (1 << ((sizeof(X)<<3) -1))
  • 17.
  • 18.
    Question 5 • Local • Global • Static • Extern
  • 19.
  • 20.
    Question 6 int main() X Y 2 1 { int x=1,y=1; 3 1 for(;y;printf("%d %dn",x,y)) 4 1 y=x++<=5; 5 1 return 0; 6 1 7 0 }
  • 22.
  • 23.
    Connect via LinkedIn http://eg.linkedin.com/in/engmohammed
  • 24.
    Hi all, I have a basic C programming query. For the program, #define MAX(x,y) (x)>(y)?(x):(y) void main( ) { int i=10, j=5, k=0; k=MAX(i++,++j); printf("%d %d %d",i,j,k); } I get the output as 12,6,11 whereas, when I modify the program as below int max_fn(a,b); void main( ) { int i=10, j=5, k=0; k = max_fn(i++,++j); printf("%d %d %d",i,j,k); } int max_fn(a,b) { return((a)>(b)?(a):(b)); } In this case, I get the output as 11,6,10.
  • 25.