Programming In Hand-coded Assembler is Alive and Well at OK.
One of the appeals of doing embedded software development is the opportunity to build software that is based on good design principles and then to squeeze out every ounce of performance through a series of optimization techniques.
Hand coding a program in assembler (ASM) is one of the most challenging, yet rewarding approaches to optimizing a program. Using this approach, a programmer writes code directly using a human- readable notation of the target machine's architecture. This allows them to make full use of the architecture's instructions and features, perhaps more so than a C compiler. Many application developers dismissed hand coding of assembly decades ago as processor and compiler technology improved to the state where there was little benefit in spending the time it takes to write in ASM.
So, why is it so important for OK? Well, even with today's compiler technology, we find that we can still optimize our critical code paths by writing them in ASM with a significant performance benefit. We usually achieve between a two and four fold increase in performance compared to the original implementation. For example, the open-wait IPC call on ARM is 345 cycles in C, versus 198 cycles when hand-coded. Not bad huh?
We focus this optimization effort for critical code paths in the OKL4 microkernel. These are important as they are invoked frequently by applications and other RTOS code which contributes to the operating system's overheads. For an example, download our public source release and take a look at the generic (ipc.cc) versus optimized IPC path (traps.spp).
Dr. Daniel Potts, Director of Engineering at OK Labs, heads up the engineering team and oversees the development our products. Dan enjoys working closely with his team, and ensuring that they have everything they need to focus on producing high quality products. When not working, you'll find Dan at the beach or swimming laps at the pool.