Software development is generally difficult but for an embedded system, it’s on a whole new level of difficulty. Firmware developers need to have good knowledge about hardware development and understand the internal workings of an embedded processor. For today's Article, I will be sharing tools and tips that could be used to achieve a high level of efficiency and eliminate some of the things that makes firmware development tedious.
Embedded software development goes through the similar development process with "ordinary" software development. Irrespective of the development/management model adopted, Embedded Software Development generally involves below steps:
- Development of product requirement
- System Design and Algorithm Development
We will examine some of the difficulties that come with these stages and some of the tools that could increase efficiency and productivity.
1. Development of Product Requirement
Product specifications are often done with the board designers in mind. It usually contains little information that could aid firmware development thus, the embedded software developer ends up with a flawed 250 page (average) document which cannot be used for references and if not carefully considered could easily lead to oversights in design which will, in turn, lead to project time frame being extended if not overall project failure. The documents rarely contain information about registers or their bit fields among other things and this costs firmware developers several man hours as they search through the document to identify things like which register belongs to which group and which bit field belongs to which register. Below are some tips which could be considered to ensure the development of a more useful project specification documents.
Use of Register Descriptions
As discussed above, firmware developers need to understand the intricacies of all registers, memories, etc. of all control elements (CPU, MCU, etc) in a project to be able to effectively control all parts of the system. To put this in place, firmware developers can ensure the specification document carry a proper description of registers along with memory maps. All registers in the control element could be assigned a distinctive name that makes them easy to identify across the document and they could all be hot-linked such that they lead to a list within the document which states the name, location, block and address of each register.
Another way through which specification documents can be made useful to embedded software developers is by describing what each block is supposed to do and how it should do it. Also at this stage, there should be plans for error handling under each block. Essentially this looks like the firmware developer saying; “when I get here, I am to do this, this and this, ensuring this, this and that, does not occur”. This helps guide the work of the developer and helps evaluate the project even before design starts to identify potential errors and bugs, saving precious time and money.
There are other factors including document structure, the use of easy to read fonts (something the developers can work with even when fatigued), charts and pictures where possible which could all increase the efficiency of the firmware team after this stage.
2. System Design and Algorithm development
This stage involves the development of the pseudocodes, flowcharts, state machines and everything involved with the design of what the firmware. For this stage, quite a number of tools can be used to help organize thoughts, explore legacy/previously written software around the project and develop your own flowchart, state machine etc. Some of these tools are discussed below.
At these stage of the product development, developers tend to scribble a lot as they gather resources on the project from web links to formulas etc. One of the best ways to keep track of this information so they are useful later is through the use of PIM (product information management) tools. There are quite a number of PIMs out there but I will mention a few with some outstanding features.
Evernote helps you take notes that are available across any platform so you can check the note you made on your PC while in the bus home. The notes are well organized and are completely searchable so you will always find what you need.
Trunk note is a Wiki-like note taking application. It brings all the organizational power of wikis to note-taking. It is a mobile phone based application but can be easily synced with a PC via WIFI.
Other kinds of PIMs like Tiddlywiki etc. Each of them come with features that may make it more attractive to specific individuals and may take some sampling before you finally settle on one.
Understanding Legacy Code
Another group of tools which are very useful during the design stage are tools for understanding legacy codes. In situations where the product being designed is an improved version of a previous product, the developer might find it useful to review the work that has been done already to get some ideas and maybe bits of code for this new project. This might be quite a long road, especially if you were not a part of the team that built the previous software. There are quite a number of software that helps build trees, create documentation and flowcharts from already written code.
Doxygen is a quite powerful tool that helps create documentation from source codes. It was majorly designed to work with C++ but also works with C, Python and some other languages. It has the ability to extract the code structure of any code, providing automatically generated dependency graphs and Inheritance diagrams to help visualize the code.
According to their website, graphviz helps present structural information as diagrams of abstract graphs and networks. It can be used alongside Doxygen to better understand the graphics produced by it.
Srecord is a powerful tool for manipulating firmware images and converting between different file formats. It can be used to calculate and do CRCs and Checksums on byte blocks, correct error files created due to buggy toolchains, and filter or move sections of files among other things. More information on its use can be found on its SourceForge page.
Some other tools that fall under this category are CrystalRev and Hexplorer amongst others.
All the research and note-taking aggregates to the development of algorithms spinning off into pseudocodes and flowcharts for the project. Several tools exist for developing flowcharts and while most of them are not exclusive to firmware development, they provide useful and important features that simply gets the job done and also helps maintain the charts throughout the product development cycle. Below are some of the best tools out there for flowcharting.
QFSM is a graphical tool for designing and simulating finite state machines. Its ability to simulate the designs makes it way better than most of the other software in this group. It is particularly useful when you are designing state machines for FPGA and similar target hardware.
2. Lucid Chart
Lucid chart is arguably the best and most flexible flowcharting software out there. It is web-based and has team features which allow you to work between multiple devices and collaborate in real-time with teammates.
3. Microsoft Visio
Visio is one of the best graphical tools currently. It has an array of objects from different fields that makes it easy to describe anything. However, it does not come with features that enhance collaboration among teams and can only be used on a windows machine on which it is installed.
4. Google Slides
One of the key things in the development of products in today's world is the use of tools that allow teams to collaborate effectively from wherever they are and that is one thing Google slides brings onboard. It can be used to develop all kind of charts from software flow charts to organizational charts and mind maps. It is cloud-based and works in almost all the popular browsers.
Several other tools exist for the creation of flowcharts and general algorithm development, as usual, each one with its own pro and cons.
3. Coding for Embedded Firmware
Everything that has been mentioned up till this point leads here. The world of SDKs and IDEs, the choice of tools at this stage depends on the target device and the features to be built into the device, for this reason, I will exclude popular SDKs and IDEs like MPLAB, etc from the discussion and just stick to tools that are more complementary in nature.
1. QT (GUI Development)
Displays (interactive or not) are the most popular mediums for providing feedback to users these days and QT’s SDK is one of the best out there and probably no stranger to anyone within the embedded circle. It provides "drag and drop" features that make it easy to develop complex, GUI based applications for embedded devices, irrespective of the target platform, or the programming language being used for the overall project development. It basically eliminates the stress of associated with using code to create user interfaces.
2. (Fast Prototyping)
One of the biggest bottlenecks in the development of embedded software is the fact that the hardware is usually not available to test things on the go while the software is being developed. Often times when it is available, the firmware developers would have been made to wait the whole time it took for the hardware to be ready doing little or nothing. This increases the lead-time and does not create room for the kind of sync between the hardware engineers and the firmware developers that would have increased the quality of the product. To help solve this problem, the guys at VaST created an Electronic systems level virtual prototyping platform that could be used to create a virtual hardware prototype on which embedded software can be executed to determine systems performance before the hardware is ready.
3. Doxygen (Documentation)
One of the most important parts of writing any code is documentation and one of the most popular tools for that is Doxygen. Asides from its use to understand legacy software, Doxygen has the ability to automatically extract comments from a code and create documentation that includes it. Doxygen structures include files graphically and create references for every function, Variable, and macro used in your code. Flowcharts and data flow diagrams can also be embedded in the documentation by combining Doxygen with graphviz.
4. GIT (Version Control Systems)
It’s difficult to believe anyone develops software of any type without some sort of version control system these days, but just in case you do, It’s a pretty bad idea that could lead to mistakes that will cost you time and money. Git stands out among all the version control tools out there for several reasons. It is open source, fast, efficient and mostly local. Asides Git, tools like subversion are also worth mentioning.
Testing Embedded Firmware
Testing is an important part of the development process for anything. Firms lose thousands of dollars when devices are recalled due to firmware errors so it's one part of the development that should be taken very seriously. It is often done, hand in hand, with coding and the first set of tools for code testing, are probably the debuggers within the IDE or SDK being used for the project. Testing comes in different forms and is performed at different stages, as such, it involves diverse kind of tools. Testing tools form firmware development cuts across design validation to static analysis and runtime test tools. Below are few tools I find really useful.
1. Crystal REV
Crystal revs is a tool for studying code. It can be used to generate flowchart from C/ C++ code which makes it a great tool to review your own code and see if the preliminary design is what was implemented. With crystal rev, you will be able to quickly see the difference between the design and implementation. Its ability to generate flow charts, data and call flow from codes also makes it a tool, useful for analyzing legacy code.
2. PC- Lint
PC-lint is one of the oldest firmware testing tools around. It is capable of analyzing software to identify bugs, security vulnerabilities, and ensure code was written in line with industry standards. Similar tools include polyspace, and LRDA, Eggplant, and Tessy among others.
This comes in handy when building network devices. It is essentially a packet sniffer and could help view the data your device is transmitting. This could help in securing the device.
4. Virtual Serial Port Driver
VSPD by eltima software is a tool I recently got introduced too by a friend. It comes really handy when working on device drivers and other com port-related developments. The virtual serial com port gives you the ability to test com ports behavior without the target device. You could create an unlimited number of ports which is capable of emulating all the settings of real com ports. The software also comes with features like Serial port splitting, Com ports merger, use bundle com port connections amongst other cool features.
That’s it for this article, thanks for taking time out to read. While it’s impossible to probably list all the tools out there, I hope you find some of these tools useful.