-
Notifications
You must be signed in to change notification settings - Fork 12
How To Create a New Project
This tutorial will guide you through creating a new C++ project within the DaisyExamples folder.
Follow along with the video guide!
- Set Up Your Development Environment
- Install python3
- Using the Helper Script
- Compiling
- Troubleshooting
If you haven't already done so, make sure to configure your development environment as described in the Setting Up Your Development Environment wiki page.
Follow the guide to install python3 for your OS.
We will need python3 to run our project helper script later.
Note: Do not install python from the Microsoft store.
helper.py is a python script from DaisyExamples that can be used for several helpful utilities.
To create a brand new project containing a Makefile, compilable source file, and debug resources for VisualStudio using VisualGDB, and for VS Code using Cortex Debug:
- Open a terminal window. On macOS, this is terminal. On Windows, this is git bash (installed in the Getting Started guide).
- Move into your DaisyExamples folder with
cd <DaisyExamples location>
- For example if DaisyExamples is located at
C:\\Users\ES\Documents\DaisyExamples
,
runcd /c/Users/ES/Documents/DaisyExamples
.
- For example if DaisyExamples is located at
- Next run the helper script for the board you want to target.
./helper.py create MyProjects/<Project Name> --board <Target Board>
- For example, if we are creating a project called MyProj for the Daisy Patch, we would
run./helper.py create MyProjects/MyProj --board patch
- For example, if we are creating a project called MyProj for the Daisy Patch, we would
The <Target Board>
option can be any of the following:
To see a full list of available board targets, enter the following command:
./helper.py -h
macOS troubleshooting:
- Mac users may see
Permission denied
in the console when trying to run the helper script. A solution to this is to first runchmod +x helper.py
- Another error that may appear is
ImportError: No module named pathlib
. A solution is to add "python3" in front of the command, so you will need to runpython3 ./helper.py create MyProjects/<Project Name> --board <Target Board>
- Open your project in VS Code.
- Open VS Code.
- Click
File > Open Folder
- Choose your project folder. For example, the MyProj folder from step 3.
- Write the code for your example.
(The default code is a simple passthrough, you can try compiling and flashing it!). - Build your example with
Ctrl-shift-B
- If you receive an error related to libDaisy or DaisySP, make sure to build your libs by running
task build_all
. This will build the libraries. - Refer to step 3 of the Development Environment guide for help flashing your project to the Daisy.
Please refer to the troubleshooting page.