Embedded Software Quality Assurance (QA)

[ad#Google Adsense – Wide Banner] As for every software there needs to be quality assurance testing for embedded software with a special focus on reliability since this is often key in embedded systems. Software testing / QA may be a very controversial subject as everybody may have very diverging and strong opinions on how it should be done, and the way it is done also depends on the company culture (and size). So here’s the way I personally see the different steps to testing, please let me know if you feel otherwise in comments. Unit Testing: This is the lowest type of test (white box testing) where the developer should check the implemented functions work as expected Functional Testing: Although the software team should check if the main functionalities of the software work properly before committing the code (assuming you are using a version control system and you should), QA […]

sudo inside a cron job

If some reasons you need to use sudo in a cron job, for example if you use ltib (Linux Target Image Builder)  in a nightly build script, you may realize that it does not work by default and you may get the message: sudo: sorry, you must have a tty to run sudo In that case simply run visudo and comment out the line: #Default requiretty Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Replacing tabs by spaces in vi

In order to have code formatting consistency, we may choose to use only tabs or only spaces in the source code. We chose to only use spaces since that makes sure the code will be properly formatted in any text editor. In order to create 4 spaces while pressing tabs in vi, edit your vi settings: vi ~/.vimrc and add the 3 lines below to your config file set tabstop=4 set shiftwidth=4 set expandtab The next time you’ll use vi, pressing the tabulation key will create 4 spaces. However, in some cases, e.g. Makefile, you may still need to use real tabs. Just press Ctrl+V then tab to create a real tab. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com

Software Documentation with Doxygen

This is a good practice to always have up-to-date software documentation. However, there can be discrepancy between the source code and the documentation over time and maintenance may be an issue. This is where Doxygen,  a “Source code documentation generator tool”, may be handy as it will automatically generate documentation based on the comments in the source code. In order for Doxygen to work, all developers will have to follow the same source code format in all source files,which is in itself also a plus since it will make the code and especially comments in this case more consistent. We’ll just show to quickly generate html and pdf documentation using a sample program we’ll call cnxapp. So here’s the code for this “application”   #include <stdio.h> /** Function1 description @param iArg1 First param description @param iArg2 Second param description @return 0 – Success -1 – Failure */ int function1(int iArg1, […]

Finding and fixing memoy leaks in your software

Memory leak

Memory leaks will cause your device to crash after a period of time once it runs out of memory. A quick way to find out if your application has a memory leak(s) is to monitor it with top:

If you see the %MEM increase over time for no particular reason, then you’ve got a memory leak. However, it might be tricky to isolate where the issue occurs exactly. The first thing to do is the review your source code for the following: Malloced memory is always freed fopen is always followed by fclose, and open by close scandir calls are properly freed Threads are properly terminated with pthread_cancel & pthread_join or pthread_detach, etc… If after a code review you cannot find the reason for the memory leak, use the following piece of code:

  The memory usage is displayed in numbers of pages. Usually, one page is 4096 […]

Software Development Cycle Tools

In order to manage software development with a small team, we use the following tools: Version control software: e.g. CVS, Subversion, git… Bug tracking software: e.g. Bugzilla Nightly build scripts or continuous integration software: e.g. CCNet For our linux based projects (embedded software), we use CVS, Bugzilla and nightly build scripts (with crontab) For our Windows-based projects (.NET Framework), we use CVS, Bugzilla and CCNet. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011. www.cnx-software.com