Raspberry Pi Without OS (Part 3)

Raspberry Pi Without OS (Part 3)

Raspberry Pi Without OS (Part 3)
Raspberry Pi Without OS (Part 3)

In the second article we introduced CPU structure and the program implementation. In this article we are going to teach you how to install and configure necessary tools for compiling written codes for Raspberry-Pi’s boards.

As we explained earlier, Raspberry-Pi hardware based on ARM processor and its program can’t be complied using x86 compiler such as visual studio.

For more information about necessary tools, installation and configuration method follow sisoog.

Available compiler:

what is compiler

This is obvious that a tool for converting written code to understandable code for processor, is needed. For converting raspberry pi code, it must be compatible with ARM platforms; there aren’t many compilers which have this capability, here are some the most popular ones:

  1. ARM keil
  2. ARM IAR
  3. GCC

You may say what about Atmel Studio or CooCox! But here is the point that we want compiler and these are just editors without their own compiler; for example, SEGGER Embedded Studio or even Atmel Studio use GCC as compiler.

Which compiler do we use?

It’s easy to decide about compiler, both IAR and Keil are not free and have to buy license, we as sisoog team prefer to recommend and use open source and free tools. So we select GCC but is GCC not only is free and open source but also flexible and is better than Keil. Maybe it isn’t stronger than IAR but has very close perforfance.

GCC is such a powerful compiler that ARM Keil allows user to choose between Keil editor and GCC compiler.

How to install GCC compiler?

If your using Linux OS all you have to do is to type just one command:

*this command is only for Debian based Linux distribution.

Windows users have to follow some steps:

First, go to GCC ARM Embedded and download the latest version based on their Windows OS.

Eclipse compiler


Pay attention to download the installation version.

Installation is simple, just click next bottom like other software; the video can help.

To make sure software installed correctly you can type this command in windows’ Command Prompt or Linux terminal

For correct installation, output is like below:

It means all configuration and installation is done correctly.

Write the first program

Writing the first program is always the hardest part, because there are lots of parameters which can cause a program not to work. This this why the first program is written as simple as possible, in computer word it’s called Hello word. Here it is:

But in electronics word it’s different because printf needs lots of knowledge of hardware and software to be configured. So in this word we start with something completely different and this is a blinking LED, which is actually a program sends 1 and 0 to a pin continuously. This is the simplest program which can be written for checking the correctness of running program; this is the reason that most of evaluation boards have at least one LED which can be controlled by central processor. Raspberry boards also have a LED named ACT.

First of all, we have to know which pin is connected to this LED; depends on various type of hardware of Raspberry pi boards, we set Raspberry pi 2 as default.

Before all we need schematic of board which fortunately is available. For downloading the schematic go to Raspberry pi website.

RaspberryPi Sechamtic

As you can see in the picture above, ACT LED which is called Status LED by the schematic, is connected to GPIO16. For controlling a GPIO, processor datasheet is needed which is also available by Raspberry development team.

Due to the obtained information and processor registers, it’s easy to write the program but in this article we stop explaining details and we will discuss how to implement and work with processor registers in the next articles.


How to compile a program?

We save the above program with the name blinkact.c. Before compiling the program, we need to customized settings for used platform, which can be set at once duo to the GCC compiler command line options. All we need is to run the bottom line at terminal or command line:


-mtune=cortex-a7 tells compiler to compile the code for Cortex-a7 family and -march=armv7-a defines architecture. After running the above command, program is compiled and kernel.elf as output is created. Elf file contains lots of information about used libraries, some parameters for faulting and also executive details. For extracting executive codes, we need to run this command:

After this kernel.img as executive file is created.

Now program is ready to run.

In the next article we’re going to discussed about used tools and how to configure Eclipse editor.


Author: Zeus

Translate: Golnoosh 

حمایت از Golnoosh AbdollahiNejad

خوشحال میشیم برای تداوم و کیفیت ما رو حمایت کنید.

