This directory contains the firmware for the rotation stage driver (Drehplattform-Treiber).
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.
- Install Vagrant
- Install VirtualBox
- In a terminal, run:
vagrant up vagrant ssh
- You are now inside the development machine. The code is found at
/work/drehplattform-treiber-fw:cd /work/drehplattform-treiber-fw ls - 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
should show:
probe-rs list
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.
You can connect to the development VM with Visual Studio Code, which is the recommended setup. To do so, follow these steps:
- Run
.\scripts\devvm-ssh-setup.ps1, or alternatively, add the output ofvagrant ssh-config --host drehplattform-treiber-fw-devvmto your~/.ssh/configfile manually. - Install the Remote-SSH extension for VS Code.
- Make sure the development VM is running:
vagrant up - Either:
- Connect manually:
- Click the remote connect button (blue button in the bottom left of VS Code), select "Connect to Host..." and pick
drehplattform-treiber-fw-devvmfrom the list. Select "Linux" if prompted. - Open the
/work/drehplattform-treiber-fwdirectory.
- Click the remote connect button (blue button in the bottom left of VS Code), select "Connect to Host..." and pick
- or double-click the
drehplattform-treiber-fw-devvm.code-workspacefile in Windows Explorer, or in VS Code, select File -> Open Workspace from File... ->drehplattform-treiber-fw-devvm.code-workspace.
- Connect manually:
- 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.
- After you are done, the development VM can be stopped using
vagrant halt.
To check if the project would compile:
cargo checkTo actually build the whole project (takes longer than a check):
cargo buildTo flash the firmware to the device and then see the log output:
cargo runTo just flash without seeing log output later, use:
cargo flash --chip STM32F303RETo 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.)
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.
This repository is based on knurling-rs/app-template.
Licensed under either of
-
Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
-
MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.