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 team ought to check all possible scenarios including border case …

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.

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, int iArg2) { return 0; } /** Function2 description @param …

Finding and fixing memoy leaks in your software

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 memory leak(s) is too monitor it with top: PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 1       root       15   0   2156    668  572 S     0           5 .0      0:00.14         application If you see the %MEM increase over time for no particular reasons, 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 …

No password SSH – Login to a SSH server with private/public keys

If you often need to establish SSH connections to a server, entering the password each time may be an hassle or even a non-starter. For example, in our case we use ssh connections in our nightly build scripts, so obviously entering a password would not be an option here… So it can be useful to configure the server and you client to accept secure ssh connection without the need to enter a password.  What must be done, then , is to generate a public/private key pair, and copy the public part into the appropriate place on the server side. For doing this, on the user’s home directory, on the client machine, type: -t tells the type of encryption -f tells where to store the public/private key pairs. In this case, the .ssh directory on home is being used A password will be asked;  leave this part blank, just press <enter> Now, go the .ssh directory, and you will find two …

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.