Daisy Patch bootload example

My Daisy Patch project is coming right along. However, in order to fit within the 128KB flash I have had to compile both my project and libDaisy at Os optimization level. I’m at the point where I am running out of processing headroom and I’d like to see how much I can gain by moving to O3.

It’s my understanding that I will need to use a bootloader to execute from SRAM. Is there an explanation or example of how to set this up for the Daisy Patch module? I’ve seen the example projects that enable the bootloader in the Makefile, but I’m not sure how one goes about getting their firmware onto the Daisy. A little tutorial would be excellent.

this ?

https://electro-smith.github.io/libDaisy/md_doc_md__a7__getting__started__daisy__bootloader.html

Awesome, thanks. I tried following the guide:

  1. Adding APP_TYPE = BOOT_SRAM to my Makefile and rebuilding my project
  2. Running make program-boot target to flash the bootloader
  3. Running make program-dfu to copy my program to SRAM (and also QSPI flash)

All those steps complete successfully, but my application is never loaded. I get the 2.5 seconds of LED pulsing, and then nothing. I’ll try copying the BIN to the SD card.

No luck copying the BIN to the SD card. I’m not terribly surprised that it will take more than 10 minutes to get working, but I’m not quite sure what to try next.

One odd thing I noticed when building for SRAM is that it’s filling up the DTCMRAM, and not one of the larger RAMs like I was expecting.

Memory region         Used Size  Region Size  %age Used
           FLASH:          0 GB       128 KB      0.00%
         DTCMRAM:      125508 B       128 KB     95.76%
            SRAM:      122460 B       480 KB     24.91%
      RAM_D2_DMA:       18464 B        32 KB     56.35%
          RAM_D2:          0 GB       256 KB      0.00%
          RAM_D3:          0 GB        64 KB      0.00%
         ITCMRAM:          0 GB        64 KB      0.00%
           SDRAM:         32 MB        64 MB     50.00%
       QSPIFLASH:          0 GB      7936 KB      0.00%

This is what it looks like when I target the 128KB flash:

Memory region         Used Size  Region Size  %age Used
           FLASH:      122604 B       128 KB     93.54%
         DTCMRAM:          0 GB       128 KB      0.00%
            SRAM:      125508 B       512 KB     23.94%
          RAM_D2:       18464 B       288 KB      6.26%
          RAM_D3:          0 GB        64 KB      0.00%
         ITCMRAM:          0 GB        64 KB      0.00%
           SDRAM:         32 MB        64 MB     50.00%
       QSPIFLASH:          0 GB         8 MB      0.00%

Is using up the DTCMRAM expected? Seems to defeat the point of using the bootloader if I am constrained to 128KB.

I’m a novice, but …

is the file ending “.bin” like written on that page - not “.BIN” ?

You may want to change to “APP_TYPE = BOOT_QSPI” ?

Thanks, I’m just copying the .bin file exactly as-is from the build folder.

I’ve tried QSPI and it’s not working for me, either.

I just got to the “Custom linkers” section of the bootloader guide and it explains what’s happening to the DTCMRAM. Looks like I’m cutting it pretty close, assuming I can get the bootloader working at all.

Maybe try using the bootloader to flash something simple (like the blink example ) from sd ?

I tried the QuadMixer project but can’t get it to work with the bootloader, either from RAM or from QSPI.

… but the Blink project does work. Hmm, that’s progress. :slight_smile:

@shensley, is the Daisy Patch known to be working (or not working) with the bootloader?

I’ve done a bit of experimenting, and have found that the bootloader is working (at least partially) with the Daisy Patch. However, the display does not work when using the bootloader.

Since my application requires a bit of configuration after startup to make sound, it wasn’t obvious to me that my app was running. So I created a new Patch project using helper.py, and modified it to write a short string to the display.

When running without using the bootloader, the text appears on the display as you would expect, and inputs signals are passed through to the output.

When running via the bootloader, AudioCallback() is called and functions correctly, but the text does not appear on the display.

#include "daisy_patch.h"
#include "daisysp.h"

using namespace daisy;
using namespace daisysp;

DaisyPatch hw;

void AudioCallback(AudioHandle::InputBuffer in, AudioHandle::OutputBuffer out,
                   size_t size)
{
    hw.seed.SetLed(true);
	hw.ProcessAllControls();
	for (size_t i = 0; i < size; i++)
	{
		out[0][i] = in[0][i];
		out[1][i] = in[1][i];
		out[2][i] = in[2][i];
		out[3][i] = in[3][i];
	}
    hw.seed.SetLed(false);
}

int main(void)
{
	hw.Init();
    hw.display.WriteString("BOOTLOADER", Font_7x10, true);
    hw.display.Update();
    hw.SetAudioBlockSize(4);
	hw.SetAudioSampleRate(SaiHandle::Config::SampleRate::SAI_48KHZ);
	hw.StartAdc();
	hw.StartAudio(AudioCallback);
    while(1) {}
}

I’ve created an issue on GitHub.