-
Notifications
You must be signed in to change notification settings - Fork 53
Embedded
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.
- 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.
- 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
- After you’ve downloaded the toolchain and flasher, you’ll need to build the Tivaware drivers
- Navigate to the
drivers/
directory, and runmake
to build the main system drivers. - Navigate to the
drivers/utils/
directory and runmake
to build the utility drivers. - Navigate to the
drivers/usblib
directory and runmake
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 inutils/
present higher level functionality, andusblib/
provides functions for working with USB. - Navigate to the
After you’ve built the embedded systems drivers, you’re ready to try to built our code.
- Navigate back to the
embedded/
directory. - 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. - run the
make
command. Our makefile should automatically build all*.c
files insrc
andsrc/tasks
, and output a file calledimage.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.
- 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.
- From the
embedded/
directory, runmake flash
to flash theimage.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!