Wednesday, March 21, 2012

Firmware Interview Excercise

Recently I thought of a good job interview excercise for a potential firmware engineer. Here is the excercise for your use, plus guidlines of how to grade it:

Write on the whiteboard C/C++ code to read a memory mapped register, clear a bit, then write it back.

Things I don't care about:
  • If there are any simple syntax errors or missing semicolons.
  • The variables types used, as long as the candidate knows how many bits they are (int, versus uint32, versus DWORD).
Things I do care about:
  • Was the "volatile" keyword used when declaring the variable that would point to the register? (I would hope that the value we get from the register is a fresh, uncached value).
  • Did the candidate ask how big the data bus of the system is? (How else would I know how the pointer type?)
  • Was it second nature to use the "wordwithbittoflip &= ~MASK" convention.
  • Did the candidate ask whether a MMU is being used? (need to make sure you are accessing physical memory, not virtual)
  • Did the candidate ask what OS is being used, if any? (tracing back to the MMU question, if there is one being used, getting access to physical memory will vary from OS)
Bonus points:
  • The candidate uses bit banding for increased speed.
  • The candidate wonders if the system is big or little endian when setting up the mask.
Next chance I get to interview someone maybe I'll give it a shot. It is consistent with Joel On Software guidlines to have the interview candidate write simple, non "gotcha" code. The above should be simple for anyone with embedded experience.


  1. Nevertheless, analyze it all out minus the dumbbell first; just to acquire a sense of the way it all performs. It must be presented in the same way that it is being held in the example from the Daniel DeMoss site i.e. involving the hip and legs if you do make a decision try using a weight. Usually do not keep it almost every other way or you do run the risk of decreasing it.

  2. Wonderful, just what a blog it is! This blog has provided the helpful data to us continue the good work. สล๊อตlive22

  3. The number 1 online movie website in Thailand See all free movies, can watch both pc and mobile phone. New movies, hit movies, cinema updates only Watch netflix movies for free