We need Open Source ISA and methods for Chip design and Hardware

The open source phenomenon has swept the software industry in past few decades, and Linux based Operating Systems have taken the software world by storm. The Linux foundation has published studies where the worth of Linux is estimated at billions of dollars, but to me as an individual, it is priceless. High quality open source Compilers and tools for various language runtimes are readily available with source code. Ready to install OS distributions are a common thing. We have learnt that if we want to build something sustainable and scalable, open source development is a proven methodology and has become the primary choice.

Large organizations have embraced open source software tools and technologies, and have started open source software offices for helping the organization with adopting open source. Research and development budget is shifting an increasing portion to do open source software development. If we look into pie-charts of software composition in products, the open source share is even-increasing piece year after year. We have become more comfortable in collaborating in open ways where it is serving the common good, and keep the competition to where value is added.

Open source has certainly helped software in so many ways. Open collaboration alone has reduced the cost, and time to market. There has never been so much knowledge shared freely available to community. We have arrived at golden era of software development and it’s not limited to only a privileged few. The Internet has enabled us to share technology across the world.  The next whiz-kid sitting in remote corner of the world is not at disadvantage anymore. We should all be proud of this achievement. Recently I met with youngsters from the Caribbean, who were learning ins and out of full software stack on the Raspberry PI.  The real software revolution has just begun.

Can we apply Open Source techniques to chip & hardware design

My interaction with kids from the Caribbean turned into an interesting discussion when we started to talk about graphics stacks and how the low level software was coming in the way of their learning since they did not have source code for it.

Hardware is viewed as a brick, cast in stone, because it comes from a chosen few and they get to decide what to make. Secondly, customization costs are enormous, design cycles are looong. Today, all someone needs is a computer to unleash the software design ingenuity. This is not the case for hardware. Someone who has a great idea to solve a problem for the next Internet of things (IoT) wave does not have tools and techniques available as of today to implement it in hardware. Today, different kinds of demands for computing is taking us beyond general purpose computing, to application specific computer design.  We will need different hardware to solve new problems where existing system architectures are proving to be inefficient. There is a need for tools and techniques to do hardware design on par with the cost and pace of software. Software has blazed the trail using Open Source techniques, and hardware design will follow these footsteps.

As an example, IoT will require more chips and different kind of chips than ever at a scale that has never been seen before. The sensors will be required to be doing more computing yet get cheaper in price. ESP8266 drastically low priced WiFi chip with full TCP/IP stack has been adopted widely and has changed the low-cost WiFi space. Bluetooth LE mesh is another promising connectivity technology for IoT, and I imagine we are not far from designing a 25 cents BLE mesh chip low cost solution and transform the BLE markets forever. However, this will require a completely different way of thinking about design and manufacturing, since incremental design and manufacturing  process will not cut the bill.

Architectures (like RISC-V) which are completely open source from the ground up, and available to academia and industry, are the first steps in realizing this dream for hardware design.  These technologies are  accessible to everyone from schools to the semiconductor industry. In the future I hope a whiz-kid from remote corners of the world will be able to design the hardware with same access and tooling we have for software design today. That is going to unleash innovation like never before. When an optimized solution consists of efficient software running on efficient hardware, yet sharing the common good across hardware and software, we can really present technology as a compelling solution to fix enormous problems that humanity is facing. There is tremendous interest developing around Open Instruction Set Architectures ( ISA).  An openly licenced ISA would enable anyone to design a custom CPU yet be able to reuse the software ecosystem since the ISA would remain common. This would also make the instruction set architecture robust as it will be developed with constraints from different applications. This added excitement  is a good sign, back when Linux was in infancy, things were exactly same.

                            Hardware designers, Welcome On-board !!

PS: A big Thanks to Cliff Brake for adding data-points and reviews

Using Clang with OpenEmbedded/Yocto Project


Clang is C/C++/ObjC  frontend for LLVM compiler suite,  supporting several architectures now. We have added support for clang into OpenEmbedded using a standalone layer


This layer requires OpenEmbedded-core layer as dependency

Configuring meta-clang

git clone git://github.com/openembedded/openembedded-core
cd openembedded-core
git clone git://github.com/openembedded/bitbake
git clone git://github.com/kraj/meta-clang


. ./oe-init-build-env

Edit conf/bblayer.conf to add meta-clang

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly


 /a/wheezy/home/kraj/work/openembedded-core/meta-clang \
 /a/wheezy/home/kraj/work/openembedded-core/meta \

 /a/wheezy/home/kraj/work/openembedded-core/meta \


Selecting Default system Compiler

When meta-clang is added to layers it switches the default cross compiler for the system to be clang naturally. This selection is made by a variable which is assigned to choose clang if nothing else is selected

TOOLCHAIN ??= "clang"

One could start using GCC as default system compiler by setting TOOLCHAIN variable to ‘gcc’


This selection is done in configuration metadata files like conf/local.conf

Per-recipe ( package ) Compiler selection

When using clang, not all components are compilable yet, hence we have to sometimes choose gcc for certain package recipe. In order to do it, you have to write a .bbappend in meta-clang, as an example below bbappend shows how we select gcc for building glibc

$ cat recipes-excluded/nonclangable/glibc_%.bbappend

Current Status

We can build/boot core-image-minimal for qemux86 and raspberryPi machines, of course that includes few components which are still compiled using gcc. But at this point, we are ready to port the packages to compile with clang

Compiling Kernel with Clang

For kernel we still use gcc, to start using clang for kernel we would require to override KERNEL_CC variable

kernel-arch.bbclass:KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd"

To use clang

kernel-arch.bbclass:KERNEL_CC = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd"

This can also be done in kernel recipe too.

KERNEL_CC_forcevariable = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_KERNEL_ARCH} -fuse-ld=bfd"

Compiler runtime

We currently use gcc runtime by default with clang as well, meta-clang does have recipes for compiler-rt and libc++ which can be used to replace libgcc and libstdc++, at application level this selection can be made to depend on compiler-rt and libc++


We can generate OpenEmbedded SDK which will have both gcc and clang based cross compilers

bitbake -cpopulate_sdk core-image-minimal

Installing the SDK should be done something like this Installing the Toolchain¶

To use clang in SDK one should use CLANGCC and CLANGCXX environment variables to reference the clang compilers