Guide: Installing the developer tools


Prerequisites

The installation guide assumes basic knowledge of the UNIX command line (opening a shell, entering commands, navigating file system, and editing text files). Those new to command line may want to read our UNIX guide for a quick introduction and check out the unix videos and reference material prepared for CS107 students.

Overview

You must configure your laptop with an environment suitable for developing programs to run on the Raspberry Pi. These development tools are unix-based. Mac OS and Linux natively support an appropriate environment, on Windows you will enable WSL (Windows Subsystem for Linux) and work in an Ubuntu instance running on top of Windows OS.

The installation steps are:

  • Install arm-none-eabi cross-compile toolchain. A cross-compiler is a development toolchain that runs on one system (e.g., x86) and generates machine code for a different system (in this case, ARM). The toolchain includes the C compiler and other essential development tools (assembler, linker, debugger, and utilities).
  • Install python3, package prerequisites, and CP2102 console driver needed by the bootloader client rpi-run.py.
  • Create a cs107e_home directory to store your class materials
  • Configure shell and git environment

Follow the installation instructions for your OS

Final check steps

After completing the installation instructions, use these final check steps below to confirm your environment from top to bottom.

Check: confirm $CS107E, cross-compile build and debugger with simulator

$ cd $CS107E/sample_build
$ make clean && make all
rm -f *.o *.bin *.elf *.list *~
arm-none-eabi-gcc ... blah blah blah ...
$ arm-none-eabi-gdb hello.elf
GNU gdb (GDB) 9.2
... blah blah blah ...
(gdb) target sim
Connected to the simulator.
(gdb) quit
$ make 

Check: confirm rpi-run.py version 2.0

$ rpi-run.py -h
usage: rpi-run.py [-h] [-d device] [-v]  [-p | -s] [file]

This script sends a binary file to the Raspberry Pi bootloader. Version 2.0

Check: confirm CP2102 driver

If you have your CP2012 USB-serial breakout board, plug it into a USB port on your computer and confirm it can be found.

$ rpi-run.py
Found serial device: /dev/ttyS3

The reported device name can vary, e.g. /dev/cu.usbserial or /dev/cu.SLAB_USBtoUART and others.