-
Notifications
You must be signed in to change notification settings - Fork 12
1. Setting Up Your Development Environment
Follow along with the video guide!
The "toolchain" is a combination of command line tools that are used within the Daisy ecosystem for building, flashing, and debugging firmware.
Follow the instructions below for installing the toolchain on your operating system:
Clone the DaisyExamples repository by pasting the following command into a terminal application:
git clone --recurse-submodules https://github.com/electro-smith/DaisyExamples ~/Desktop/DaisyExamples
Download and install the latest version of VS Code.
Note: this step is only necessary if you intend to debug your code with a debug probe.
To install the Cortex Debug extension in VS Code:
- Go to the extensions tab
View > Extensions
- Search for Cortex Debug
- Find the extension by marus25 and install, it should be the top result
- Open the terminal tab in the bottom of your VS Code window if not visible (Terminal -> New Terminal)
- There should be a + button with a dropdown menu in the top right of the terminal window
- In that dropdown select
Select Default Profile
, then choose Git Bash - Make sure to reset your USB driver before proceeding. Full instructions are on our Zadig Wiki Page.
If the git-bash
terminal is not being used, you may get an error:
mkdir build
process_begin: CreateProcess(NULL, mkdir build, ...) failed.
If so, you can change your terminal to git-bash, or create the build/
folder manually.
Now that we have a functioning build environment, let's run a "Blink" example on the Daisy.
A Blink program is the "Hello, World" of embedded programming and consists of toggling the state of an onboard LED.
There are two common ways to do this:
- Open the Blink example's folder in VS Code by clicking
File > Open Folder
, then navigating to~/Desktop/DaisyExamples/seed/Blink
- Connect the Daisy Seed via USB
- Put the Daisy into bootloader mode by holding the BOOT button down, and then pressing the RESET button. Once you release the RESET button, you can also let go of the BOOT button. This sequence is demonstrated above.
- If this is a new install, or you have upgraded DaisyExamples, DaisySP, or libDaisy:
- Launch the command palette with
Ctrl+P
on Windows or⌘+P
on macOS - Type
task build_all
. This will build the libraries, and the current example. - This step only has to be done on a new install, or when the source code has been updated inside of one of the libraries
- Launch the command palette with
- Launch the command palette with
Ctrl+P
on Windows or⌘+P
on macOS - Run
task build_and_program_dfu
This will build the example, and then flash the Daisy via dfu-util.
The Daisy Seed's onboard red led should be blinking.
In VS Code's Terminal, you'll see the following "errors" even though you succeeded in making the onboard LED blink. This message is normal and can be ignored in general.
dfu-util: Error during download get_status
make: *** [program-dfu] Error 74
We recommend using the ST-link V3 mini as your debug probe.
- Connect the debug probe to the Daisy Seed as indicated below, making sure the red stripe is facing the correct direction
Note: Make sure to center the debug probe on the Daisy's headers so that there are an even number of pins on either side of the connector - Power the device as usual
For the Daisy Seed:
For The Daisy Patch Submodule:
- Open VS Code
- Open the Blink example's folder by clicking
File > Open Folder
, then navigating to~/Desktop/DaisyExamples/seed/Blink
- If this is a new install, or you have upgraded DaisyExamples, DaisySP, or libDaisy:
- Launch the control palette with
Ctrl+p
on Windows or⌘+P
on macOS - Run
task build_all
. This will build the libraries - This step only has to be done on a new install, or when the source code has been updated
- Launch the control palette with
- Launch the control palette with
Ctrl+p
on Windows orShift+⌘+P
on macOS - Run
task build_and_program
This will build all libraries, build your example, and flash the Daisy via the debug probe.
The Daisy Seed's onboard red LED should be blinking.
To make your own Daisy project, checkout the Create a New Project wiki page.
To debug your Daisy code:
- Open the folder of the example you would like to debug as explained above
- Attach your Daisy to the debug probe
- Press
F5
, to enter debug mode, and flash your Daisy - VS Code will launch into the debugger, and halt at the default breakpoint
- Press the continue arrow in the small debug menu to continue running the example
Under the hood, this command builds all libraries, builds your example, flashes via openocd, then connects the debug environment.
Refer to this tutorial for a good intro to debugging in VS Code.
While this tutorial is for debugging Node.js, the same principals apply.
Please refer to the troubleshooting page.