James E. Bromberger (JEB) , a contributor to Perl CPAN and Debian, has estimated the cost of developing Debian Wheezy (7.0) from scratch based on the the number of lines of code (LOC) counted with SLOCCount tool, the Constructive Cost Model (COCOMO) and the average wage of a developer of 72,533 USD (using median estimates from Salary.com and PayScale.com for 2011). He found 419,776,604 lines of code in 31 programming languages giving an estimated cost of producing Debian Wheezy in February 2012 of 19 billion US dollar (14.4 Billion Euros), making each package source code (out of the 17,141 packages) worth an average of 1,112,547.56 USD to produce. He also estimated the cost of Linux 3.1.8 Kernel with almost 10 millions lines of source code would be worth 540 million USD at standard complexity, or 1.877 billions USD when rated as ‘complex’. I don’t know which tool he used for […]
Design West Summit – 26-29 March 2012
UBM Design announced the schedule and pass pricing for Design West Summit (previously Embedded System Conference) which will now bring 7 summits in one location (San Jose McEnery Convention Center) on 26-29 March 2012: Embedded Systems Conference & Exhibition – Conference Dates: March 26 – 29, 2012. Exhibition Dates: March 27-29, 2012. (See Details below) Android Summit – March 28, 2012 – Everything Android from embedded design to Apps development. Android Certification Program Android Speed Training Android Fundamentals Course on the Expo Floor Android Conference Program Multicore DevCon– March 27 & 28, 2012 – Embedded multicore and multimedia. 7th annual Multicore Conference Courses Multicore Expo Floor Zone Multicore Fundementals Courses Keynote Addresses Industry Addresses Expo floor parties and giveaways BlackHat – March 29, 2012 – One-day conference focused on security in embedded systems. Security Fundementals Course Black Hat Summit Conference Courses Security focused presentations in the expo floor theater Keynotes […]
ARM Releases Free DS-5 Community Edition For Android Developers
ARM announced a free version of its Eclipse-based DS-5 tools for small development firms (with 10 or fewer developers) and individuals who publish applications for Android. The ARM Development Studio 5 (DS-5) Community Edition (CE) helps create performance- and power-optimized native software by integrating a graphical debugger for code generated for the Android Native Development Kit (NDK) and a basic version of the ARM Streamline performance analysis tool. DS-5 CE is designed to work with Android Virtual Devices ( AVDs), development boards and devices that run Android 2.2 and API 8 or higher. ARM Development Studio 5 (DS-5) Community Edition is distributed as plug-in for Eclipse and completes the app developer toolkit with a C, C++ and Assembly graphical debugger that builds on the Android Debug Bridge (ADB), a software performance profiler and system analyzer (ARM Streamline). To get started, you’ll need Eclipse IDE, the Android SDK and the Android NDK […]
ARM NEON Tutorial in C and Assembler
The Advanced SIMD extension (aka NEON or “MPE” Media Processing Engine) is a combined 64- and 128-bit single instruction multiple data (SIMD) instruction set that provides standardized acceleration for media and signal processing applications similar to MMX, SSE and 3DNow! extensions found in x86 processors. Doulos has a video tutorial showing how you can exploit NEON instructions in assembler, how to modify your C code and provides the compile options for gcc to enable NEON during the build. Abstract: With the v7-A architecture, ARM has introduced a powerful SIMD implementation called NEON™. NEON is a coprocessor which comes with its own instruction set for vector operations. While NEON instructions could be hand coded in assembler language, ideally we want our compiler to generate them for us. Automatic analysis whether an iterative algorithm can be mapped to parallel vector operations is not trivial not the least because the C language is […]
Development Testing with Static Analysis
I’ve recently come across an EE Times article written by Coverity stressing the benefits of static analysis and how it can help finding potential issues in the code early. They mentioned 3 static analysis techniques: Dataflow analysis This technique can find the defect in the listing below during compile time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
void null_pointer_deref(int x) { char *p; if (x == 0) { p = foo(); } else { p = 0; } if(x != 0) { *p; } else { ... } } |
If value of x passed into the function is not zero, p is assigned a null pointer with p=0. Then, the next conditional check (x!=0) takes a true branch and in the next line p is dereferenced, leading to a null pointer dereference. This type of issue can be detected at compiled time with dataflow analysis. Interprocedural analysis This technique can find defects across function and method boundaries. See listing below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
void *zero_alloc(size_t size) { void *p = malloc(size); if (!p) return NULL; memset(p,0,size); return p; } struct S *create_S(int initial_value) { struct S *s = (struct S *) zero_alloc(sizeof(*s)); if (!s) return NULL; s->field = initial_value; return s; } int example_leak(struct S *s, int value) { struct S *tmp = s; if(!tmp) { tmp = create_S(value); } if(!tmp) return -1; ... return 0; } |
There are 3 functions: example_leak, create_S and zero_alloc. Interprocedural analysis can go through the code and identify the memory leak. The analysis engine has to trace the […]
LLVM (Low Level Virtual Machine) Compiler Infrastructure
The Low Level Virtual Machine (LLVM) is a compiler and toolchain infrastructure, written in C++, designed for compile-time, link-time, run-time, and “idle-time” optimization of programs written in arbitrary programming languages. Originally implemented for C/C++, LLVM is now used with a variety programming languages such as Python, Ruby and may others. Code in the LLVM project is licensed under the “UIUC” BSD-Style license. LLVM can be used to replace and/or supplement the GNU tools such as gcc, g++, gdb, etc… LLVM now consists of a number of different sub-projects including: The LLVM Core libraries provide a source- and target-independent optimizer, along with code generation support for many popular CPUs. These libraries are built around a well specified code representation known as the LLVM intermediate representation (“LLVM IR”). The LLVM Core libraries are well documented, and it is particularly easy to invent your own language (or port an existing compiler) to use […]
Cross Compiling Boost C++ Libraries for ARM
Boost provides free peer-reviewed portable C++ source libraries. Ten Boost libraries are already included in the C++ Standards Committee’s Library Technical Report and will be in the new C++11 Standard. The Boost C++ libraries are already included in popular Linux and Unix distributions such as Fedora, Debian, Ubuntu and NetBSD and are used by projects such as Python, Xibo, Civilization IV, etc.. Here are the steps to cross-compile Boost C++ libraries for arm using arm-linux-guneabi-g++: Download the source code:
1 |
wget http://sourceforge.net/projects/boost/files/boost/1.47.0/boost_1_47_0.tar.bz2/download |
Extract the source code:
1 2 3 |
mv download boost.tar.bz2 tar xjvf boost.tar.bz2 cd boost_1_47_0/ |
Bootstrap the code:
1 |
./bootstrap.sh |
Modify the configuration file (project-build.jam) to use the ARM toolchain by replacing the line with “using gcc” by:
1 |
using gcc : arm : arm-linux-gnueabi-g++ ; |
Install the python development package:
1 |
sudo apt-get install python-dev |
Build and install the boost libraries:
1 |
./bjam install toolset=gcc-arm --prefix=~/edev/beagleboard/libs --disable-long-double -sNO_ZLIB=1 -sNO_BZIP2=1 |
This was tested in Ubuntu 11.04 (natty) and 10.04 LTS with linaro g++ toolchain. Jean-Luc Aufranc (CNXSoft)Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his […]
Best Practices for Writing Safer C Code
Thomas Honold wrote an article published on EETimes giving 17 steps to safer C code. Not only this article provides tips to write safer C code, but I believe those steps are simply best practices when writing C code for embedded systems as they shorten the software life cycle by making it easier for a software team to write, debug and maintain code and by improving the software QA procedure. Here’s a summary of the 17 steps to achieve safer C code: Follow the rules you’ve read a hundred times: Initialize variables before use. Do not ignore compiler warnings. Check return values. Use enums as error types. Define an ENUM_MAX value at the end, so that the code to check the range does not have to be modified each time you add a new error code. Expect to fail Always assume there will be an error and set to default […]