Tool/software:
Hi,
I'm failing to activate FreeRTOS+FAT RAM disk. (part of the SDK)
My code:
void vCreateRAMDisk(void)
{
/* Define the size of the RAM disk. */
const uint32_t ulRAMDiskSectorCount = 1024;
const uint32_t ulSectorSize = 512; /* Each sector is 512 bytes. */
const size_t xIOManagerCacheSize = 2048; /* Minimum 2 * ulSectorSize. */
uint8_t *pucRAMDiskBuffer;
FF_Disk_t *pxDisk;
/* Allocate memory for the RAM disk. */
pucRAMDiskBuffer = p = vPartMalloc( ulRAMDiskSectorCount * ulSectorSize );
if (pucRAMDiskBuffer == NULL)
{
/* Handle error: Not enough memory. */
printf("Not enough memory to allocate RAM disk buffer.\r\n");
return;
}
/* Create the RAM disk. */
pxDisk = FF_RAMDiskInit("RAMDisk", pucRAMDiskBuffer, ulRAMDiskSectorCount, xIOManagerCacheSize);
/* Check the RAM disk was created successfully. */
if (pxDisk != NULL)
{
/* Print disk name. */
printf("RAM disk created.\r\n");
/* Create a file on the RAM disk. */
FF_FILE *pxFile = ff_fopen("ram:/example.txt", "w"); <------------------------ fails
if (pxFile != NULL)
{
const char *pcMessage = "Hello, RAM disk!";
ff_fwrite(pcMessage, 1, strlen(pcMessage), pxFile);
ff_fclose(pxFile);
printf("File created successfully on RAM disk.\r\n");
}
else
{
/* Handle error opening file. */
printf("Failed to open file on RAM disk.\r\n");
}
}
else
{
/* Handle error. */
printf("Failed to create RAM disk.\r\n");
}
}
I get to the point where the disk is created but FF_FILE *pxFile = ff_fopen("ram:/example.txt", "w"); <------------------------ fails
Is there an example TI code that I can use in my app ?
Thanks,
Eli