Author Archives: Niall Cooling

About Niall Cooling

Co-Founder and Director of Feabhas since 1995. Niall has been designing and programming embedded systems for over 30 years. He has worked in different sectors, including aerospace, telecomms, government and banking. His current interest lie in IoT Security and Agile for Embedded Systems.

Function Parameters and Arguments on 32-bit ARM

Function call basics

When teaching classes about embedded C  or embedded C++ programming, one of the topics we always address is “Where does the memory come from for function arguments?“

Take the following simple C function:

void test_function(int a, int b, int c, int d);

when we invoke the function, where are the function arguments stored?

int main(void)

Unsurprisingly, the most common answer after “I don’t know” is “the stack“; and of course if you were compiling for x86 this would […]

Posted in ARM, C/C++ Programming, Cortex | Tagged , , | 5 Comments

My Top 5 Podcasts

For the final blog post of the year I’ve decided to do something a little different; I hope that’s okay?

Due to the nature of the job, the technical team at Feabhas spend a lot of time travelling. This means many an hour spent in the car driving to and from client sites; often involving navigating the wonderful M25 London orbital [car park!]. We all while away this time in different ways, some prefer music, others radio (which, being in the […]

Posted in General | Tagged | Leave a comment

Vulnerabilities in C : When integers go bad!

Insecure C?

We are at the dawn of a new era of connected embedded devices, broadly being marketed as the “Internet of Things” (IoT). The majority of these systems are likely to be programmed using C/C++. To date, much of the embedded world has been connected to propriety networks, however with the gold rush in to IoT we are not going to be able to rely on “Security through Obscurity“. This is the first in a series of articles looking […]

Posted in C/C++ Programming | Tagged | 2 Comments

goto fail and embedded C Compilers

I can’t imagine anyone reading this posting hasn’t already read about the Apple “goto fail” bug in SSL. My reaction was one of incredulity; I really couldn’t believe this code could have got into the wild on so many levels.

First we’ve got to consider the testing (or lack thereof) for this codebase. The side effect of the bug was that all SSL certificates passed, even malformed ones. This implies positive testing (i.e. we can demonstrate it works), but no negative testing […]

Posted in ARM, C/C++ Programming, Industry Analysis, Testing | Tagged , , , , , | 5 Comments

The Top 5 Things I’ve Learnt about Git

During the last couple of years, internally we’ve moved over to using Git as our Revision Control System (RCS). It’s been an interesting exercise, especially where, like me, you’ve come from a traditional model (such as subversion or even back to good old SCCS). I’m sure you’ve all got your own “top 5” and I don’t necessarily expect you to agree with me, but here’s my key learning points:

#1 “Branch always, branch often”
At the outset this was […]

Posted in General | Tagged , , , | 1 Comment

UK based One-day ARM User Conference (and it’s free!)

For those of you that are not on our company hit list, sorry I mean mailing list, then you may not have heard about next week’s ARM User Conference run by the good folks at Hitex UK.

The event is titled “ARM – Continually Raising the Standard” and is being held at Stoneleigh Park near Coventry on the 19th September 2013. This year there are two streams running to allow a wider choice of presentation.

The event is also preceded by a number of (paid) workshops on […]

Posted in ARM | Leave a comment

ARM TechCon 2013

ARM’s Technical Conference called TechCon™ is running between October 29th and 31st at the Santa Clara Convention Center in California.

This year I shall be making the trip over to present three classes:

Can Existing Embedded Applications Benefit from Multicore Technology?
Virtual Functions in C++ on the ARM Architecture
Developing a Generic Hard-Fault Handler for ARM Cortex-M3/Cortex-M4

For those of you who are regular readers of this blog you’ll recognise the Generic Hard-Fault Handler from a previous post.

The class “Can Existing Embedded Applications Benefit from […]

Posted in ARM, C/C++ Programming, Cortex | Tagged | 3 Comments

Style vs. Substance in C programming

In an email from UBM Tech this week there was a link to an article titled “A Simple Style for C Programming by Mansi Research“. It was actually authored back on May 2010 by Meetul Kinariwala but appeared this week under the what’s hot section, so I thought I’d take a look [advice to the reader; don’t bother].

The problem with guides like this is that style is a very subjective area (as any parent will tell you how their kids […]

Posted in C/C++ Programming, Design Issues, General | Tagged , , | 7 Comments

Test Driven Development (TDD) with the mbed

One of the most useful fallout’s from the acceptance of Agile techniques is the use of Test-Driven-Development (TDD) and the growth of associated test frameworks, such as GoogleTest and CppUTest, etc.

I won’t get into the details of TDD here as they are well covered elsewhere (I recommend James Grenning’s book “Test Driven Development for Embedded C” for a good coverage of the subject area), but the principle is

Write a test
Develop enough code to compile and build (but will fail the test)
Write the application code […]

Posted in ARM, C/C++ Programming, CMSIS, Cortex, Testing | 4 Comments

Rehosting ARMCC for the mbed with CMSIS-DAP

In this posting I will look at porting the C standard library output (e.g. puts / printf ) to use a UART rather than the default ARM/Keil semihosting.

In my last post, I looked at getting basic user I/O out from a native-mbed via UART0 to a terminal emulator (e.g. Tera Term). This was driven by the fact that, currently, neither printf (via semihosting) or ITM_SendChar do not function on the mbed. Unfortunately, my solution uses a propriety API, such as init_serial0 and putchar0, […]

Posted in ARM, C/C++ Programming, CMSIS, Cortex | 3 Comments