Hi @infrasonicaudio
Thank you
For sumarize i post results with your proposal, that for me is better, because i´m working in a project where i need BOOT_SRAM type because of the size of the code.
Code from Reverb example without BOOT_SRAM:
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace daisysp;
using namespace patch_sm;
DaisyPatchSM patch;
ReverbSc reverb;
// DSY_SDRAM_BSS ReverbSc reverb;
void AudioCallback(AudioHandle::InputBuffer in,
AudioHandle::OutputBuffer out,
size_t size)
{
patch.ProcessAnalogControls();
/** Update Params with the four knobs */
float time_knob = patch.GetAdcValue(CV_1);
float time = fmap(time_knob, 0.3f, 0.99f);
float damp_knob = patch.GetAdcValue(CV_2);
float damp = fmap(damp_knob, 1000.f, 19000.f, Mapping::LOG);
float in_level = patch.GetAdcValue(CV_3);
float send_level = patch.GetAdcValue(CV_4);
reverb.SetFeedback(time);
reverb.SetLpFreq(damp);
for(size_t i = 0; i < size; i++)
{
float dryl = IN_L[i] * in_level;
float dryr = IN_R[i] * in_level;
float sendl = IN_L[i] * send_level;
float sendr = IN_R[i] * send_level;
float wetl, wetr;
reverb.Process(sendl, sendr, &wetl, &wetr);
OUT_L[i] = dryl + wetl;
OUT_R[i] = dryr + wetr;
}
}
int main(void)
{
patch.Init();
reverb.Init(patch.AudioSampleRate());
patch.StartAudio(AudioCallback);
while(1) {}
}
And makefile:
# Project Name
TARGET = ReverbExample
USE_DAISYSP_LGPL = 1
# Sources
CPP_SOURCES = ReverbExample.cpp \
# APP_TYPE = BOOT_SRAM
# Library Locations
LIBDAISY_DIR = ../../libDaisy/
DAISYSP_DIR = ../../DaisySP/
# Core location, and generic Makefile.
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile
Results are:
Memory region Used Size Region Size %age Used
FLASH: 77700 B 128 KB 59.28%
DTCMRAM: 0 GB 128 KB 0.00%
SRAM: 409564 B 512 KB 78.12%
RAM_D2: 16896 B 288 KB 5.73%
RAM_D3: 0 GB 64 KB 0.00%
BACKUP_SRAM: 12 B 4 KB 0.29%
ITCMRAM: 0 GB 64 KB 0.00%
SDRAM: 0 GB 64 MB 0.00%
QSPIFLASH: 0 GB 8 MB 0.00%
Now with BOOT_SRAM and allocate reverb in SDRAM:
#include "daisy_patch_sm.h"
#include "daisysp.h"
using namespace daisy;
using namespace daisysp;
using namespace patch_sm;
DaisyPatchSM patch;
// ReverbSc reverb;
DSY_SDRAM_BSS ReverbSc reverb;
void AudioCallback(AudioHandle::InputBuffer in,
AudioHandle::OutputBuffer out,
size_t size)
{
patch.ProcessAnalogControls();
/** Update Params with the four knobs */
float time_knob = patch.GetAdcValue(CV_1);
float time = fmap(time_knob, 0.3f, 0.99f);
float damp_knob = patch.GetAdcValue(CV_2);
float damp = fmap(damp_knob, 1000.f, 19000.f, Mapping::LOG);
float in_level = patch.GetAdcValue(CV_3);
float send_level = patch.GetAdcValue(CV_4);
reverb.SetFeedback(time);
reverb.SetLpFreq(damp);
for(size_t i = 0; i < size; i++)
{
float dryl = IN_L[i] * in_level;
float dryr = IN_R[i] * in_level;
float sendl = IN_L[i] * send_level;
float sendr = IN_R[i] * send_level;
float wetl, wetr;
reverb.Process(sendl, sendr, &wetl, &wetr);
OUT_L[i] = dryl + wetl;
OUT_R[i] = dryr + wetr;
}
}
int main(void)
{
patch.Init();
reverb.Init(patch.AudioSampleRate());
patch.StartAudio(AudioCallback);
while(1) {}
}
Make file:
# Project Name
TARGET = ReverbExample
USE_DAISYSP_LGPL = 1
# Sources
CPP_SOURCES = ReverbExample.cpp \
APP_TYPE = BOOT_SRAM
# Library Locations
LIBDAISY_DIR = ../../libDaisy/
DAISYSP_DIR = ../../DaisySP/
# Core location, and generic Makefile.
SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core
include $(SYSTEM_FILES_DIR)/Makefile
And results:
Memory region Used Size Region Size %age Used
FLASH: 0 GB 128 KB 0.00%
DTCMRAM: 13460 B 128 KB 10.27%
SRAM: 77548 B 480 KB 15.78%
RAM_D2_DMA: 16896 B 32 KB 51.56%
RAM_D2: 0 GB 256 KB 0.00%
RAM_D3: 0 GB 64 KB 0.00%
BACKUP_SRAM: 12 B 4 KB 0.29%
ITCMRAM: 0 GB 64 KB 0.00%
SDRAM: 396100 B 64 MB 0.59%
QSPIFLASH: 0 GB 7936 KB 0.00%
There is difference memory usage than just use BOOT_QSPI.
Thank´s a lot both of you!