Menu
Introduction to the Raspberry Pi

Raspberry Pi bare-bones desktop
Raspberry Pi 100437 Desktop

The Raspberry Pi is actually a tiny bare-bones computer motherboard. It doesn't come with a hard drive or even a case. It has a RCA video port which can be connected to your TV, USB port for a keyboard, USB port for a mouse, and the model B even has an Ethernet port. It uses a Broadcom 700Mhz BCM2835 System-On Chip and Boots from SD card running a lightweight Remix of Fedora Linux for ARM.

You can set up the Raspberry Pi as a desktop PC to do spreadsheets, word-processing, internet browsing, but one of its best features is the row of GPIO (general purpose input⁄output) pins along the edge of the board, which you can program to work like a microcontroller to monitor input from a switch or sensor, and to control devices that are attached to it, or even to sending a signal or data to another device.

ARM1176JZF-S core
ARM1176JZF-S core

The Raspberry Pi uses the Broadcom SoC (system-on-Chip). Basically Broadcom's SoC, integrates an 32-bit ARM1176 processor core (manufactured by the British semiconductor company ARM) with a GPU (Graphics Processor Unit) a certain amount of RAM, and some I/O circuitry. The Model B+ Raspberry Pi featured a Broadcom BCM2835 chip, with a single 700MHz ARM1176JZF-S core and either 256MB or 512MB of RAM. The new Raspberry Pi 2 Model B+ uses Broadcom's BCM2836, which contains four 32-bit ARMv7 Cortex-A7 cores and 1GB of RAM.

To program the Raspberry Pi you need to install the free Raspbian Linux NOOBS package, which contains the GNU Compiler Collection (GCC) which supports programming in C, C++ and assembly language. Use the Linux command line interface with one of two command line text editors: nano or vi to enter and edit the assembly source code.

How to Compile Assembly Code

1. Create a file called filename.s (s for source code), enter your assembly code, then save it.

2. To assemble the file type the following command (after the $ prompt):

as -o filename.o filename.s

3. This will create a filename.o file (o for object code). Next to link this file, type the following command:

gcc -o filename filename.o

4. If there were no errors, this will create a file named filename. This is your executable. To run it, type the following command:

 
./first

With larger programs, using multiple files, it might be more convenient to compile using a makefile. Make is a utility that inputs a text file named "makefile" (with no file extension) and follows the instructions it contains to build a program from source code files and object code libraries. Shon below is an example makefile.

all: filename
filename: filename.o
    gcc -o $@ $+
filename.o: filename.s
    as -o $@ $<
clean:
    rm -vf filename *.o

The entries in the makefile follows the pattern shownn below:

target: prerequisites
    recipe

Make files are generally created by the IDE (Integrated Development Environment) that you're using. They can get quite complicated.

The Raspberry Pi is supported by the Raspberry Pi Foundation which is a registered educational charity based in the UK. You'll find much more information at their website raspberrypi.org.

More Computer Architecture Articles:
• ARM Cortex-A72 Registers
• Electronic Circuits Basics
• Digital to Analog Convertion with a Microcontroller
• Basic Electronics for Computer Architecture
• Multilevel Queue CPU Scheduling Algorithm
• Dynamic Loading of Program Routines and Dynamically linked libraries (DLLs)
• Challenges of Programming Multicore Systems
• Digital Logic Levels and Transfer Characteristics
• Operating System Memory Page Sharing
• AMD Sempron Processor