Don’t let chip shortages compromise safety in your design 


eBOM brings you key advice from IAR Systems on how to reduce the pain of switching MCUs, enabling you to move freely between architectures. 

Global chip shortages, largely caused by the pandemic, are forcing many companies to switch out the MCU (microcontroller) in their design. Having the flexibility and freedom to switch to another MCU, however, depends on design engineers rethinking their software development processes. Here, IAR Systems offers key advice on how to reduce the pain of switching, enabling you to move freely between architectures. 

Component shortages prevail 

When lockdown hit at the start of the pandemic, many manufacturers scaled back production. Auto makers, for example, slashed orders for ICs and silicon manufacturers reacted accordingly to cut production. Demand, however, was not as soft as expected and with more people working from home, demand for laptops and home office equipment, gaming and digital entertainment systems soared.  

The resulting supply and demand issues have seen many electronics designers frantically trying to modify their designs based on chip availability, with stories of some even trying to switch from a 32-bit architecture to an 8-bit architecture simply because those are the parts in stock. 

For safety critical designs, the issue is even more pressing. With longer development cycles and greater pressure to justify selection of a particular MCU, switching MCUs is an even more complicated process. As result of the long lead times, many companies have been forced to rethink their software development processes to reduce the pain of switching MCUs. 

How can I reduce the stress of switching MCUs? 

The answer is to make your code more portable, since structuring your code for efficient reuse makes it easier to move between architectures. Start by isolating ‘device dependent’ code and identify which parts of your design need speed. Communications systems or a customer-facing GUI, for example, must run fast or risk affecting the customer experience. For all other functions, optimize your code for size. 

Another vital technique is to use hardware abstraction layers. Hardware abstraction layers are sets of routines in software that provide programs with access to hardware resources through programming interfaces. It provides a set of standard functions that can be used to access hardware functions without a detailed understanding of how the hardware works. 

Header files can also enable better reuse of developed code. Use header files that can implement global changes to the code from one location. And finally, trust the compiler to do the optimization for you! You may be used to tweaking code, particularly if you have been using a less capable optimization tool, or perhaps hand optimizing to get the code footprint down so it fits the Flash available on your device. If you have the right tools for the job, however, they will be able to optimize your code far more effectively, making reuse much easier and faster to implement. 

Prioritizing code quality 

Using a standardized and certified tool chain for all MCU architectures can greatly reduce costs and simplify the procurement process. IAR’s Embedded Workbench, for example, helps you structure your application for reuse.  

One of the primary factors that affect code reuse is code quality. Higher quality code has less defects, helping you to get to market faster, but how can you improve quality and reduce technical debt? Perhaps the fastest way to improve code quality is to employ code analysis tools. They can quickly find common sources of bugs in your code as well as helping you to adopt coding standards. In fact, coding tools are often required if you are looking to implement functional safety certification. 

Having the right tools and services at your disposal will help you enforce the required standards and quality in your source code, making it easier to migrate to different hardware should the need arise. Whether your specified MCU comes back in stock or not, prioritizing code quality and reusability will help you future proof your design, particularly safety designs, ensuring you have a competitive advantage – during the current chip shortages and beyond. 

Company: IAR Systems  


Additional products to consider...