From bare-metal to embedded Linux

A little heads up for the people who are just moving from micro-controller to a processor board.

When I started my work on controllers like AVR,PIC16 series, their datasheet was all I needed.
But the story in case of a processor is completely changed.
As we are talking about embedded Linux and not a full blown desktop system, the processors considered here is a SOC like the one in a raspberry pi.

Different SOC’s vendors and the problem with proprietary code.

As there are a lot of player in the market, each of them is having there own set of tools and process by which one can work with the SOC processors provided by them.
There’s no generic way but the procedure followed is pretty similar but without the support from the vendor, its very hard for one to play with a particular processor. Vendors like Qualcomm, Nvidia, Broadcom release their processors and software tools needed to build things on top of them. Those software possess a huge amount of proprietary things that one has to take care of. The easiest way is to buy a development board from these vendors and get started with it which by the way is pretty costly if one is talking about a SOC development board.

How working on a SOC is different from a micro-controller based boards ?
There are many advantages for a SOC board over a controller based board. Many are in terms of easy of code and a more integrated solution.

Software : In terms of code, the SOC mostly will run a linux distribution or may be some other OS like android or windows. The bare metal coding concept is lost in case of a SOC. Concepts of OS are more used than the standard C/C++/Assembly coding in a micro-controller. The SOC vendors will always provide a SDK that does all of the work of building a kernel or android system for the particular processor.
When building custom a SOC boards, the corresponding purchased SOC development board is tweaked according to the requirements and are also added with others functionalities like addition of a custom hardware that connects the processor over some bus like USB or I2C and for such additions , one needs to tweak the software SDK also to support the same. Such activity comes under the field of linux Board Support Packaging and is itself is sometimes a tiresome activity.

So mainly the software will have a OS layer generally a linux kernel based.

Hardware : In terms of hardware, there are a lot of peripheral inside the SOC chip only like WiFi, Bluetooth, Ethernet, USB and many other peripheral are mostly inside the SOC. Though ram and storage chips needs to be connected to the processor. Some SOC vendors may include the ram and storage inside the SOC die only. Again, this thing is vendor specific. So hardware of a SOC chip will always a variety of options one can select. Programming the board though can be costly as the processors may or may not have support for different boot types. Like if the processor can’t boot from media like SD-card or USB ( the easy ones ), then one might need a JTAG debugger to flash the firmware inside the ROM used in the board.

To summarise one needs to know three ares to start working with a SOC board and these are :

  1. The purchased SOC boot sequence ( this is provided by the vendor ).
  2. The SDK ( whetherLinux or android based and this is provided by the vendor or may be an opensource one like buildroot/yocto/openembedded ). One needs to know the directory structure/compilation/configuration of the SDK so as to make modifications or additions to the code.
  3. The boards hardware schematic. I am suggesting this as one should know at least basic connections for the board to boot properly like the power,gnd,boot-straping pins , ram/rom connections to the processor and other pins like gpios and some bus pins like i2c or spi. This stuff is very basic and one should have knowledge of such things as only then one can tweak the software to produce a working code.

Few SOC development boards 
The famous raspberry pi dev board with a broadcom SOC.

The qualcomm’s dragaon series SOC board

New in the game recently launched Nvidia’s Jetson Nano dev board. 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s