Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article will help you get setup if you have a M1 with a solution using Docker Desktop.

\uD83D\uDCD8 Instructions for Docker Setup

Info

This guide will provide instructions for getting a virtual environment setup with Docker which will allow you to simulate your code in a Linux environment

  1. Download Docker Desktop for Apple Silicon (https://www.docker.com/products/docker-desktop/ )

  2. Install the latest version of vagrant (https://www.vagrantup.com/downloads )

    1. For M1s, you can use brew or you can download the ARM64 version

  3. Clone the repo: git clone https://github.com/uw-midsun/box.git && cd box

  4. Go to your box directory and switch to branch mainmaster branch

    1. You can check if you are on the master branch if you run git branch

      Code Block
      ~ % cd box 
      box % git checkout
    main
    1.  master
  5. Before running vagrant up , make sure that you have docker open

  6. There is a current error with vagrant 2.4.1 (this issue may be fixed in future versions) which can be fixed with a one line change. Go into the box repository
    If you get this type of error, follow the instructions below:

    Image Added
    Code Block
    ~ % cd box 
    box % cd /opt/vagrant/embedded/gems/gems/vagrant-2.4.1/plugins/providers/docker
    # Using whatever code editor (or use sudo vim) to edit the driver.rb file in this directory
    # If you are not comfortable doing this, please ask a lead and they can help you
    # Go to line 352 and replace "if (config.size > 0 &&" with 
    
    # if (defined?(config.size) &&
                config.size > 0 &&

The end result will look like this, you will need to sudo save if you are using vscode or another editor:

...

Once this file is saved, you can return the box repository and continue on

  1. Run vagrant up --provider=docker

  2. Run vagrant ssh

  3. Run cd shared

  4. Run git clone https://github.com/uw-midsun/fwxv.git && cd fwxv (if you clone with https, you will need to set up an ssh key later which is covered in our setup page)

  5. Run scons sim --project=leds --platform=x86 to test that your environment is working correctly. If it compiles and runs your environment is set up.

...

  1. Correct output will be constant printing of “blink.” To stop the output, just click ctr + c.

  2. If you get to this step and are following the FW101 setup, please return to the setup page Setup and start at the ssh keygen section.

👾 Guide to flashing on M1s

Note

Only follow these instructions if you have already finished the instructions below and are ready to flash

These steps (and any future flashing) must be done outside of vagrant/docker
Info

While this guide provides instructions for flashing, it's important to note that the execution of scons sim still remains necessary within the Docker environment

  1. Ensure you are not in the linux environment (Docker environment)

  2. Go to the box repository and start up your python virtual environment by running source venv/bin/activate

  3. Try running arm-none-eabi-gcc --version and look for output. If it says that it cannot find arm-none-eabi-gcc then run source ~/.zshrc

    1. If it still doesn’t work, please contact a lead for help

  4. Make the necessary connections you need with the hardware

  5. cd shared/fwxv then run scons flash --project=[project name] (If you need some other scons command please reference the build_system.md file)

✨ Guide to setting up dependencies for flashing on M1s

Note

Ensure that these steps, including any future flashing activities, are performed outside the Linux/Docker environment

  1. Install package dependencies:

    1. Run this shell script in box directory:

      View file
      namesetup.sh

      1. This uses virtualenv, a python package manager. (https://docs.python.org/3/library/venv.html )

  2. Install arm-none-eabi-gcc compiler

    1. Download gcc-arm-none-eabi version 9.2.1 which is obtained from https://developer.arm.com/downloads/-/gnu-rm

    2. Move

    this to
    1. your tar file into your box folder and change current directory to box directory

    2. Run this code in the box repository:

      View file
      namem1.sh

    3. Run scons in the box/shared/fwxv folder to test if building works

      For people who care about the step-by-step of the m1.sh:

      Code Block
      // Should be in the box repository with .tar.bz2 file
      tar xzf gcc-arm-none-eabi-9-2019-q4-major-mac.tar.bz2
      
      // move into gcc-arm-none-eabi folder
      cd gcc-arm-none-eabi-9-2019-q4-major/bin
      
      // run pwd and copy output into next command
      pwd
      
      // enter pwd output in [pwd input here] (do not include [] braces)
      // ex. echo 'export PATH="/Users/your-user-name/box/gcc-arm-none-eabi-9-2019-q4-major/bin:$PATH"' >> ~/.
    bashrc
    1. zshrc
      echo 'export PATH="[pwd input here]:$PATH"' >> ~/.
    bashrc
    1. zshrc
      source ~/.
    bashrc
    1. zshrc
      
      // you may get a permissions issue so we will "unquarantine" (remove quarantine attribute) our files
      // path to gcc-arm-none-eabi folder can be grabbed by cd gcc-arm-none-eabi-9-2019-q4-major and pwd
      // ex. xattr -d -r com.apple.quarantine /Users/your-user-name/box/gcc-arm-none-eabi-9-2019-q4-major/
      xattr -d -r com.apple.quarantine [path to gcc-arm-none-eabi folder]
      
      // check arm-none-eabi-gcc version 
      // Should get output similar to: 
      /* 
      *  arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
      *  Copyright (C) 2019 Free Software Foundation, Inc.
      *  This is free software; see the source for copying conditions.  There is NO
      *  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      /*
      arm-none-eabi-gcc --version
      
      // To test if it works, run scons to see if everything compiles correctly for you
      scons