You can remotely develop board firmware by connecting to Kevin, the electrical closet computer. Kevin is a Linux machine that is accessible over SSH. It is plugged into a spare copy of MC2 with a programming cable and debugging UART as well as an Arduino with a CAN shield.
It is recommended to be comfortable using the Linux command line since SSH, the remote interface to Kevin, is based around the command line. Similarly, you will need an SSH client if your system does not come with it installed. macOS and Linux typically ship with SSH installed. For other platforms, any SSH client should work but here are a few popular options:
Alternatively, many popular IDEs and code editors can handle the details of SSH connections for you. I like using Visual Studio Code's Remote: SSH extension, for instance.
You will also need an account on Kevin if you don't already have one. We (GTSR) manage the accounts, so ask someone who has administrative access to Kevin to create one for you or ask in the #it Slack channel. Your account will initially be created with a randomized password; on your first login to Kevin you should change it by running the passwd command.
Connect to the Georgia Tech VPN even if you are on campus. This is required because Mechanical Engineering IT cannot open up devices to the public Internet.
Connect to kevin.solarracing.me via SSH. For instance, in a terminal, you would enter ssh <YOUR USERNAME>@kevin.solarracing.me, then enter your password when prompted.
When you are done, logout or exit the connection.
Kevin is set up with everything you should need to do board firmware development. If you want to have something additional installed, ask an administrator or the #it Slack channel. The following software is currently installed:
Tiva SDK and Tivalibs are pre-installed inside $HOME/.local. In contrast to the normal installation that is currently described in the documentation, this makes your installations of Tiva SDK and Tivalibs completely local to your user account, and you can upgrade, uninstall, reinstall, etc. without root permissions.
In order for board firmware to find these installations, you must run the usual ./autogen.sh step as ./autogen.sh --prefix="$HOME/.local"
You must do the same (./autogen.sh --prefix="$HOME/.local") if you are rebuilding Tiva SDK or Tivalibs. Likewise you should omit sudo if reinstalling Tiva SDK or Tivalibs, so sudo env PATH="$PATH" make install becomes simply make install.
Both Uniflash and OpenOCD are installed.
If you are experimenting on Tiva SDK itself, note that third party dependencies like the GNU ARM Embedded Toolchain are installed system-wide. If you require a different version of such tools, install them somewhere inside your home directory and make sure your local installation is first on your PATH.
arduino-cli, the command line interface to build and program Arduino sketches
gh, the GitHub command line interface
GCC 9.3.0, for if you need to compile C or C++ programs to run on Kevin and not on a board
Go 1.16
Java 11
Python 3.8
SQLite3
A spare copy of MC2 is plugged into Kevin with JTAG and UART cables. Due to limitations of Uniflash, having multiple JTAG cables connected to the same computer does not work. Unfortunately, if you need to program a different board, someone needs to go into shop and physically swap the cable.
There are, however, two other devices on the same CAN bus as MC2 which can help you determine if things are operating correctly. An Arduino is plugged into the CAN bus and connected to Kevin over USB. The powerharness sketches may be useful to interact with the CAN bus using the Arduino. Use arduino-cli to program the Arduino and something like screen to read what is printed to serial.
There is also a display board plugged into the CAN bus and a USB webcam is pointed at the array of boards. You can forward the video feed over SSH to your host machine and watch things happen, albeit with a few seconds of delay. On macOS or Linux, you can do this with FFmpeg, for instance:
ssh <YOUR USERNAME>@kevin.solarracing.me ffmpeg -an -f video4linux2 -s 640x480 -i /dev/video1 -r 10 -b:v 500k -f matroska - | ffplay -f matroska /dev/stdin
Here is an example invocation of arduino-cli to compile and program a sketch.
Unfortunately, there isn't too much to see on the webcam if the lights are off in the electrical closet.
Currently, only the administrator user account has root permission. We should probably get rid of it and switch to just adding regular accounts to sudoers instead. In the meantime, if you want to administer Kevin, ask one of the current admins (Ben, Isaac, and Matthew) in Slack.
The administrator account has a create-gtsr-user.sh script in its home directory which will properly create user accounts. Here are some important points about how users are managed:
New users are created with their primary group as gtsr. This can be used for access control, such as allowing SSH logins for the group.
New users are also added to the dialout and video groups so they can access serial ports and video devices, respectively.
/etc/skel contains the structure that the new user's home directory will be populated with. Note that Tiva SDK and Tivalibs are cloned inside /etc/skel, but they are not installed. Installation must be done after creating the user, otherwise paths inside the files generated by Autoconf will be wrong.
We should set up a cron job to pull these repos. Perhaps we should also clone them elsewhere and have the cron job pull and copy to /etc/skel
When the script terminates, it will print out the randomly generated password that the new user was assigned. Look for output like:
Created user <the username> with initial password <the password>.
**Please change this password the first time you log in** by running the command 'passwd'.