Line: 1 to 1 | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Slide 1: The Raspberry Pi and how to bring it to lifeLecture 6
Slide 2: A first glimpseThere are several versions of Raspberry Pis available on the market:
Slide 3: Raspberry Pi specsSlide 4: Operating systems on the PiFrom the specs we can see that the Raspberry Pi 3 is a full blown computer.With its
Slide 5: Currently available OS
Slide 6: BCM2835 CPUThe CPU has got an ARM processor core with 4 64 bit CPUs The operating system and the Linux kernel are still 32 bit versions (After the course you may try to compile and install a 64 bit kernel yourself. This is a very good exercise to understand how the OS is built!) Around the CPU there are plenty of interfaces To know the details (the interfaces only!) have a look at the data sheet explaining them (205 pages!)Slide 7: BCM2835 peripheralsHere are some of the Raspberry Pi peripherals:
Slide 8: Raspberry Pi and the real worldYou can easily connect
Slide 9: Connection to bread board: The cobblerSlide 10: Other RPI connectionsI2C is a serial bus often used in computer systems of for short distance interfacing. Many devices having a I2C port are available and we will program a few:
Slide 11: More interfacesThere are more interfaces which we will not necessarily use during the course. Students who think that they do not learn enough during this course are invited to come forward. We can easily give you more exercises, e.g to make
Slide 12: What you need to bring a RPI to lifeThis is what you will need to bring a Raspberry Pi to life:
Slide 13: The softwareGo to the Raspberry Pi download page and download the Raspbian image. It comes in 2 versions
Slide 14: How to extract the file system on Ubuntu?Once downloaded we must first unzip the file: Create a folder /opt/ucc/micros/raspberry and copy the zip file into it cd /opt/ucc/micros/raspberry cp ~/Downloads/2017-09-07-raspbian-stretch.zip . unzip 2017-09-07-raspbian-stretch.zip which will give you 2017-09-07-raspbian-stretch.img This is the file system image which will be copied to the SD card bit by bit using the dd commandSlide 15: Structure of the image fileCan we know what is inside this image? We see that there are 2 disk partitions:
Slide 16: Looking inside the partitionsThis is something only root (the superuser) can do We loop mount the file system: Now we can copy the contents to whatever directory we want This is the boot partition Then we can do the same thing for the root partitionSlide 17: The root partitionOnce we mount the second partition the same way we see that it contains: something we have seen before on our Ubuntu PC The boot partition we have seen before is mounted on /boot in this partitionSlide 18: How to get the OS onto the Raspberry Pi?Now we have the OS on the PC where it does not help us much! We must put it onto a media that can be read by the Rpi. Traditionally this was the micro SD card but you can also use certain types of USB memory sticks (Be careful, not all sticks will work! I use a SanDisk cruzer)Slide 19: Copying the OS to the SD cardIf your PC has an SD card reader then you put the micro SD card into a normal SD card holder. Otherwise there are microSD to USB converters First check which disks you have on you system: Then you plug in your microSD adapter or your USB adapter and do the same thing again You should see 2 additional partitions, in my case probably /dev/sdc /dev/sdc1 /dev/sdc2Slide 20: Copy the OSNow we are ready to copy the operating system to the SD card (or USB stick)Where X is the disk letter (in our case “c”) This may well take several minutes (the image is some 1.6 Gbytes!) To see the progress: Slide 21: The moment of truthSafely remove the SD card from your system (unmount if mounted!) Put it into the SD card slot of the Pi Power on th machine With a little bit of luck, it should boot For more details of installing Raspbian on the SD card using a Linux system seehttps://www.raspberrypi.org/documentation/installation/installing-images/linux.md Slide 22: First loginRaspbian has a default user named
Slide 23: Adding software packagesOnce you have come this far you may want to add additional software packages, emacs being one of them You will continue adding packages as you use the system and you will see what is missing.Slide 24: Configuring the systemWe have seen that the system image takes 1.6 Gbytes our SD card however provides 32 Gbytes. How to use it to its full capacity? Start raspi-config (which is a program dedicated to the Raspberry and does not exists und PC Ubuntu) Go through all the options of the program and see if they make sense to you.Slide 25: Accessing the RPI remotelyOf course we can use the interfaces on the Raspberry Pi to connect a screen, keyboard and mouse and use it in stand-alone mode but we can also make use of the PC resources and access it remotely There are several ways to access the RPI remotely:
Slide 26: The remote DesktopSlide 27: Remote Desktop (2)When running the remote desktop you are working on the Raspberry Pi with the screen, keyboard and mouse replaced by the devices on the PC. You have the same functionality as if the screen was connected to the Pi’s HDMI port and keyboard and mouse were connected to the USB ports on the Pi.Slide 28: nfs the network file systemWith nfs you can mount part of the Pi’s file system tree onto your PC file system. This allows you access to the Pi’s files as if you were using a local disk. You cannot run any Rasberry Pi programs this way however. It is interesting if you cross-compile Pi programs on your PC, which will be immediately visible on the Pi.Slide 29: ssh the secure shellIn the case of ssh you have a single terminal window that is connected to a shell on the Pi. The command is: ssh userOnPi@piIPaddress Where piIPaddress can be the Pi’s IP address of hostname. If you specify the -X option you can run X-11 based programs where the X protocol is run over the ssh connection.Slide 30: ssh session exampleHere you see a screen dump from the PC with a remote terminal that started an emacs session on the Pi.Slide 31: scpTo copy a file from the PC to the Pi this would be the command: scp myfile.c uli@rpi-10:exercises/solutions/exercise_2 This will copy the file “myfile.c” into the sub-directory exercises/solutions/exercise_2 on my home directory on the Pi. Of course user uli must exist on raspberry10. Instead of specifying the machine name: rpi-10 you can also give its IP address.Slide 32: Compiling C programs for the Raspberry PiJust like Linux on the PC, Linux on the Raspberry Pi uses the GNU C compiler gcc. The front end:
Slide 33: Cross-Compilation for the PiAs explained in a previous lecture we can also compile C programs for the Raspberry Pi on the PC Linux system using a cross-compiler. The cross compiler we will use is named arm-linux-gnueabihf-gcc and it is part of the tools package for the Pi. It exists also as an Ubuntu package to be installed with apt. -- Uli Raich - 2017-09-13Comments
| |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
|