-
Notifications
You must be signed in to change notification settings - Fork 0
Dev Environment Setup
Note: We offer binary releases for the TUI and for the TM4C on their respective GitHub repos.
You only need to follow these steps if you wish to make changes to these repos.
First, install a Rust toolchain:
This should be all you need to do to be able to build ut-utp/core and ut-utp/tui.
-
cargo-expand-
coreuses macros quite heavily, this tool lets you see what they expand into
-
cargo-update
Once you have a working Rust installation you can install these with cargo install ... (i.e. cargo install cargo-expand).
If you're using nix on macOS or Linux, simply run nix develop (or use nix-direnv). All our repos have nix flakes with shells with all the dependencies you need provided for you.
To set up nix (for use with VSCode):
-
install Nix
- be sure to pick the "multi-user installation"
-
enable Flakes
- add
experimental-features = nix-command flakesto~/.config/nix/nix.conf- i.e. run
mkdir -p ~/.config/nix/; echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
- i.e. run
- add
- install
direnv:- i.e. run
nix-env -f '<nixpkgs>' -iA direnv - add the direnv shell hook
- i.e. run
-
install
nix-direnv- run
nix-env -f '<nixpkgs>' -iA nix-direnv - and add
source $HOME/.nix-profile/share/nix-direnv/direnvrcto$HOME/.direnvrc- i.e. run
echo 'source $HOME/.nix-profile/share/nix-direnv/direnvrc' >> ~/.direnvrc
- i.e. run
- run
- restart your terminal to load
nix- depending on your setup you may need to run log out and log in again for all processes (like VSCode) to see things in your Nix profile
- if you're not sure how applications pick up environment variables on your system, logging out and logging in again is the best option
- install VSCode
- install the VSCode direnv extension
Then, for any UTP repo, open the .code-workspace file (for example, [.vscode/tm4c.code-workspace](https://github.com/ut-utp/tui/blob/main/.vscode/workspace.code-workspace) for the utp/tm4c` repo) in VSCode and follow the prompts to install the recommended extensions.
direnv should prompt you to "allow" the .envrc in the repo and once you do it will prompt you to reload your extensions. Once you do so you should have a fully functional development environment for the repo.
TODO: core, assembler
Rust has broad support amongst the popular text editors and IDEs.
If you don't already have a favorite, we recommend using VSCode with rust-analyzer. All our repos have VSCode workspaces that include lists of helpful extensions and other useful repo-specific tooling.
TODO: core, assembler
If you wish to debug embedded programs, you'll need to install some extra tools.
We strongly recommend using
nix+ VSCode if you are on macOS or Linux; it will handle managing all of these tools for you.
In general this requires some common packages as well as board specific tools (i.e. the TI ICDI drivers for the TM4C).
The common packages are:
-
openocd- Windows: available here
- note: you may need to grab 7-zip to extract this file
- add the
bindirectory to yourPATH(this guide may be helpful)
- macOS: outside of using
nix,brewis probably the best way to installopenocdon macOS- first install brew if you haven't already
- then, this is the package; running
brew install open-ocdwill install it
- Linux: installation will vary with your distribution
- your distribution's package manager likely has
openocd(i.e.apt install openocd) - if not, the OpenOCD website has some suggestions
- your distribution's package manager likely has
- Windows: available here
-
gdb- Windows: unofficial binaries are available here
- be sure to add the extracted gdb folder to your
PATH - alternatively, the source is available here if you'd rather build it yourself
- be sure to add the extracted gdb folder to your
- macOS: once again, brew is likely your best option
- once you install
brew: runbrew install gdb -
Note: Apple Silicon users will need to install the
x86_64version of this package since thegdbpackage does not run on aarch64 yet- To do so, first follow these instructions to set up
brewforx86_64installation - Then run
arch -x86_64 /usr/local/homebrew/bin/brew install gdb - Alternatively, use
nix; it handles all of this for you
- To do so, first follow these instructions to set up
- once you install
- Linux: check your distro's package manager first (i.e.
apt install gdb-multiarch)-
Note: our repos are configured to expect
gdb-multiarchto be present in$PATH, if your repo only offers agdbbinary with ARM support you'll need to useupdate-alternativesor a symlink to exposegdb-multiarch
-
Note: our repos are configured to expect
- Windows: unofficial binaries are available here
- (optional) the LLVM binutils:
- VSCode's Cortex Debug extension uses this; feel free to skip installing this if you're not using that extension
- Windows:
- macOS:
brew install llvm - Linux: varies per distro (i.e.
apt install llvm-13-tools)- be sure to use
update-alternativesor your distro's equivalent to getllvm-objdumpandllvm-nmaliases (if, for example, you package exposes versioned binary names likellvm-13-nm). - see this page for alternate ways to get and install a release
- be sure to use
Recommended, but not required:
gdb-toolsgdb-dashboard-
screen- the UTP projects do not use serial to transport human readable data but for experiments where you want to log things, having a serial monitor can be handy
-
cargo-binutils- handy for analyzing the final binary
-
cargo-bloat- useful for keeping binary size in check
For the TM4C specifically, you'll also need:
- TI ICDI drivers (only needed on Windows)
You may also want to configure a udev rule (Linux only). This will allow you to interact with the board (i.e. screen, the UTP TUI) without needing to run as root.
To install:
- on NixOS:
- add this:
to your
services.udev.extraRules = '' # We can only alias, not rename, so: we change the permissions of `ttyACM0` too. KERNEL=="ttyACM0", MODE:="0666" # TI Stellaris Launchpad SUBSYSTEM=="usb", ATTR{idVendor}=="1cbe", ATTR{idProduct}=="00fd", GROUP:="plugdev", MODE:="0666", SYMLINK+="tm4c" '';
configuration.nix - run
sudo nixos-rebuild switch
- add this:
- on other Linux distros:
- put the above (or a different udev rule like this one) in
/etc/udev/rules.d - i.e. run something like:
echo 'KERNEL=="ttyACM0", MODE:="0666"' | sudo tee /etc/udev/rules.d/99-tiva-launchpad.rules echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1cbe", ATTR{idProduct}=="00fd", GROUP:="plugdev", MODE:="0666", SYMLINK+="tm4c"' | sudo tee -a /etc/udev/rules.d/99-tiva-launchpad.rules
- put the above (or a different udev rule like this one) in
Finally:
- run:
so that the new udev rule will take effect
sudo udevadm control --reload sudo udevadm trigger
- with your board plugged in, run:
to verify that you now have permission to access your board
ls -l /dev/tm4c
If you're just looking to flash binaries onto your TM4C you can use lm4flash instead of OpenOCD.
TODO: link to the nixpkg once it's up
For Windows:
- here's an x86_64 binary
For macOS:
- here's a universal binary
- alternatively you can install it with
brew(brew install lm4tools) - or with
nix:nix-shell -p lm4tools
For Linux:
- here's an x86_64 binary and an arm64 binary
- alternatively you can install it from your distro's package manager (i.e.
apt install lm4tools) - or with
nix:nix-shell -p lm4tools
Need: node, wasm-pack, ...
Recommend:
TODO