0 نفر

پــــســنــدیـده انـد


Golnoosh AbdollahiNejad
Golnoosh AbdollahiNejad

studying electrical engineering

دیدگاه ها

0 دیدگاه

پر بحث ترین ها

مسابقه دوم : چالش برنامه نویسی به زبان C

مسابقه اول سیسوگ (مسابقه اول: درک سخت افزار) انتقادهای زیادی رو در پی داشت تا جایی که حتی خودمم به نتیجه مسابقه...

Zeus ‌ Zeus ‌
  • 2 سال پیش

راه اندازی LCD گرافیکی Nokia 1661 و دانلود کتابخانه آن

LCD گرافیکی یکی از مهم ترین پارامترهای موجود در طراحی انواع مدارات الکترونیکی پیچیده و حتی ساده است ، نمایش وضعیت و...

Zeus ‌ Zeus ‌
  • 4 سال پیش

ریموت کدلرن و چکونگی دکد کردن آن به همراه سورس برنامه

ریموت کنترل امروزه کاربرد زیادی پیدا کرده است؛ از ریموت‌های درب بازکن تا ریموت‌های دزدگیر و کنترل روشنایی همه از یک اصول اولیه پیروی می‌کنند و آن‌هم ارسال اطلاعات به‌صورت بی‌سیم است....

Zeus ‌ Zeus ‌
  • 5 سال پیش

همه چیز درباره ریموت کنترل‌های هاپینگ

امنیت همیشه و در همه‌ی اعصار، مقوله‌ی مهم و قابل‌توجه‌ ای بوده و همیشه نوع بشر به دنبال امنیت بیشتر، دست به ابداعات و اختراعات گوناگونی زده است. ریموت کنترل یکی از این اختراعات است. در این مقاله، به بررسی امنیت انواع ریموت‌های کنترل خواهیم پرداخت....

Zeus ‌ Zeus ‌
  • 5 سال پیش

مسابقه سوم: استخراج داده از رشته ها در زبان C

نزدیک به 5 ماه از مسابقه دوم سیسوگ می‌گذره و فکر کردم که بد نیست یک چالش جدید داشته باشیم! البته چالش‌ها...

Zeus ‌ Zeus ‌
  • 2 سال پیش

مسابقه ششم: بزن میکروکنترلر را بسوزون!

بزنم میکروکنترلر را بسوزونم اونم تو  این شرایط!، طراحی مسابقه از اون چیزی که به نظر می‌رسه سخت‌تر است، باید حواست باشه...

Zeus ‌ Zeus ‌
  • 10 ماه پیش

آموزش قدم به قدم راه اندازی +NRF24L01

آموزش قدم به قدم راه اندازی +NRF24L01  با کتابخانه سازگار با انواع میکروکنترلرها و کامپایلرها قبل از اینکه قسمت بشه با ماژول...

رسول خواجوی بجستانی رسول خواجوی بجستانی
  • 3 سال پیش

ساخت ماینر با FPGA و ARM

چند ماهی هست که تب بیت کوین و ارزهای دیجیتال خیلی بالا رفته! چه شد که این پست را نوشتم همانطور که...

Zeus ‌ Zeus ‌
  • 3 سال پیش

کار با ماژول تمام عیار mc60 – قسمت دوم – راه اندازی OpenCPU

در قسمت اول به یکسری اطلاعات کلی ماژول mc60 پرداختیم، با نرم افزار QNavigator کار کردیم و یک هدربرد هم برای کار...

Mahdi.h   Mahdi.h  
  • 3 سال پیش

مسابقه چهارم: کدام حلقه سریع‌تر است؟

حدود ۷ ماه پیش، مسابقه سوم سیسوگ رو برگزار کردیم و کلی نکته در مورد خواندن رشته‌های ورودی را بررسی کردیم. فکر...

Zeus ‌ Zeus ‌
  • 1 سال پیش

مرجع متن باز آموزش الکترونیک