First a question about how libflash works:
I queried fl_getFactoryImage() and found that the "factory" image size corresponds to the current code image that I wrote to the device.
From this forum http://www.xcore.com/forum/viewtopic.ph ... t=libflash, the start location of the data partition is stored in the beginning of the flash by xflash.
How is the start location of the Data Partition computed by xflash? One might assume that it would start after the last image partition ( in this case just the factory image). If this is true, what happens if the code expands and we write a larger factory image? How would one then keep a constant reference for the Data Partition to retrieve stored parameters?
Second, I am having trouble getting the libflash functions to work as expected. I can successfully run the following functions:
fl_connect()
fl_getFlashType()
fl_getFlashSize()
fl_getFactoryImage()
These all return successfully with valid data.
But the following other functions fail:
fl_getDataPartitionSize()
fl_getNumDataSectors()
fl_getWriteScratchSize()
fl_writeData()
Here is the code I am using to test:
Code: Select all
int DatSize, Success[4], i;
unsigned sizes[4];
unsigned char DatBuffer[RAW_ARRAY_MAX], dummy[4096];
fl_BootImageInfo finfo;
Success[0] = fl_connect(spiPorts);//ToDevice(spiPorts, devs, 2);
Success[1] = fl_getFlashType();
Success[2] = fl_getFactoryImage(finfo);
sizes[0] = fl_getFlashSize();
sizes[1] = fl_getDataPartitionSize();
sizes[2] = fl_getNumDataSectors();
sizes[3] = fl_getWriteScratchSize(0, 8192);
/////Code initializing DatBuffer and DatSize here////
Success[3] = fl_writeData(0, DatSize, DatBuffer, dummy);
Is there some kind of setup I need to do to activate the Data Partition? Or something else I'm missing? (clearly)
Thanks for any insight.