Embedded Software Development for Safety-Critical Systems

Chris Hobbs is a safety engineer who works on the QNX real-time operating system. I discovered him while reading QNX documentation and that led to reading his book Embedded Software Development for Safety-Critical Systems. This book is a practical introduction for software engineers who need to develop software that is compliant to functional safety standards such as IEC 61508 and ISO 26262.

I picked up the book precisely because these IEC/ISO standards are incredibly hard to digest. This book turned out to be truly a breath of fresh air. It cut through so much of the jargon used in the above standards giving simple and elegant meanings and illustrations for all of them. For example, normal English words like fault, error and failure have distinct and precise meanings in the safety world. And when reading and writing in this space one needs to be clearly aware of these meanings.

The author has loads of experience in the safety systems field and that helps when he gives his personal opinion of many of the recommendations and procedures set forth by these standards. There is a large section of the book given to fault analysis and formal verification which I am not sure how most software would undergo.

Minor quibbles aside, I found this book to be truly enlightening and only wished it was longer and covered more of the software development process for general and more complex software that cannot undergo formal verification. If you are looking to comply to standards such as IEC/ISO this book seems like a perfect no-nonsense introductory text.


Find duplicate files using fdupes

fdupes is a great little tool that can be used to find duplicate files inside one or more directories. It does this by checking the file sizes, MD5 hashes and a byte for byte comparison of the files.

  • To install the tool:
$ sudo apt install fdupes
  • To ask the tool to find and list duplicate files inside a directory foobar:
$ fdupes -r foobar/

Tried with: fdupes 1.6.1 and Ubuntu 18.04

How to negate image using ImageMagick

The ImageMagick convert tool can be used to negate an image using the -negate and +negate options. -negate replaces every grayscale or RGB pixel with its inverted or complementary color. Use +negate when you want to restrict this operation to only work on grayscale pixels.


$ convert -negate foo.png inverted_foo.png

Tried with: ImageMagick 6.9.7 and Ubuntu 18.04

How to play WRF file

Cisco Webex sessions can be recorded and the recordings can be saved as WRF and ARF files. There does not seem to be any player for the WRF file format on Linux. If you are using Windows or Mac, you can use the Webex Player here to view the files. There is also a Webex Recording Editor that is available on the same webpage that can be used to render a WRF file to a WMV file. I tried the players and editor on Windows, and they seem to be extremely old Windows apps with basic functionality.

Andy Android Emulator

Andy is an Android emulator for Windows that claims to support a lot of features. Downloading and installing its 875MB package was easy. On launch, it shows a default VM and allows you to create more with different configurations. However, the VMs did not launch on my Windows 10 computer. Andy would not show any useful error message either.

Operation move disabled on this server


I tried to move or rename a file using the p4 move command. The p4 server responded with this error message:

Operation 'move' disabled on this server


Since the move operation has been disabled by admins on this server, we need to use two operations to simulate a move:

$ p4 integrate old.txt new.txt
$ p4 delete old.txt

How to disable Focused Inbox in MS Outlook

After my email account was moved to Exchange Online, I noticed that my Inbox in MS Outlook client looked different. The All and Unread tabs were replaced with two new tabs: Focused and Other. This was a new feature called Focused Inbox that intelligently was dividing up my Inbox email into these two categories.

After trying it for a few days, I decided I did not need it. To turn it off, go to View → Show Focused Inbox and turn it off.

How to view files over SSH using SimpleHTTPServer

It is convenient to connect to a remote computer using SSH and work at the shell. But viewing images files and other such common files can be a problem. Using a X server might not always be possible. A simple solution that works for me is to use the SimpleHTTPServer module that ships in Python.

  • Change to the directory which holds the files you want to view from a remote computer.
  • Run the SimpleHTTPServer there and provide a port number for the server:
$ python -m SimpleHTTPServer 8901
  • On the local computer, open a browser and connect to the server using the address: http://put-remote-computer-ip-here:8901
  • You can now view image files and other common file types right in the browser.

Tried with: Ubuntu 18.04

Floating point rounding modes in C++11

The standard C library has 4 floating point rounding modes available through cfenv.h. These are now available in C++11 through the header file cfenv.

  • The 4 floating point rounding modes are:
  • FE_TONEAREST rounds to the nearest integer. If the floating point value is exactly midway between two integers, then it does round half to even. The rest of the rounding modes are self explanatory.

  • None of the 4 rounding modes is equivalent to the round half away from zero which the round method does.

  • Anything to do with floating point operations is dependent on the FPU of the processor. So, the availability of these rounding modes and their values are highly dependent on the FPU of your processor.

  • On my x86_64 computer, all the 4 rounding modes were available and the values of these rounding modes were found to be:

#define FE_TONEAREST 0x000
#define FE_DOWNWARD 0x400
#define FE_UPWARD 0x800
#define FE_TOWARDZERO 0xC00
  • The FPU of your processor may support many other rounding modes in addition to these 4 modes.

  • On my x86_64 computer, I found that FE_TONEAREST was the default rounding mode when I used methods like rint and nearbyint to perform rounding.

How to use vimdiff

Vim can be used as a diff and merge tool. While it cannot match the beauty and power of GUI programs like Meld, it is immensely useful to diff and merge over a SSH session.

  • Vim can be invoked in diff mode either using vim -d or as vimdiff. Just pass in the names of the files to compare:
$ vimdiff 1.cpp 2.cpp
$ vim -d 1.cpp 2.cpp 3.cpp
  • Vim in diff mode displays each file in its own window side-by-side showing the diff sections in colors. You can switch between the windows using the normal Vim commands. (I use Ctrl-W-W.) And when you scroll down all the windows scroll down with you because they are locked to each other.

  • To switch to and fro between diffs use the ]-c and [-c commands.

  • To put the diff the cursor is resting on to the next window use the command dp

  • To pull the diff from the next window use the command do

Tried with: Vim 7.4 and Ubuntu 16.04