Versions Compared

Key

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

...

...

...

...

Don’t use

...

Windows

Follow Microsoft’s instructions to install the Windows Subsystem for Linux. I recommend getting the latest Ubuntu LTS (long-term support) distribution.

...

  • This will install a shell only, graphical applications may not work (but you should get good at using the terminal anyway)

  • Zephyr only has Ubuntu instructions, you might need to change the package manager or do things a bit more manually for another distribution

  • Somehow creating a shortcut (alias, environment variable, or symlinksymbolic link) to a convenient spot on Windows from your Linux home directory will make your life a lot easier

...

We set up FSW as a zephyr project repository. Follow Zephyr’s instructions to install its dependencies, but where the instructions say west init ~/zephyrproject, instead run west init -m https://github.com/RIT-Launch-Initiative/FSW ~/zephyrproject (I named it launch-fsw, but if you do the same you will need to remember to change the name from Zephyr’s guides)

Notes

  • I named it launch-fsw instead of zephyrproject because FSW is the “parent” repository and you can’t just add arbitrary project repositories easily, but if you do this you will need to change all of the directory names in Zephyr’s guides

Build code

TODO

Notes

...

Execute west build <target_directory>.

Notes

  • If you use west build with a target (defaults to . if one is not given), and you change that target, try running west build -p always when you change the target. Sometimes even this is not sufficient and you have to remove the build directory entirely.

Flash binary

Flashing through Windows

Zephyr will generate several build files in the build/zephyr directory. Copy one of them to a location visible to the Windows filesystem, which is accessible from Linux through /mnt/c/.... They are the same as any other type of file you would flash ~ For Nucleos, flash the .hex file through STM32CubeProgrammer or copy the .bin file to the Nucleo’s “storage”.

Notes

  • This is why I recommended making a shortcutThe shortcut recommended previously helps (also consider writing a make target to do this)

Flashing through Linux

To do this, you need to pass a USB device from Windows to WSL 2 (this does not work with WSL 1, you are stuck with flashing through Windows) and make sure OpenOCD is able to flash to it.

Prerequisites:

...

usbipd-win on windows

...

Follow Microsoft’s instructions to install and use usbipd-win. For a more user-friendly experience, you may want the GUI, which also allows you to auto-attach a device (assuming it retains its Windows GUID between sessions).

Notes

  • If it doesn’t work, try detaching and re-attaching.

  • Sometimes this will fail due to mumble mumble udev rules mumble mumble. Try running sudo service udev restart followed by sudo udevadm control --reload to