Getting Started Writing Portable Firmware
Developers who want to reuse software have several challenges to overcome in order to be successful. These challenges include but are not limited to:
- Endianness
- Processor architecture
- Bus width
- Ambiguous standards
- Development time and budget
- Modularity
- Code coupling
Getting started can be overwhelming and lead to more stress and confusion than simply writing very functional code that is later discarded. The key to successfully developing portable code is to determine how well your firmware currently meets the portable software characteristics and once that is understood, decide where you want to go. To determine where you are today with developing portable firmware, start by drawing a diagram like that shown below. In the diagram, label each spoke with a portable firmware characteristic that is most important to your organization.

In each identified category, a developer can then evaluate how well their code exhibits these properties. For example, a developer who has been trying to transition into writing more portable code may evaluate themselves with a diagram result like the one below:

A quick look at the figure above can tell a developer a lot of information. First, we have strengths in documentation and modularity. That’s a great step towards developing portable firmware and we are just getting started. The figure also shows us where our weaknesses are such as code coupling and cohesion.
From this glance, we can now determine where we should start to focus our attention. Which characteristic if improved by just a couple points will most drastically improve our code? Let’s choose code coupling as example. If a developer is going to improve code coupling, they need to determine how they are going to go about making that improvement. They might decide that the best way to do this is to:
- Schedule code reviews
- Find a tool that can provide a module dependency graph
- Use the dependency graph tool (just because we have a tool doesn’t mean we have the discipline to use it)
- Develop a high-level architecture that considers module coupling
A developer may decide that improving in one area is good enough to start or that all need to be done. The point is that we aren’t going to start writing perfect, reusable code overnight. The process is iterative and may take a few years before all the rough edges are smoothed but that is okay. Below is a simple process that developers can use to improve their firmware portability:
1) Analyze their code characteristics
2) Identify strengths and weaknesses
3) Determine which characteristic to improve in the next 3 months
4) Identify what can be done to make the incremental improvement
5) Implement the improvement
6) After the specified period repeat
If you would like to learn more about how to develop reusable code, check-out “Developing Reusable Firmware – A Practical Approach to API’s, HAL’s and Drivers“
Struggling to keep your development skills up to date or facing outdated processes that slow down your team, raise costs, and impact product quality?
Here are 4 ways I can help you:
- Embedded Software Academy: Enhance your skills, streamline your processes, and elevate your architecture. Join my academy for on-demand, hands-on workshops and cutting-edge development resources designed to transform your career and keep you ahead of the curve.
- Consulting Services: Get personalized, expert guidance to streamline your development processes, boost efficiency, and achieve your project goals faster. Partner with us to unlock your team's full potential and drive innovation, ensuring your projects success.
- Team Training and Development: Empower your team with the latest best practices in embedded software. Our expert-led training sessions will equip your team with the skills and knowledge to excel, innovate, and drive your projects to success.
- Customized Design Solutions: Get design and development assistance to enhance efficiency, ensure robust testing, and streamline your development pipeline, driving your projects success.
Take action today to upgrade your skills, optimize your team, and achieve success.