Barr Group FacebookBarr Group TwitterBarr Group LinkedInBarr Group Vimeo

How to Prevent and Detect Stack Overflow

The safety and security of every embedded system is dependent upon proper operation of the stack (or stacks, if there are multiple). If a stack overflow occurs, a major or minor malfunction is very likely to follow. Despite this, the stack in the majority of embedded systems is sized based on nothing more than a hunch. As well, run-time stack monitoring is too seldom used.

How to Make Embedded Software Smaller and Faster

We've all heard it before - "premature optimization is the root of all evil" - yet many embedded systems have reliability, cost, and performance requirements that demand a development style where we optimize early and often. Performance needs to be designed into a system, from architecture to algorithms to data structures to coding guidelines.

How to Minimize Interrupt Service Routine (ISR) Overhead

 Printable PDF

With all the automation available today, it's easy for programmers to overlook costly overhead introduced into machine code by the compiler. Interrupt handlers are one key area worthy of a closer inspection.

How to Use C's offsetof() Macro

 Printable PDF

C's seldom-used offsetof() macro can actually be a helpful addition to your bag of tricks. Here are a couple of places in embedded systems where the macro is indispensable, including packing data structures and describing how EEPROM data are stored.

Optimal C Constructs for 8051 Microcontrollers

 Printable PDF

The limitations of an 8-bit microcontroller (MCU) can sometimes make conventional C constructs produce suboptimal code. In this article we look at common problems on the 8051 family and discuss workarounds in C.

MISRA-C Guidelines for Safety Critical Software

 Printable PDF

In 1998, the UK's Motor Industry Software Reliability Association established a set of 127 guidelines for the use of C in safety-critical systems. Here's a look at the rules, what they mean, and how they can work for you.

How to Use Lint for Static Code Analysis

 Printable PDF

Language specifications, including those for C and C++, are often loosely written. A static analysis tool called lint can help you find dangerous and non-portable constructs in your code before your compiler turns them into run-time bugs.

How to Use C's volatile Keyword

 Printable PDF

The proper use of C's volatile keyword is poorly understood by many programmers. This is not surprising, as most C texts dismiss it in a sentence or two. This article will teach you the proper way to do it.

Have you experienced any of the following in your C or C++ embedded code?

How to Use Strings to Internationalize C Programs

 Printable PDF

Products destined for use in multiple countries often require user interfaces that support several human languages. Sloppy string management in your programs could result in unintelligible babble.

How to Use the C Preprocessor's #error Directive

 Printable PDF

One of the least used but potentially most useful features of the C preprocessor is the ANSI-specified #error directive. Here's a look at a couple of clever uses for #error that have proven invaluable in embedded software development.

The syntax of #error is very straightforward:

Pages

What’s happening and how it’s done. Get in the know.

Sign up for our newsletter today!

Receive free how-to articles, industry news, and the latest info on Barr Group webinars and training courses via email. 

To prevent automated spam submissions leave this field empty.