-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App storage functionality simplification #865
base: API_LEVEL_22
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## API_LEVEL_22 #865 +/- ##
===============================================
Coverage ? 83.02%
===============================================
Files ? 9
Lines ? 483
Branches ? 0
===============================================
Hits ? 401
Misses ? 82
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
0302e1f
to
5a0ad66
Compare
include/app_storage.h
Outdated
/* Setters */ | ||
int32_t app_storage_pwrite(const void *buf, uint32_t nbyte, uint32_t offset); | ||
void app_storage_set_data_version(uint32_t data_version); | ||
void app_storage_increment_data_version(void); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarevalo-ledger >> Do we need app_storage_erase()
to be able to dynamically reduce app storage size ?
@iartemov-ledger >> To note that from SDK PoV we'll be able to play only if the part at the end of storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI Neither app-boilerplate
nor app-security-key
remove some storage data today (in app-security-key
there is an erase, but just only to add another data to the very same slot).
/* NVM data (ex-filesystem) */ | ||
/* TODO: should we align the start of N_ variables on page size ? */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current version supports 2 approaches:
- NVM accessible through
app_storage
API, backupable and restorable - NVM accessible through
N_
variable (legacy approach), NOT backupable and restorable
I do not see anything bad to support the both it gives the possibility to user to backuping/restoring some data. And it will work for apps that have not yet migrated to the new API (we'll need tests for all this).
@@ -69,7 +69,11 @@ SECTIONS | |||
|
|||
_nvram_data = .; | |||
|
|||
/* App storage */ | |||
*(.storage_section) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jarevalo-ledger >> to add preprocessor checking for HAVE_APP_STORAGE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not run processor against the .ld
files currently.
If no variable is declared in storage_section
it will not occupy anything.
4ca4e02
to
90233cd
Compare
90233cd
to
6654e6b
Compare
master
.Corresponds to
app-boilerplate
change: LedgerHQ/app-boilerplate#147Corresponds to
app-security-key
change: LedgerHQ/app-security-key#69Description
HAVE_APP_STORAGE
,APP_STORAGE_SIZE
,HAVE_APP_STORAGE_PROP_SETTINGS
andHAVE_APP_STORAGE_PROP_DATA
have to be define in app's Makefilestruct_version
is the header version (the app data versioning has to be done explicitly in the app)size
represents the app data size, starts with 0 and grows with writesTODOs
Changes include
Breaking changes
See above ⬆️