Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
It is strongly recommend that you follow the instructions on this page to set up your development environment, including the ESP-IDF. It is also possible to follow Espressif's instructions to install ESP-IDF through a standalone installer or an IDE. This can be done if you're sure you know what you're doing or the process written here doesn't work anymore.
It is recommended to use native tools (i.e. Windows programs on Windows), not Windows Subsystem for Linux (WSL) or a virtual machine.
Espressif's installation guide notes limitations for the ESP-IDF's path:
The installation path of ESP-IDF and ESP-IDF Tools must not be longer than 90 characters.
The installation path of Python or ESP-IDF must not contain white spaces or parentheses.
The installation path of Python or ESP-IDF should not contain special characters (non-ASCII) unless the operating system is configured with “Unicode UTF-8” support.
If the path to your home directory has spaces in it, then installation paths should be changed to something without a space, like c:\esp\
. Also note that ccache
uses a temporary directory in your home directory, and spaces in that path cause issues. ccache
is enabled by default when running export.ps1
, but it can be disabled by removing the following from esp-idf/tools/tools.json
:
The continuous integration for this project runs on a Windows instance. This means one can read build-firmware-and-emulator.yml to see how the Windows build environment is set up from scratch for both the firmware and emulator, though it does not install extra development tools. It is recommend to follow the following guide.
git
. This is for version control.python
. This is for a few utilities. Make sure to check "Add Python to environment variables" when installing.esptool
. We've seen issues when running the IDF's esptool
independently, but the version in the The Python Package Index seems to work fine. If you've already set up an environment and need to install esptool
, make sure to do so in a terminal where you have not run export.ps1
, which sets up IDF environment variables. msys2
. This is the environment in which the emulator will be built.msys2
shell and run the following command to install all required packages for building the emulator: LLVM-17.0.6-win64.exe
. This is for the clang-format-17
tool. During the install, when it asks to add LLVM to the system PATH, add it to the path for all users.Add the following paths to the Windows path variable. Here are some instructions on how to do that.
C:\msys64\mingw64\bin
C:\msys64\usr\bin
You must add the msys2
paths after the python
paths and before C:\Windows\System32
. This is because the build uses Windows python
, not msys2's, and it uses msys2 find.exe
, not System32's. When it's all set up, it should look something like this:
$HOME/esp/esp-idf
. Note: Some installs of Python will have py.exe instead of python.exe - If this is the case, you can edit install.ps1 to replace all instances of python.exe to py.exe OR rename your locally installed py.exe file to python.exe Warning
Sometimes
install.ps1
can be a bit finicky and not install everything it's supposed to. If it doesn't create a$HOME/.espressif/python_env
folder, try running a few more times. As a last resort you can try editinginstall.ps1
and swap the"Setting up Python environment"
and"Installing ESP-IDF tools"
sections to set up the Python environment first.
apt
: dnf
: doxygen
separately from their website (https://www.doxygen.nl/download.html). Note that the version used in this project is currently 1.10.0 and the version in many package managers is less than that. You will need to extract the binary somewhere and add it to your PATH
variable. For example, GitHub Actions installs doxygen
like this: clang-17
and clang-format-17
separately. Note that the version used in this project is currently 17 and the version in many package managers is less than that. ~/esp/esp-idf
. Warning
This section is still under development, and as a result, may have unexpected errors in its process.
~/esp/esp-idf
. brew services stop pulseaudio
when you are done.When launching from VS Code, make sure the (lldb) Launch
configuration is selected.
export.ps1
does not make any permanent changes and it must be run each time you open a new terminal for a build. COM8
, and the serial port will likely be different on your system. Warning
The Windows version of this script uses
esptool.exe
rather thanesptool.py
becauseesptool.py
sometimes doesn't work when invoked independently. If this doesn't work, make sure you've installedesptool
per the instructions in "Configuring a Windows Environment".
Visual Studio Code IDE is recommended for all OSes. The following plugins are recommended:
~/esp/esp-idf
and the tools should exist in ~/.espressif/
.cppcheck
clang-format
doxygen
The .vscode
folder already has tasks for making and cleaning the emulator. It also has launch settings for launching the emulator with gdb
attached. To build the firmware from VSCode, use the Espressif extension buttons on the bottom toolbar. The build icon looks like a cylinder. Hover over the other icons to see what they do.
If VSCode isn't finding ESP-IDF symbols, try running the export.ps1
script from a terminal, then launching code from that same session. For convenience, you can use a small script which exports the ESP-IDF symbols and launches VSCode.
vsc_esp.sh
:
On occasion the ESP-IDF version used to build this project will increment. The easiest way to update ESP-IDF is to delete the existing one, by default installed at ~/esp/esp-idf/
, and the tools, by default installed at ~/.espressif/
, and follow the guide above to clone the new ESP-IDF and run the install script.
Alternatively, you can update the IDF in-place with the following commands. This example updates the IDF to 5.3.1, and you can change that version as is necessary. These are Linux commands, so they may need to be tweaked slightly for Windows.