Bundle Protection
122
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
File System
Table 8-4. Bundle Protection
Step
Operation
System State After Operation
1
Create (with failsafe flag), write, close n
files
Bundle STOPPED
2
For each of the n files, open the file for
write with the bundle flag, write the file
and close it.
Bundle STARTED, reading the files
results in their old copy.
Before the files closure they are on state
OPEN_BUNDLE_COMMIT.
After the file closure they are in state
PENDING_BUNDLE_COMMIT.
3
Call Sl_Stop(X>0) and Sl_Start().
On this step, the host tests the system, to
make sure that the downloaded content is
functioning as expected.
Bundle state is PENDING_COMMIT,
Reading the files results in their new copy.
Each n file is in
PENDING_BUNDLE_COMMIT state.
4
In case the system test passed
successfully, the host approves the bundle
(=call to bundle commit), else initiate
rollback of the files (=call the bundle
rollback).
Bundle state is STOPPED.
Rollback of the bundle files makes their
old copy the valid one.
Commit of the bundle files makes their
new copy the valid one.
In case of power failure before the content
approval (= failure during Step 2 or 3), the
device automatically calls the bundle
rollback.
Bundle state is STOPPED.
Reading the files results in their old copy.
8.9.1 Bundle File States
To update a file as part of a bundle, the file should be opened for write with the bundle flag
(SL_FS_WRITE_BUNDLE_FILE). Open a new file as part of a bundle that has no pre-conditions.
To open an existing file as part of a bundle, the file should fulfill the following conditions:
•
The file was created with the FAILSAFE flag.
•
The file has a valid copy (meaning that the file was successfully written at least once).
The device manages the state of a file. The file state can be viewed by retrieving the file flags, and the file
flags can be retrieved by the FsGetFileList() function and the sl_FsGetInfo() function.
The following is a list of the possible file states.
•
Standard: A file which is not part of a bundle.
–
If a bundle is committed or rolled back, the bundle files state is changed to standard file.
–
A file opened as a bundle file, but was aborted instead of being closed, changes its state to
standard file.
•
SL_FS_INFO_BUNDLE_FILE
–
The file is currently open with the bundle flag, but has not been closed yet.
–
If the host invokes abort instead of close, the file state changes to standard file.
•
SL_FS_INFO_PENDING_BUNDLE_COMMIT
–
The file is currently open with the bundle flag, but has been closed.
–
The file in this state cannot be opened for write until the bundle is committed or rolled back. Trying
to open this file for write results with the error: SL_ERROR_FS_FILE_IS_PENDING_COMMIT.
–
The file on this state can be opened for read; the file copy that will be read is depended on the
bundle state.
is a summary of the possible file states related to the bundle state (the bundle states are
described in the following section).