Skip to content

RAnders00/drehplattform-treiber-fw

Repository files navigation

drehplattform-treiber-fw

This directory contains the firmware for the rotation stage driver (Drehplattform-Treiber).

Development environment

The development environment can be installed manually, but for convenience it is also available as a Vagrant development machine. Vagrant uses VirtualBox to set up a virtual machine containing all the development tools automatically, based on what is configured in the Vagrantfile in this repository.

  1. Install Vagrant
  2. Install VirtualBox
  3. In a terminal, run:
    vagrant up
    vagrant ssh
  4. You are now inside the development machine. The code is found at /work/drehplattform-treiber-fw:
    cd /work/drehplattform-treiber-fw
    ls
  5. While the development VM is running, any ST-LINK/V2-1 devices (programming device for the STM32 series of microcontrollers) are taken away from the host machine and instead connected to the virtual machine. While the programming USB port of the driver is connected to your computer, running
    probe-rs list
    should show:
    The following debug probes were found:
    [0]: STLink V2-1 -- 0483:374b:066FFF484971754867125620 (ST-LINK)
    

You can also develop without a VM. In that case, look inside the Vagrantfile and Vagrantfile.build and follow the steps automated there manually.

Connecting to the dev VM with VS Code

You can connect to the development VM with Visual Studio Code, which is the recommended setup. To do so, follow these steps:

  1. Run .\scripts\devvm-ssh-setup.ps1, or alternatively, add the output of vagrant ssh-config --host drehplattform-treiber-fw-devvm to your ~/.ssh/config file manually.
  2. Install the Remote-SSH extension for VS Code.
  3. Make sure the development VM is running: vagrant up
  4. Either:
    1. Connect manually:
      1. Click the remote connect button (blue button in the bottom left of VS Code), select "Connect to Host..." and pick drehplattform-treiber-fw-devvm from the list. Select "Linux" if prompted.
      2. Open the /work/drehplattform-treiber-fw directory.
    2. or double-click the drehplattform-treiber-fw-devvm.code-workspace file in Windows Explorer, or in VS Code, select File -> Open Workspace from File... -> drehplattform-treiber-fw-devvm.code-workspace.
  5. When prompted, install the recommended VS code extensions for this workspace. If you are not getting the popup message or missed it, select Help -> Show All Commands -> search for "Extensions: Show Recommended Extensions". Then install all that are shown.
  6. After you are done, the development VM can be stopped using vagrant halt.

Running, building, debugging

To check if the project would compile:

cargo check

To actually build the whole project (takes longer than a check):

cargo build

To flash the firmware to the device and then see the log output:

cargo run

To just flash without seeing log output later, use:

cargo flash --chip STM32F303RE

To build, upload the firmare and then debug, open the "Run and Debug" tab in VS Code and run the pre-configured "drehplattform-treiber-fw debug" configuration. Note: The debugger will halt the execution right after reset. This allows you to set breakpoints which will be hit reliably. (Without this, the code begins running immediately, before all breakpoints are fully set up.)

Vendored/offline dependencies

To ensure that work can be picked up again in the far future, independent of online services still being reachable at that time, all dependencies have been downloaded using "cargo vendor" into the vendor directory. Cargo is configured to use these dependencies via the settings in .cargo/config.toml. If you wish to make cargo download the dependencies from crates.io instead, see the comments in .cargo/config.toml for what lines to comment out. You will also have to do that in case a dependency needs to be added or updated.

Credits

This repository is based on knurling-rs/app-template.

License

Licensed under either of

at your option.

About

Firmware für den Drehplattform-Treiber am Versuchsplatz OE/ONT an der HTW Dresden

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Contributors