In the first part we discussed about available types of Raspberry Pi. In this article we want to talk about program execution and booting mechanism. For writing a program in hardware, before all, we have to know that system, its hardware details and get familiar with its function; to be familiar with Raspberry Pi stay with sisoog.
Inside the core
About single board computers and embedded systems, it is tried to makes circuits simpler and smaller, so, most needed features are built into one chip that finally result in a smaller and simpler circuit. The same for raspberry pi, BROADCOM company has made a great contribution to the raspberry project. All raspberry products are based on this company’s chips and it has made great success in this field. Chips used in Raspberry Pi have two different processing cores. One of them do the video and image processing, like a graphic card generates a feed of output images, video decoding and encoding; this core makes Raspberry Pi capable for video player and home theater.
The second core is actually an ARM core which can be multicore, for example raspberry version 2 and later have 4 cores that process programs. In these article, we mostly work with this core, and programs must be written in the way that this core be able to run them. To save on expenses, both cores set up together to use one shared hardware equipment that contains shared interrupts. to prevent exceptions and unexpected situations must be careful about using resources and interrupts.
What happens when Raspberry-Pi turns on?
The most important thing about running a program using a processor is to know about booting routine and turning-on-process which gives us the ability to run our program from the right place. Raspberry pi has more complex system than microcontrollers; because of more complex processor inner structure that is unavoidable.
Raspberry-Pi Booting Diagram
After that raspberry powers on or resets, first of all, GPU search the SD card for first partition of MBR (master boot record), then after recognizing file partition of bootcode.bin, it loads and run on RAM memory; so, the bootcode.bin is like a bootloader which can be changed by user. In normal situation, bootcode.bin, after executing, search for start.elf and config.txt which presets hardware, such as GPU settings, for loading main kernel. Then kernel.img loaded to address x8000 and program execution starts from this address. In fact, loading kernel is the last part of booting process and after that user takes control of program.
How to start?
Before we introduce compiler and learn how to compile and other settings, you can download a written (blinking LED) program from below links and place it in memory card. 1.Format memory card – be sure to choose Fat32 as file system type and “Boot” as the name of drive.
formatting memory card
2.After that, download related files from the link below, extract them and paste them in the memory card. Download Sisoog ACT Blink Raspberry PI B+ Download Sisoog ACT Blink Raspberry PI 2 3.Then place the memory card in the board and turn it on, ACT LED starts to blink. In the next article we are going to discuss about configuration and installing required tools for compiling program and run the first program on raspberry pi board. ———————————– Author: ZeusTranslate: Golnoosh