RLP.enable() command reserves 10 kB of ram. I have Panda 2 and I am trying to load elf file containing procedures. Of course I got memory exception, then I shrinked elf file by removing two last procedures and it worked. I was wondering is there any way to break 10 kB barrier by reserving more memory? I have tried changing the data types from double to float for example but that wasn’t enough.
This is my code:
I got some c code, modified it a little bit and tested it in codeblocks and it works. Now I have modified it a little bit more and I am trying to implement it on Panda. Max readable frequency is 4000 Hz. I have tried to change variable types but that still isn’t enough. I could make few smaller elf files and then cycle through call-flush but that will probably cause too much delay.
I’m using yagarto tool. When I compile posted code I get elf file weighting 18158 bytes. I changed all doubles to floats and did some loops optimisation but I have come as far as aprox 16000 bytes. Minimum size for elf file that can be successfully loaded on Panda is 15360 bytes. I tried to load multiple smaller elf files but that just caused some mess, I think garbage collector wasn’t doing it’s job so frequently.
@ Errol, how did you managed to get 13623 byte elf, and what exactly you mean by bin file?
The elf file contains a lot of debug info. If you open it in something like notepad++ then you will see that the paths of source files are included etc. The bin file doesn’t include all this info, but that means that RPL can’t extract the procedure locations. Then you must provide all the data manually by reading the MAP file.
I made some changes to my makefile. Maybe that helps…
@ Errol, thank you, I have managed to shrink elf file and it works like a charm. There are some microphone issues, I will post another topic. Just one little step and it’s done, I just need to be sure. Thank you all.
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Native;
namespace rlp1
{
public class Program
{
static RLP.Procedure ReadAudio;
static byte[] dataRPLWave = new byte[128];
static AnalogOut aout = new AnalogOut(AnalogOut.Pin.Aout0);
public static void Main()
{
Debug.GC(true);
RLP.Enable();
RLP.Unlock("removed by admin!");
byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.FFT1);
RLP.LoadELF(elf_file);
RLP.InitializeBSSRegion(elf_file);
ReadAudio = RLP.GetProcedure(elf_file, "ReadAudio");
elf_file = null;
Debug.GC(true);
int i = 0;
while (true)
{
AnalogIn ain = new AnalogIn(AnalogIn.Pin.Ain1);
Debug.Print(ReadAudio.Invoke((byte)AnalogIn.Pin.Ain1).ToString());
ain.Dispose();
i++;
Thread.Sleep(1);
}
}
}
}
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Native;
namespace rlp1
{
public class Program
{
static RLP.Procedure ReadAudio;
static byte[] dataRPLWave = new byte[128];
static AnalogOut aout = new AnalogOut(AnalogOut.Pin.Aout0);
public static void Main()
{
Debug.GC(true);
RLP.Enable();
RLP.Unlock("removed by admin!");
byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.FFT1);
RLP.LoadELF(elf_file);
RLP.InitializeBSSRegion(elf_file);
ReadAudio = RLP.GetProcedure(elf_file, "ReadAudio");
elf_file = null;
Debug.GC(true);
int i = 0;
while (true)
{
AnalogIn ain = new AnalogIn(AnalogIn.Pin.Ain1);
Debug.Print(ReadAudio.Invoke((byte)AnalogIn.Pin.Ain1).ToString());
ain.Dispose();
i++;
Thread.Sleep(1);
}
}
}
}
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Native;
namespace rlp1
{
public class Program
{
static RLP.Procedure ReadAudio;
static byte[] dataRPLWave = new byte[128];
static AnalogOut aout = new AnalogOut(AnalogOut.Pin.Aout0);
public static void Main()
{
Debug.GC(true);
RLP.Enable();
RLP.Unlock("Removed by admin!");
byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.FFT1);
RLP.LoadELF(elf_file);
RLP.InitializeBSSRegion(elf_file);
ReadAudio = RLP.GetProcedure(elf_file, "ReadAudio");
elf_file = null;
Debug.GC(true);
int i = 0;
while (true)
{
AnalogIn ain = new AnalogIn(AnalogIn.Pin.Ain1);
Debug.Print(ReadAudio.Invoke((byte)AnalogIn.Pin.Ain1).ToString());
ain.Dispose();
i++;
Thread.Sleep(1);
}
}
}
}
using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GHIElectronics.NETMF.Hardware;
using Microsoft.SPOT.IO;
using GHIElectronics.NETMF.IO;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Native;
namespace rlp1
{
public class Program
{
static RLP.Procedure ReadAudio;
static AnalogOut aout = new AnalogOut(AnalogOut.Pin.Aout0);
public static void Main()
{
Debug.GC(true);
byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.FFT1);
RLP.LoadELF(elf_file);
RLP.InitializeBSSRegion(elf_file);
ReadAudio = RLP.GetProcedure(elf_file, "ReadAudio");
elf_file = null;
Debug.GC(true);
while (true)
{
Debug.Print(ReadAudio.Invoke((byte)AnalogIn.Pin.Ain1).ToString());
Thread.Sleep(1);
}
}
}
}
Sorry about that I had some technical issues, my intention was to edit post not to copy it 3 times… I latter saw that I posted RLP, that’s why I was editing in the first place. I posted code on code.tinyclr.com.
Just by the way.
The Cerberus(release immenent?) will be kicking fft butt. It runs at 160MHz(?), and can do 2 sixteen bit multiply and accumelates(MAC) per cycle. Or one MAC of 32 bit or one MAC of floats per cycle. On top of that it supports SIMD(single instruction, multiple data) to execute the same instruction on a block of data…
Trying to get fft running on this CPU. They have a sample for 1024 bin fft…