EmbeddedRelated.com
Memfault Beyond the Launch

The habitat of hardware bugs

Yossi Kreinin July 13, 20163 comments

The Moscow apartment which little me called home was also home to many other creatures, from smallish cockroaches to biggish rats. But of course we rarely met them face to face. Evolution has weeded out those animals imprudent enough to crash your dinner. However, when we moved a cupboard one time, we had the pleasure to meet a few hundreds of fabulously evolved cockroaches.

In this sense, logical bugs aren't different from actual insects. You won't find...


How to make a heap profiler

Yossi Kreinin May 23, 20141 comment

We'll see how to make a heap profiler. Example code for this post makes up heapprof, a working 250-line heap profiler for programs using malloc/free.

It works out of the box on Linux (tested on "real" programs like gdb and python). The main point though is being easy to port and modify to suit your needs. The code, build and test scripts are at github.

Why roll your own heap profiler?

  • It's easy! And fun, if you're that sort of person. What, not reasons enough? OK, how...

Delayed printf for real-time logging

Yossi Kreinin October 25, 20133 comments

You often debug by adding a few printfs and looking at the logs. In some real-time/low-level contexts though, you don't have time for text formatting.

You don't want prints to affect timing too much, because then timing-related bugs you're chasing might disappear. And you certainly don't want the system to stop functioning altogether because prints cause it to miss real-time deadlines.

A common alternative to prints is more "raw" logging - an event buffer, where event is a union keeping...


Coroutines in one page of C

Yossi Kreinin August 20, 201316 comments

A coroutine is a function that you can jump back into after returning from it - and it remembers where it was in the code, and all the variables. This is very useful at times.

One use is generating a sequence of values. Here's how you can generate all the x,y pairs in a 2D range in Python:

def iterate(max_x, max_y): for x in range(max_x): for y in range(max_y): yield x,y for x,y in iterate(2,2): print x,y

This prints:

0 0 0 1 1 0 1 1

The yield keyword is like...


How FPGAs work, and why you'll buy one

Yossi Kreinin June 20, 201315 comments

Today, pretty much everyone has a CPU, a DSP and a GPU, buried somewhere in their PC, phone, car, etc. Most don't know or care that they bought any of these, but they did.

Will everyone, at some future point, also buy an FPGA? The market size of FPGAs today is about 1% of the annual global semiconductor sales (~$3B vs ~$300B). Will FPGA eventually...


How FPGAs work, and why you'll buy one

Yossi Kreinin June 20, 201315 comments

Today, pretty much everyone has a CPU, a DSP and a GPU, buried somewhere in their PC, phone, car, etc. Most don't know or care that they bought any of these, but they did.

Will everyone, at some future point, also buy an FPGA? The market size of FPGAs today is about 1% of the annual global semiconductor sales (~$3B vs ~$300B). Will FPGA eventually...


Coroutines in one page of C

Yossi Kreinin August 20, 201316 comments

A coroutine is a function that you can jump back into after returning from it - and it remembers where it was in the code, and all the variables. This is very useful at times.

One use is generating a sequence of values. Here's how you can generate all the x,y pairs in a 2D range in Python:

def iterate(max_x, max_y): for x in range(max_x): for y in range(max_y): yield x,y for x,y in iterate(2,2): print x,y

This prints:

0 0 0 1 1 0 1 1

The yield keyword is like...


Delayed printf for real-time logging

Yossi Kreinin October 25, 20133 comments

You often debug by adding a few printfs and looking at the logs. In some real-time/low-level contexts though, you don't have time for text formatting.

You don't want prints to affect timing too much, because then timing-related bugs you're chasing might disappear. And you certainly don't want the system to stop functioning altogether because prints cause it to miss real-time deadlines.

A common alternative to prints is more "raw" logging - an event buffer, where event is a union keeping...


The habitat of hardware bugs

Yossi Kreinin July 13, 20163 comments

The Moscow apartment which little me called home was also home to many other creatures, from smallish cockroaches to biggish rats. But of course we rarely met them face to face. Evolution has weeded out those animals imprudent enough to crash your dinner. However, when we moved a cupboard one time, we had the pleasure to meet a few hundreds of fabulously evolved cockroaches.

In this sense, logical bugs aren't different from actual insects. You won't find...


How to make a heap profiler

Yossi Kreinin May 23, 20141 comment

We'll see how to make a heap profiler. Example code for this post makes up heapprof, a working 250-line heap profiler for programs using malloc/free.

It works out of the box on Linux (tested on "real" programs like gdb and python). The main point though is being easy to port and modify to suit your needs. The code, build and test scripts are at github.

Why roll your own heap profiler?

  • It's easy! And fun, if you're that sort of person. What, not reasons enough? OK, how...

Memfault Beyond the Launch