This content originally appeared on Level Up Coding - Medium and was authored by Wassim Dhokar
Embedded system area although it has been considered from many software developers as old as dinosaur time but still in our days and will remain quiet critical and important for all types of technologies, even for high level software development we cannot write software without having a hardware and more you have better understanding of this hardware more you can write efficient and solid software code for it.
Most of the big tech companies (like Apple, NVIDIA , Samsung, Intel …) requires this embedded system programming skills and you can see already in their workday job opportunities plenty of open positions related to embedded system development, so having good understanding of embedded systems will clearly boost your chance to work on one of those big tech companies across the world.
Nevertheless going through the interview process and to be more precise through the technical challenges and questions for an embedded system position is not something trivial and obvious to handle, therefore will try to give you some hints, tips and ideas on how to have successful interview process and why not getting you dream position!
Embedded System programming not a usual Software to write
We need to keep in mind that embedded systems programming is writing software for hardware so it involves both knowledge on Hardware and Software.
Based on that most of the embedded systems interviews technical parts will cover those two aspects.
Hardware Related Questions and Answers
In term of questions this may differ of course from one company to another, also depends from the position grade and level (entry position , Senior …), however what matter really is the answer and the knowledge you have.
Example of some hardware related questions will be like below:
- What is a microcontroller?
- What is an MMU?
- What is an Interrupt?
- Which memory area used for code and which one used for data?
- Definition of Interrupt Latency?
- How Interrupt Handling works on specific processor? (can be ARM cortex-m/cortex-a/cortex-r or RISCV based processors or Intel …)
- The advantages of using Cache memory?
Now some of those questions may looks quiet basic and some may looks advanced, however what is important during the interview is not the question itself, what is much more important and critical here is the way you answer the question and how in depth you can go with your answer and explanation because how far you can go with the answer will reflect how you see things based on your own experience as well as how knowledgeable you are on that topic.
To explain you what I mean here let’s take the below example question:
- Definition of Interrupt Latency?
The answer to this trap question will tell the interviewer many things about you and your experience here, some answers and meaning of each one of those answers:
1- “Interrupt Latency is the amount of time between the moment the Interrupt is asserted until the moment the interrupt handler start executing.”
→ For such question this is considered as basic answer and actually good to say it but for sure it is not enough to show you know all aspects and how hardware is acting during interrupt latency timeline.
2- Here we will say the above answer that has been highlighted in ‘1’ and we will add on top of it the following : “Interrupt Latency consists of the time required to finalize the execution of current instruction when the IRQ is asserted , plus the time needed to fetch the vector table address needed to determine the location of IRQ handler to jump to and finally the time required to backup the CPU state by saving CPU registers into internal sram stack area.”
→ Well this looks more in depth answer and we have explained in more details the composition of this latency time as well as giving an overview how the processor is handling the context switching from main program to interrupt handler, with this kind of answer we are making good impression on interviewer side, now let’s checkout this last answer
3- In this answer we will keep what has been stated in answer ‘1’ and ‘2’ and we will add in top the following: the Interrupt latency is not always the same and depends from many factors, for instance if Interrupt vector table is located in flash not in sram then fetching the location of targeted IRQ handler out of vector table will take longer than when having the vector table in sram not flash, also if we are having big traffic going on on Bus interconnect then serving IRQ context switching may get delayed until higher prio transaction get served first and of course we will have architecture based dependency like is it the processor who is going to save the context into stack automatically like in cortex-m or we are going to manage this backup routine by software at interrupt handler entrance like in cortex-a and riscv based processors.”
→ Here we have went quiet far in our answer and this will tell the interviewer that you know what is going on on hardware background and will impress the interviewer positively.
This was just an example but what we need to keep in mind is :
- Start by giving clear and easy answer without adding any complexity to show the interviewer that you know the concept he is asking for, plus to get some relaxation and confidence when going to explain in more details
- Make your answers properly structed after starting by basic definition, go incrementally in much complex explanation and make it slowly , remember always that no body is running after you here!
- Finally don’t hold back details and information thinking that what you have said is enough, give it all but without exaggeration, means don’t make it as one way communication path and try to be more interactive with the interviewer ,be precise with all the details you are giving and pointing to what the interviewer want to hear!
Software Related Questions
Software related questions for embedded systems programming are different from hardware based questions as well as from software questions targeting high level programming languages.
Most of the focus will be on algorithmic, and how to implement data structures that fit with embedded systems requirements(like Stack, Heap, arrays…) as well as optimizing the written software for code size and performance which are two critical and important aspects on embedded system hardware.
The good thing at least with embedded system software is the focus on C language as this one is the dominating language for embedded systems programming.
Below some example of embedded system software related questions:
- Implement Stack in C
- Implement Heap in C
- Sort an array from mic to max
- Search for the min in an array in C language
- Search for the max in an array in C language
- Optimize C loop for performance purposes
Same as hardware based questions, the way you write your code and implement such algorithms and data structure will reflect your level of expertise in regards to the interviewer, therefore take your time to prepare to the interview and to cover those basic implementation, for embedded system position you don’t need in general fancy software skills or coding but you need to know the impact of code when getting executed by hardware.
In below example we are having a C based loop where we assigning some data within an array then we modify some memory location to indicate that the array has been updated:
#define memory_signal *(volatile uint32_t*)0x20000000
for(int i = 0; i < 100; i++)
{
array[i] = i;
memory_signal = 0x1234;
}
The code by itself may look quiet simple and even non-sense but for embedded systems it hides in background too much information, so you may get the question from the interviewer to optimize this loop for performance:
1- You may try to do what is called unrolling the loop by increasing the incremental step instead of 1 to be 2 like below, this technique is well known and help to minimize the amount of time required to increment the loop which you think this this is the reason behind having better performance , this answer looks ok but will bit kind of trap to you if you don’t provide further explanation:
#define memory_signal *(volatile uint32_t*)0x20000000
for(int i = 0; i < 100; i+=2)
{
array[i] = i;
array[i+1] = i+1;
// we write twice to same address location to highilight that we did twice the update
// from software perspective this may look ugly but from system perspective
// we may have another processor running a process polling on that address
// or writing to that address location will fire an IRQ within anothe processor
memory_signal = 0x1234;
memory_signal = 0x1234;
}
→ Now the trap question is why you think unrolling the above loop will be beneficial? so writing above unrolled loop is not enough as an answer, you will need to explain further the reason behind.
2- Beside above optimized code you can proceed explanation why you think this is beneficial for performance purposes: “With unrolled loop we are minimizing in this example the number of required iteration by half, this means we are dividing the number of branch decision within the loop by half to decide if we go out of the loop (100 iterations are don) or we continue iterating, and we know that branch instruction has significant penalty at processors pipeline level, also we can benefit from the processor capability to generate burst transaction at Bus level which minimizes the required steps to update the array (depends of course if the Bus interconnect does support Burst transaction or not).”
→ our answer looks now much better but still though we are missing something here, why we may think this optimization will work as expected and not the other way around? we will need here to highlight some drawbacks of unrolling the loop and that we may have some dependency to how the hardware is working , with that we are creating the link between our software and hardware behavior and this is what an interviewer is looking for an embedded systems candidate.
3- we keep answers from 1 and 2 and we add the following : “ in some cases unrolling the loop is not a good choice due to many factors, for instance if our hardware is making some kind of memory access re-ordering or optimization ,then the signaling of array update when writing to the address memory_signal will not occur in order as the hardware will do some unwanted re-ordering and optimization ,and instead of having two accesses two memory_signal we will have only single one, this will make our optimization impacting the expected behavior of our program, also if we have support of cache memory we will have more cache misses as we are going to access two different addresses ranges much more frequently (array address range and memory_signal address ranger, instead of single access to each address range each iteration we will have two), and finally the code size will become bigger here as we have added extra lines of code compared to the original code.”
→ now this looks much better ,with our answer we are covering now more aspects and we showed to the interviewer that we have good understanding of overall interaction between embedded software and hardware.
Conclusion
Weather you have experience or you are just a Student trying to start new career in embedded systems programming, it is almost the same when it comes to passing successful interview, you should:
- Take your time to prepare for the interview
- Be relaxed and show your confidence and that you are having everything under your control.
- Be precise in your answer and go right a way to the point.
- Even if you don’t know an answer just be honest and say I don’t know, however if you may think you can give approximate solution for the question with on the fly analysis then go ahead and do it, just state you don’t know the answer as for now but will try to answer based on my own analysis.
- Don’t hold back information and details but also don’t give more than needed, so something in between.
Good Luck for your interview and don’t forget to subscribe to get further technical articles, and hints that may help you to pass your interview and why not getting your dream job!
Tips and Hints for a Successful Embedded Systems Interview was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Wassim Dhokar
Wassim Dhokar | Sciencx (2024-08-11T17:00:09+00:00) Tips and Hints for a Successful Embedded Systems Interview. Retrieved from https://www.scien.cx/2024/08/11/tips-and-hints-for-a-successful-embedded-systems-interview/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.