SUCCESS: How to deploy and debug custom BSP board setup and app!

Hello,

I have created a new device on my local system under libDaisy where I have trimmed down the DaisyField example to run a subset of a custom board I am working on bringing up this week.

What is not clear to me is what are the next steps to load this onto my hardware and then load apps onto the system?

Any pointers to these next steps would be greatly appreciated.

Brett

Probably the Wiki would be a good resource to start: Home · electro-smith/DaisyWiki Wiki · GitHub

I think it’s crucial to understand how the default workflow works before trying to add any customizations.

Daisy provides at least two ways to flash the device:

  • dfu via USB interface: make program-dfu
  • via SWD interface (with the help of debugger): make program

@brbrr,

First off, thank you for the info… I do have the DFU tool working as I am able to use VSCode to deploy some samples to the devices. More on that in a moment.

Secondly, I should have been more specific in my question, sorry about that. I updated the title to better reflect my question.

Third, When I am using VSCode can I deploy some of the sample via task build_and_program_dfu. This only seems to work when one has a specific folder open at the correct sub folder level (e.g. [install directory]\DaisyExamples\seed\Blink). When I am at this level I can build and deploy from VSCode.

But, when creating a custom libDaisy BSP I did the work in this directory:
[install directory]\LibDaisy

From there I copied and modified the h and cpp files for the DaisyField to create my board base board setup.
It is from here that I am wondering, is there a way to use VSCode to:

  1. build and deploy a since new libDaisy custom board?
  2. debug the base system from VSCode?

Any thoughts or suggestions here would be appreciated.

Thank you for your help in advance,
Brett

I think you will benefit from learning how stuff actually works here. With that understanding, you’d be able adapt existing concepts to work with your board/code whatnot.

Let me help decipher what you experiencing:

  1. VSCode’s tasks are basically a fancy ways of defining shell scripts. They are custom and are defined in .vscode/tasks.json.
  2. build_and_program_dfu is a custom task, that runs the following shell command make clean; make; make program-dfu
  3. The above task works in DaisyExamples because every example had this task defined.
  4. As you might figured already, the above task is just a fancy way of running make commands.

As of your specific questions:

use VSCode to build and deploy a since new libDaisy custom board?

Yes. VSCode has multiple ways of building and deploying stuff. The important bit here is that VSCode uses external tools to do all the work. In the above example, VSCode runs some make commands. In my personal project I use CMake, with CMake extension, that provides handy commands to build project. (CMake is another build system, similar to make)

use VSCode to debug the base system from VSCode?

Yes. I think Wiki has a page explaining debugging.

@brbrr,

Thank you, the above is very helpful.

As you point out, I do have some base level items to continue to learn. In thinking about that a bit more I am wondering: Do I have an incorrect understanding of the base code is/does in libDaisy for a custom device? Example: If I take the code for daisy_seed.h/.cpp and build it, does that create something that can be installed and run on the device? Or is it more like a base level object that gets linked to create a full running app on the system?? or something else :slight_smile: ???

In other words: Can I build, install, and run the daisy_seed output from the libDaisy directory? I ask, as this also may be part of my of my challenge here as well.

Thank you very much for taking the time to more deeply describe all of this to me, it is much appreciated.

Brett

daisy_seed.h/cpp contains hardware initialization, but not audio DSP code. So it’s used by any audio patch for that board. Have a look at seed examples

libDaisy is is a library/firmware written for a specific CPU: STM32H7*. Some parts of the library is optional, others are required to properly initialize the chip. Arguably System::Init is the most important call.

If I take the code for daisy_seed.h/.cpp and build it, does that create something that can be installed and run on the device?

Not really. daisy_seed.h/.cpp defines a class. To make use of it, you’d probably need to use it :slight_smile: Here’s the bare minimum program that utilizes daisy_seed:

#include "daisy_seed.h"

int main()
{
    DaisySeed daisy::hardware;
    hardware.Configure();
    hardware.Init();

    // Loop forever
    for(;;)
    {}
}

You might have noticed that all the daisy hardware (pod, patch, etc) are build on top of the seed board. It is also reflected in the daisy_*.h/.cpp (daisy_seed.h is used there). As far as I understand, you are trying to run libDaisy code on your custom hardware. For that, you’d probably need duplicate daisy_seed files, and make all the necessary changes to reflect the differences in your hardware from seed.

@brbrr,

Thank you for the info… now i’m getting closer. :slight_smile:

Yes I am trying to run on custom hardware.

What I have at this point in time is a custom set of .h/.cpp that is a sbuset of the device bring up and it does build. I have started with the ability to light some LEDs base off of the DiasyField setup. In my case I’ve called the files SEQ16 (as at the core it is a 16 step sequencer). The build does create an object file called SEQ16 and it has no errors or warnings at this time.

From there, would I just create a file, as you have above (or any of the other examples), but do a #include for the SEQ16.h, then do the build from there, and load that .hex file onto the system?

Example: Create a new directory under the “DaisyExample”, call it SEQ16, and create a “blink” LED code. From there copy of the Makefile from one of the other examples and build it that way?

Sorry for all of the noob questions here, but I really appreciate the help.

Thanks,
Brett

@brbrr,

The good news is… I have the custom version build for my Daisy Feild and I am going to try and run the “VegasLights” here shortly. :slight_smile: My only task it to ensure I have the dfu tool instaled/built and I should be on a better path today.

Thank you very much for the help here!
Brett

@brbrr, @antisvin,

SUCCESS!

A fully custom BSP and “Blink” app really running the “VegasLights” on the DaisyField. This is great as it gives me the core of what I need to start to bring up my board!

Thank you both for the help over the past few days as it has helped me get to this point… and more to come!

Thanks again!
Brett

Congratulations. I would suggest adding ST-Link to your setup, you’ll likely need it to debug code effectively.