Other Parts Discussed in Thread: UNIFLASH
Tool/software: TI-RTOS
Hello,
Device used : CC3220SF-LAUNCHXL
We are trying to use file-system API for saving configuration of the device from our application layer.
File size is 16 Kbytes max and We are reading file at random offsets.
If it is found the particular data is outdated then we need to update that data, anywhere in file(start , end or middle).
Blank file of 16 KBytes is already programmed using uniflash in the device. And we have stored null of size 16 KBytes in that file using hex editor.so that file max size & file length both are same of 16KBytes.
Below function update_device_config() is being called based on events repetitively.
What is happening here is that, if we write at the middle of the file. Only that data is available in the file for next read operation & remaining file content is erased.
I also checked sl_FsGetInfo & found out that fileinfo.Len parameter is updated. Now the file length is less than max file size, which is 16KBytes at the time of creation. This new file length is (offset+size_of_buff).
Please refer below Pseudocode
//Pseudo code update_device_config() { int32_t fHdl; fHdl = sl_FsOpen(SL_DKEY_FILE, (SL_FS_READ), NULL); Get_Device_config_Status(&offset_for_updation); sl_FsClose(fHdl,0,0,0); fHdl = sl_FsOpen(SL_DKEY_FILE, ( SL_FS_WRITE |SL_FS_OVERWRITE ),NULL); sl_FsWrite(fHdl,offset_for_updation, buff, size_of_buff); }
What is the proper method to update the file ?
What is missing ?