Browsing All posts tagged under »ansi c«

Inline assembly in GCC [linux-insides]

May 2, 2016


The news site lwn just posted a guide on GCC inline assembly. The guide is written in plain colloquial language and is a great complement to GCC documentation on the matter, which is more of a reference of the various functionalities. I found that the extended form of inline assembly is a powerful way to use the machine special […]

Arduino interrupts in C: implementing a time switch

December 15, 2014


This post continues the series of simple Arduino applications written in C instead of the official Arduino language and IDE. See the previous posts about the basics, using a buzzer and a LED matrix. The goals of using C are mainly to understand better the microcontroller, to reduce the needed resources in terms of code memory, RAM and […]

Drawing on a 7×5 LED matrix with Arduino in C

November 15, 2014


In my component drawers I have a LTP-7357AG, which is a matrix of 35 green LEDs conveniently packaged in a 12-pin display. I wanted to play with it so I began to hook it with my Arduino Uno. This post is part of a series about programming Arduino applications in C. I’m going to show the results first, […]

Sticky Bits » Vulnerabilities in C : When integers go bad!

October 25, 2014


Sticky Bits posted a lesson on C integers that explains the common pitfalls (and some uncommon ones) of arithmetic operations. It contains information that any C developer should know but that is often overlooked, and that might be the cause of many bugs that can result in misbehaviour or security issues. I think it’s written in […]

Using a buzzer with Arduino in pure C

October 15, 2014


Since one of my most viewed posts is Programming Arduino Uno in pure C, I wanted to write other posts about common Arduino functionalities implemented in C instead of the default language. This post is part of a series about programming Arduino applications in C, using a Debian computer with avr-gcc compiler. This time I’m using a buzzer […]

Eric S. Raymond: Time, Clock, and Calendar Programming In C

October 9, 2014


esr (of The Cathedral & the Bazaar fame) has just written a comprehensive guide on the many functions, structures and styles for dealing with time in C, mostly for UNIX, Linux and POSIX operating systems. It’s especially direct in marking obsolete functionalities, stuff that shouldn’t be used, pitfalls and recommendations. I’m sure he struggled with these APIs […]

Analyzing C source files dependencies in a program

November 24, 2013


This post shows an approach to draw graphs representing the dependency of C source files and modules throughout a complete program. The implementation of this method uses the functionalities of GNU ld to create a cross reference table, then NetworkX to create a graph and Graphviz to visualize it. The approach is applied to a simple example and a real embedded application (U-Boot).

A bug that always gets me

October 21, 2012


This week I made an error that I already repeated at least twice in my career; it doesn’t seem to stick in my brain. I’m going to write about it here, so that maybe I will stop doing it, and maybe it will prevent the same kind of error for my readers. Let’s see if you can spot […]


October 18, 2011


I’ll probably never be as good, I’ll certainly never stop trying. The things we take for granted today are the revolutions of yesterday.

A nasty string initialization bug in C

May 31, 2011


Today I encountered a bug that was quite difficult to find regarding strings. In order for strings to work they must be null-terminated, and this implies that an array of characters can contain a string with a length equal to the array size minus one, because there must be space for the null character. I […]