Posts Tagged ‘C’

6 March, 2017

Next week, Tuesday-Thursday 14-16 March is Embedded World in Nuremberg, Germany. This is the biggest event in the world of embedded systems. I have been to the show and conference most years over the last decade and this year is no exception. The event is a very large trade show, along with a technical conference. It is the conference where I usually find myself most occupied … Read the rest of this entry »

, , , , ,

20 February, 2017

If your embedded application makes use of a real-time operating system [RTOS], like Nucleus, you will need to learn the API – the Application Program Interface. The API is a series of function calls that enable the application code to make use of the facilities provided by the RTOS. These facilities include control of tasks, timing, inter-task communication and synchronization and memory management. The number of available calls may run into hundreds, as a modern RTOS offers a wide range of functionality.

Although C is the most widely used language for programming embedded systems, many developers are keen to use C++. This opens up an alternative way to interface with an RTOS … Read the rest of this entry »

, , , , , , ,

13 February, 2017

My latest video blog is now available. I am talking about the use of inline code – a common speed optimization – in embedded systems. You can see the video here or here:

Future video blogs will continue to look at topics of interest to embedded software developers. Suggestions for topics are always welcome via comment, email or social networking.

, ,

14 November, 2016

Next week is the Embedded Conference Scandinavia [ECS], which takes place in Kista – a suburb of Stockholm, Sweden.

This is the foremost embedded event in the Scandinavian region and I have visited and presented there numerous times. This year I have the privilege of being invited to present 4 papers … Read the rest of this entry »

, , , , , , , , ,

17 October, 2016

What are you priorities when writing code? Obviously you need to implement some specific functionality and there may be a required level of performance. This is all testable or measurable. However, there are two other key goals, that are harder rate:

  1. Write code that is clear and easy to understand. I shy away from using the term “self-documenting”, but that is certainly what you should be aiming for.
  2. Make sure that the code is maintainable and extendible. It might be you that has to do future work and a little care now will make your life easier down the line.

It is #2 that I would like to focus on today … Read the rest of this entry »

, , , , ,

22 August, 2016

It is a given that structured programming – in one form or another – is a Good Thing. For years, the spaghetti of GOTOs that arose in earlier programming languages has been abhorred by all right-thinking programmers. There are good reasons for this attitude. Firstly, structured code tends to be easier to debug and, second, the code is more readable and, hence, maintainable. Both of these are productivity improvements, so the GOTO should clearly be avoided.

But, what about the break statement in C? … Read the rest of this entry »

, , , , ,

25 July, 2016

My latest video blog is now available. I am talking about the volatile keyword in C/C++, which is of vital importance to embedded developers. You can see the video here or here:

Future video blogs will continue to look at topics of interest to embedded software developers. Suggestions for topics are always welcome via comment, email or social networking.

, , , , ,

18 July, 2016

An embedded system is normally a CPU [or some CPUs] interfaced to a number of peripheral devices. The software processes data and controls the peripherals. In summary, that is what embedded systems are all about. But, of course, there are many other details and that is what occupies embedded software developers most of the time. A significant issue is around peripherals and timing … Read the rest of this entry »

, , , ,

13 June, 2016

I have frequently asserted that one of the most important attributes – maybe the most important attribute – of code is readability. This is because an enormous amount of time is spent on debugging and maintaining code – far more than that expended on writing it in the first place. So, keeping the future human reader [who might be you!] in mind at all times is essential.

Interesting challenges occur when you think about hiding text/code from the compiler … Read the rest of this entry »

, , , , , , , , ,

16 May, 2016

Embedded developers often bemoan the fact that no programming language is ideal for their particular needs. In a way, this situation is unsurprising, because, although a great many developers are working on embedded applications, they are still only quite a small subset of the world’s programming community. Nevertheless, some languages have been developed with embedded in mind. Notable examples are PL/M, Forth and Ada, all of which have been widely used, but never universally accepted.

The compromise, that has been adopted almost universally, is C … Read the rest of this entry »

, , , , , ,

25 April, 2016

There is a variety of reasons why C is so widely favored as a programming language for embedded software. It is a powerful, expressive and efficient language – these are certainly attractions. But another factor is also important: availability of expertise. C is used very widely outside of embedded, so many programmers know the language. Staffing up an embedded software project should, therefore, be quite straightforward.

