This example shows how to lock virtual data within regular RAM.
#include <Arduino.h>
#include <SdFat.h>
const int chipSelect = 4;
const uint32_t poolSize = 1024l * 328l;
const int spiSpeed = SPI_FULL_SPEED;
SdFat sd;
void setup()
{
while (!Serial)
;
Serial.begin(115200);
if (!sd.begin(chipSelect, spiSpeed))
sd.initErrorHalt();
valloc.start();
delay(3000);
Serial.println("Initialized!");
}
void loop()
{
strcpy(vstr, "hello (virtual) world!");
int size = strlen(vstr) + 1;
while (size)
{
Serial.write(*lock, lockedsize);
size -= lockedsize;
p += lockedsize;
}
Serial.println("");
valloc.free(vstr);
delay(1000);
}