Skip to content

Embedded

Jeremy Weed edited this page Feb 10, 2019 · 1 revision

Getting Started with the Embedded System

Setting Up the Embedded System

The embedded system handles the monitoring, safety, and control of the robot. We use a Tiva TM4C123G as our system controller. It runs FreeRTOS, an open source real-time operating system, allowing us to guarantee the system to respond to input within a given time frame. To compile, we use the GNU ARM Embedded Toolchain, and we flash the microcontroller with lm4tools.

To get started, you’ll need a system with Linux installed. We recommend Ubuntu 16.04, because it’s what our robot runs and what we test in, and what to commands in this guide assume you’re running, but any Debian-derivative should work. The previous guide should’ve covered how.

Installing and Configuring the Toolchain and Flasher

  1. Once you have the repository cloned and your system set up, open a terminal and navigate to the embedded directory in the top level of the repository.
  2. From here, you can run our script to install the toolchain and flasher:
    $ ../scripts/embedded_instal_deps.bash
        

    Note: If you’re using a 64 bit system, you may need to install the 32 bit libraries:

    $ sudo dpkg --add-architecture i386
    $ sudo apt update
    $ sudo apt install libc6:i386 libncurses5:i386 libstrdc++:i386
        
  3. After you’ve downloaded the toolchain and flasher, you’ll need to build the Tivaware drivers
    1. Navigate to the drivers/ directory, and run make to build the main system drivers.
    2. Navigate to the drivers/utils/ directory and run make to build the utility drivers.
    3. Navigate to the drivers/usblib directory and run make to build the USB drivers.

    In general, the files built in the base drivers/ directory are focused towards enabling the hardware on the Tiva, and the files in utils/ present higher level functionality, and usblib/ provides functions for working with USB.

After you’ve built the embedded systems drivers, you’re ready to try to built our code.

Building Our System

  1. Navigate back to the embedded/ directory.
  2. run source setenv.sh to make sure your terminal is able to find the toolchain. Note: You may want to add this to your .bashrc or .zshrc file, or you will need to call this every time you open a new terminal.
  3. run the make command. Our makefile should automatically build all *.c files in src and src/tasks, and output a file called image.bin, which can be flashed onto the Tiva. Caution: If you get an error like ”can't build object obj/task/$something.d: no such file or directory” then try running:
    $ mkdir qubo/embedded/obj/tasks/
    $ mkdir qubo/embedded/obj/lib/
    $ mkdir qubo/embedded/obj/interrupts/
        

Now that you’ve built our code, you’re ready to try to download it to your Tiva C.

Downloading to the Tiva

  1. Plug your Tiva into your computer. Note: Make sure you plug your Tiva in using the USB port on the top, not the side, as seen below. You’ll also need to make sure that the switch it in the debug position. If it’s correct, there should be a light lit on the Tiva.

    Caution: If you’re using a VM, your Linux install may not be able to see the USB device. Make sure your VM is configured to pass the Tiva USB device through to your Linux VM. This is a VM software specific setting, but can usually be found somewhere in the USB/device settings in your VM software.

  2. From the embedded/ directory, run make flash to flash the image.bin you just created onto the Tiva. If the flasher returns a success message, then you’ve successfully set up, compiled, and downloaded our code to your Tiva!