However, programming for embedded systems, even if it is in a familiar language, is still different from programming a desktop computer … Read the rest of this entry »

, , ,

25 January, 2016

As any software developer is well aware, the basic process for building an embedded application is quite straightforward. Normally, the code is written in some combination of C [perhaps C++] and assembly language and distributed across a number of files [modules]. Each module is compiled/assembled to produce a relocatable object module; this file contains the machine code instructions for the target processor, but with the memory addresses left open. The numerous object modules are then joined together using a linker [sometimes called a linker/locator], which resolves the memory addresses to the required final locations and produces the absolute file, which is an image of the final system memory.

That is the simple picture. There are other nuances, like incremental linking [where a number of relocatables are joined together to make another relocatable – linking, no locating] and object module libraries … Read the rest of this entry »

, , , , , , ,

16 November, 2015

When I write an article, I am generally talking about how to do something or how something works in embedded software. I try to look at all the angles and consider the starting point of all possible readers. I do my best, but it is inevitable that I will fail. That is OK. The result is that people write to me and ask questions or request that I fill in the blanks. I am always pleased to receive questions by email or via social media, so keep them coming.

Recently, I posted about the publication of an article on Endianness. I thought that I had covered all the angles, but it seems not … Read the rest of this entry »

, , ,

2 November, 2015

My latest video blog, where I discuss language standardization and use of language extensions, has just been published and may can be accessed here or here:

Of course, using professional grade development tools, like Sourcery CodeBench from Mentor Embedded helps address these issues fully.

I am very interested in feedback and suggestions for future topics. Do get in touch by email, comment or via social media.

, , ,

10 August, 2015

It seems that hardly a day goes by during which someone does not say “This is like science fiction!” Typically, they are talking about cell phones, GPS, tablets, cars with keyless ignition – the list goes on. Only this morning, I was using Apple Pay [which has just been launched in the UK] to get my breakfast and the server smiled and said “Love technology …”.

These are all embedded systems [or the close relatives thereof] and are very complex … Read the rest of this entry »

, , ,

27 July, 2015

I have a very strong resistance to the practice of doing something [anything!] just because “it is the way we have always done it”. I love to play Devil’s Advocate [or “Devil’s Avocado” as I heard someone quip the other day] and propose change just to shake things up. It may be that the tried and tested approach is, indeed, the best, but you cannot be sure until you have considered that other options.

When it comes to embedded programming, it is easy – most people use C or similar languages. But is that the only way? … Read the rest of this entry »

, , , , , , ,

20 July, 2015

I am involved in an interesting project, with which I need some help. And that might be where you come in. I had an idea for a book and managed to persuade the inimitable Clive (“Max”) Maxfield to work with me on it. The plan is that he and I will write some sections and jointly edit the whole book. We have an agreement with Elsevier to publish the fruit of our labors, so we are now somewhat committed.

This is why I am now asking for help … Read the rest of this entry »

, , , ,

6 July, 2015

A topic that I find particularly interesting, which is raised by many embedded software developers whom I meet, is dynamic memory allocation – grabbing chunks of memory as and when you need them. This seemingly simple and routine operation opens up a huge number of problems. These are not confined to embedded development – many desktop applications exhibit memory leaks that impact performance and can make system reboots common.

However, I am concerned about the embedded development context … Read the rest of this entry »

, ,

1 June, 2015

It is common for C to provide several different ways to do something, all of which are exactly equivalent. For example, given that x is a normal int variable:

x = x + 1;

is exactly equivalent to:

x += 1;



The only possible difference is that a less capable compiler might generate slightly better code for the second and third options [which would be a hint that getting a better compiler would be worthwhile].

However, sometimes constructs that appear to be equivalent have very subtle differences … Read the rest of this entry »

, , ,

5 January, 2015

Although I regard the New Year as a time to look forward, I am continuing my catch-up process of cataloging embedded software articles that I have had published on in the recent past. This time they cover medical systems, C function parameters, the basics of multitasking and the Forth language… Read the rest of this entry »

, , , , ,

1 December, 2014

I am continuing my catch-up process of cataloging embedded software articles that I have had published on This time they cover the influence of software on power management, using a memory management unit, all about the C/C++ keyword static and the basics of multicore … Read the rest of this entry »

, , , , , , , , , , , ,

@colin_walls tweets

Follow colin_walls