I’m brand new to C++ development and looking for suggestions on setting up a comprehensive dev environment for the daisy on macOS. I’m looking at using VS Code with the Clang/LLVM compiler since it’s free and popular. If anybody uses this setup I’d love to hear your thoughts.
What about the Arduino IDE? I used that nearly a decade ago and recall it also supported flashing firming directly from the editor. Is it viable for daisy dev? Any other IDEs support flashing from the editor?
I’m using Linux myself, but macOS shouldn’t be particular different in this regards.
First of all, forget about Arduino IDE. It’s not meant to be a great IDE, just an easy way to get started with Arduino development. And this is not an Arduino.
You won’t be compiling native code, but code for ARM architecture. So you need to use cross-compiling toolchain. Generally GCC has been around for longer and is better supported for this task. Clang-based toolchain may work for you as well, but I haven’t used it personally. If you’re not sure what you’re doing, it’s probably safer to start with GCC.
Highly recommended to get a cheap ST-link clone and setup Cortex Debug extension for VSCode. You can load firmware directly from IDE by using integration with OpenOCD.
I’ve recently started using PlatformIO as a replacement for the Arduino IDE, for teensy development. It’s a plugin for the Atom text editor, which I was already using a lot, so it seemed perfect for me.
Haven’t tried it with daisy yet but it supports all Arduino chips and STM32 among others, so I think it would be viable with daisy, and it does support flashing directly from the IDE.
PlatformIO is much more than Atom plugin. It’s a cross-platform environment that can be integrated with multiple IDEs. It’s working great out of the box in about 90% cases, remaining 10% require hacks with python scripting (sure, it could be worse than that).
It’s also got a library manager, so libdaisy or daisysp could probably be added there.
Looking to confirm/correct my assumptions on this statement: A ST-Link clone would allow me to connect directly to the daisy seed via 10-pin (JTAG?) connector, which enables…debugging/flashing from an IDE? Curious to know what extra functionality this would enable over the web UI for flashing.
Also, I found this ST-Link STM32v2 on adafruit, my guess is that it would work just fine right?
@flavius The JTAG debugger allows for GDB debugging via openocd. This includes monitoring variables, breakpoints, instruction stepping, etc. That are not possible via USB. It can also be used without adding code, or having to change your program.
And ouu @antisvin I’ll need to checkout the Cortex Debug extension. I just recently started getting VS Code set up to work on stuff from my Mac laptop, and was going to be looking for a good debug solution soon!
On PC I use VisualGDB with Visual Studio, but I wanted to find a free, cross-platform option as well.
Thanks @shensley and @andrewikenberry! After additional searching, I’ve found this amazing SEGGER J-Link EDU Mini - JTAG/SWD Debugger for $20 and it even comes with a 10-pin (2x5) 0.05" cable! Excited to get this setup with some of the IDEs suggested and I’d be more than happy to draft up a thorough tutorial to help others get setup. Many thanks
I’ve followed the instructions for getting a dev environment setup successfully and can run make and make program-dfu to flash the daisy from the command line but would love to find a way to streamline this process from within VS Code. Is it be possible to automate these steps?
@antisvin I think the stlinkv3 mini has 1.27mm pitch connectors that would work here. I just ordered one and will give it a try in a few days (plus they’re only about $10 compared to many of the options out there).
@flavius I actually just started to use VS code as my primary text editor for light, cross-platform stuff. It seems replete with automation tools, so I’m sure setting something up to run the combination of make commands (i.e make clean; make; make program-dfu) wouldn’t be too hard. I’m looking into the cortex debug extension, which seems very cool, as well.
According to ST Electronics docs, StLink V3 mini debug header has 14 pins at 0.05’’ pitch. This is standard ARM debug 10 pin header + 2 reserved pins + extra COM port. Extra pins are on the sides, so connecting center of STDC14 connector to daisy should work, but there’s a risk of misaligning the cable. Using Olimex adapter seems a bit safer in this regards.
Here’s how I updated my VS Code Platform IO installation to get the daisy config showing up in the boards list when making a new project.
Make sure you can call the Platform IO Core (pio) from the command line. It should have been installed with the VS Code extension so no need to install it again, you only need to make sure your shell can call it. Instructions available here. In my case it was as simple as adding export PATH=$PATH:~/.platformio/penv/bin to my .profile and restarting terminal.
Once you can call pio, simply run pio update and you should see Updating ststm32 @ 7.0.0 [Up-to-date] in the list of updates. 7.0.0 is the version that includes the daisy config.
Open Platform IO and create a new project! Electrosmith Daisy should now be in the list!
One thing I’m still unsure about however is whether to set the framework as either STM32Cube or Arduino. Still working on getting the rest of the platformio.ini file configured with all the right options, more details to follow once I figure out debugging and other configs listed here.
Hey guys, pretty new to all this - just waiting for my seed to arrive! I have used VSCode with platform io to build and debug a nucleo board with the mbed framework, worked really well. Would be amazing if this could work the same for daisy.
Just tried setting up a new project by selecting the daisy board, and it initiates ok, but I don’t get any files created in the build folder. Has anyone got this up and running yet? If so could you share the steps to include the libDaisy, and upload one of the example programs? Or perhaps this is still a work in progress?