1.1. Getting Started¶
1.1.1. Prerequisites¶
Need a running version of Ubuntu 16.04 LTS or above, or Mac OS X (OS X Yosemite and above), or Windows 10 with WSL installed.
You must also have the following pre-installed:
- Python 2.7+
- Default installed on WSL, Ubuntu 16.04 and Mac OS X
- Git
- Default installed on Mac OS X
- To install on WSL & Ubuntu 16.04 run
sudo apt install git-all
- make
- Default installed on WSL, Ubuntu 16.04
- On Mac OSX this is installed after you run
xcode-select --install
If you are running Mac OS X you will need to install the xcode command line tools prior to running the setup. xcode-select --install. After the xcode tools are finished installing, follow the instructions below.
1.1.2. Prerequisites For Windows¶
Note: this is for Windows build 16215 or later
Open PowerShell as Administrator and run
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxRestart computer when prompted.
Open Windows Store and choose Ubuntu as Linux distro
Select “Get”
If you get any errors go here: https://docs.microsoft.com/en-us/windows/wsl/install-win10
After download completes select “Launch”
- Create UNIX user account
- If you get any errors go here: https://docs.microsoft.com/en-us/windows/wsl/install-win10
After this point, you should be able to run bash from the start menu.
1.1.3. Installation¶
- Step 0
Clone the repository
git clone https://github.com/kammce/SJSU-Dev.git
- Step 1
Change directory into SJSU-Dev
cd SJSU-Dev- Step 2
Run
setupscript../setup
Note
This will download and install the gcc-arm binaries, hyperload, telemetry locally to the repo. It will also generate the environment variables file and link the makefile and environment file to all of the default folders.
- Step 3
Edit the
env.shscript. Change the lineSJDEV=/dev/ttyUSB0to equal what you have on your system.How to find your serial device on Ubuntu
You probably do not have to change anything.
If no other devices are connected to your machine, then it will be
/dev/ttyUSB0. It is recommended to keep it at this value, because when you add more devices, it will increment to/dev/ttyUSB1. Once you remove your devices and replace them, the value will reset.How to find your serial device on Mac OS X
- Remove the SJ-One from your computer if it is connected.
- List the files in the
/devfolder by running the followingls /dev/. - Plug it into your computer and run
ls /dev/. - Observe the new file that was created.
- On mac, the path should look something like the following
/dev/tty.cumodemfd1337. - If so, change the line in
env.shto that file path fromSJDEV=/dev/ttyUSB0->SJDEV=/dev/tty.
How to find your serial device on Windows Linux Subsystem
On Windows it should be
/dev/ttyS3. Check your device manager to see what number COM device your device. The number after COM is the number after the S in the/dev/ttySstring. That is your device. Replace the lineSJDEV=/dev/ttyUSB0->SJDEV=/dev/ttyS
1.1.4. Building and Loading Hello World Application¶
- Step 0
From the root of the repository
cd firmware/Starter- Step 1
Source the
env.sh. You only need to do this once for each terminal session. After sourcing, the necessary environment variables will be added to your shell.source env.sh- Step 2
Run
make buildwithin the Starter folder to compile it into a HEX file located in thebinfolder.make build
Note
use the
--helpargument to get additional information on how to use the build script.- Step 3
To load the hex file into your SJ-One, run the following make command:
make flash
Note
If you run this command without first building, this command will build your project and then flash it. So you can skip the step above if you like.
Note
If the device port of your SJOne did not appear as the device set in your
env.shfile, then runmake flash SJDEV=<PATH-TO-YOUR-PORT>and that will change your port path for that instant.- Step 4
To view serial output, and interact with the board, run the following make command:
make telemetry
Note
The interface will pop up in your default browser on launch. If this does not occur you will need to enter the
http://localhost:5001web address into your browser’s address bar and load it.- Step 5
- Done!!
1.1.5. Building and Loading FreeRTOS Project¶
Instructions are the same as Starter, but you need to enter the firmware/FreeRTOS folder and run make from there.
1.1.6. Creating your own Project¶
Copy and rename the FreeRTOS, Starter or any of the other template folders to any place in your computer to make a new project.