Archive for the ‘Uncategorized’ Category
Monday, July 18th, 2016
Something that I have discovered over the years is a great pleasure. When I am giving information – presenting, teaching, writing an article or a blog – it is not necessarily a one-way process. I often receive useful and interesting information back. I have commented that I learn as much from delivering a class as I might from attending one.
I was recently talking about C++ for embedded at a conference and considering some of the features that I felt resulted in better, clearer and more bug-free code. One of these was the option to pass parameters by reference. Then someone explained a drawback of this feature …
Thursday, June 16th, 2016
I am [mostly] a fan of using C++ for embedded applications. I believe its use needs care, but broadly, I feel that it offers many simple improvements over C and appropriate use of object oriented techniques can be very beneficial. Today I want to talk about the place of C++ as a “better C language”. There are numerous syntactical improvements that can be leveraged to make code just a little more readable and maintainable.
However, there are some minor “quirks” that can catch the unwary programmer. Who would have thought that you could go wrong with a plain old for loop? …
Monday, May 16th, 2016
A common compiler optimization is the inclusion of a function’s code at the location(s) from where the function is called, instead of just having calls to the code located elsewhere: inlining. This provides a speed advantage, as the call/return sequence is eliminated, but may increase the memory footprint, if the function is more than a few instructions and is called more than once. I have written about this topic before, here and here.
I have an enduring interest in code generation and compiler optimizations and my consideration of inlining was piqued by a recent comment on one of my earlier posts. I realized that there are two implementation related aspects of inlining which are particularly relevant to embedded software developers …
Monday, April 18th, 2016
I was writing recently about my fondness for RPN [Reverse Polish Notation] and this reminded me of a programming language, designed specifically for real time and embedded applications, which has largely been forgotten: Forth. It is interesting to look at how Forth worked and the benefits it offered for embedded developers. I am not proposing that the language be revived and used for new developments, but I think there are valuable lessons to be learned.
My attention was originally draw to Forth when somebody told me that there was a programming language which facilitated the generation of code using less memory than an assembly language implementation of the same functionality. I did not believe them, but it hooked me in …
Tuesday, March 15th, 2016
Since the earliest days of computers, they have been used for real time control applications. In the 1960s and early ‘70s, it was common to use a small mainframe or a mini-computer to control machinery or instrumentation. These computers typically ran under the control of a specialized operating system, which was designed for real time use. Examples include RSX-11 and RT-11, which were used on DEC PDP-11 machines.
These “real time operating systems” were typically interactive and worked similarly to those used for data processing applications. An operator command would start, control and stop the real time application programs. They could also be configured to be “turn key”, so that switching on the computer would cause the OS to be booted, which would then start the applications automatically. With the advent of microprocessors and, hence, embedded systems, a new approach was needed … (more…)
Monday, February 15th, 2016
I like simple things. Excessive complexity tends to annoy me. When I first started working with computers, I thought that mainframes were overly complicated, so I was pleased to discover minicomputers, where I could really understand exactly what was going on. Embedded software was a natural progression, as, again, I could grasp the entire functionality of the software. But that began to change, as commercial real time operating systems and other software IP became more common. Everything became more complex and invisible.
I am not saying that this situation is necessarily a problem or that all complexity is intrinsically bad. It is just that sometimes I yearn for the simple life. It might be suggested that perhaps the world of software is not the best place for me, but I will ignore those murmurings and consider where simplicity might still be appropriate … (more…)
Thursday, January 14th, 2016
I like being right. Who does not? I am also interested in programming languages. Part of their appeal is that, unlike almost all spoken languages, they have a precise definition or specification to which implementers endeavor to comply. Many languages, like C and C++, have ANSI/ISO standards, which nail down many of the details. These standards tend to be imperfect and aspects of the language can remain rather insecure, as implementers have too much latitude. This is why organizations such as MISRA publish detailed usage guidelines to avoid the problem areas. C++, in particular, gives some interesting opportunities to write obscure code, which I have written about here before.
I was concerned, when I first started to learn C++, that there was a flaw in the language. Some years later, I got the whole story … (more…)
Tuesday, December 15th, 2015
I have pondered for some time the appropriateness of Linux for embedded applications. My initial stance was clear enough: I could see very little sense in it. Why use a desktop operating system in such a completely different context? Over the years, the popularity of embedded Linux has increased, the technology of embedded systems has moved on and I have reappraised my views accordingly. I thought it was worth revisiting the philosophical debate … (more…)
Monday, November 16th, 2015
When you use a function in C/C++ (or most other programming languages) you are likely to pass it some parameters – data which may be processed by the function or give it information on what action is required. For the majority of programmers, outside of the world of embedded software, parameters are just a fact – no real issues. They are likely to be quite uninterested in how parameters are passed and how efficient and secure that process that might be. Embedded developers tend to want details. Efficient code is essential and avoiding possible bugs is always desirable. So, maybe a look at how parameter passing actually works might be useful … (more…)
Thursday, October 15th, 2015
I have a very basic question for you: what do you do and why do you do it? It is quite possible that, if you are reading this, you are an embedded software engineer. It is interesting to consider what that job actually entails. First off, how would you reply to the “What do you do?” question from someone you meet in a pub/bar? You would probably say Software Engineer, but they might ask you to expand on that. [Actually, such a reply can be a complete conversation killer. You might be better to reply with Airline Pilot or some such. Just invent a new persona and have some fun.]
It is easy to think of an embedded software engineer’s job as being all about writing code that programs a device to behave in a particular way. But that is a long way from the whole story… (more…)