-
Notifications
You must be signed in to change notification settings - Fork 4
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
OTA download and decompress on the fly #43
OTA download and decompress on the fly #43
Conversation
cdfa12a
to
085768d
Compare
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.
@andreagilardoni i've tested the code and it works. Just a couple of minor things that i think can be improved:
- commit history can be improved a little bit more. All subsequentials changes to the LZSSDecoder can be squashed in a single commit.
- Alway put a space after
if
for
... to be consistent to the code style
} ota_progress; | ||
|
||
int bytes = socket->download(url, is_https, [&decoder, &ota_header, &ota_progress](const char* buffer, uint32_t size) { | ||
for(char* cursor=(char*)buffer; cursor<buffer+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.
I think you can directly declare cursor
as uint8_t*
and also cast buffer to uint8_t*
this should avoid cast in line 177
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.
The correct approach will be to define buffer as char* const
, but this requires lots of changes in the core code. Then cast cursor to uint8_t*
in decompress call
34304da
to
394c825
Compare
enum FSM_STATES: uint8_t { | ||
FSM_0 = 0, | ||
FSM_1 = 1, | ||
FSM_2 = 2, | ||
FSM_3 = 3, | ||
FSM_EOF | ||
} state; |
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.
@andreagilardoni i would give a more meaningful name to this FSM states if it possible
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 are no meaningful names for those states
@andreagilardoni CI is failing because is using an old deprecated mbed core for portenta. See
|
eb58243
to
6038ad6
Compare
e7a8d74
to
9c13139
Compare
The objective of this implementation is to provide a more versatile way of handling decompression of lzss streams of data. The main reason is to allow streaming decompression
…old implementation
9c13139
to
f3db4bc
Compare
Memory usage change @ f3db4bc
Click for full report table
Click for full report CSV
|
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.
💪 Thanks @andreagilardoni
This PR aims to provide a easy to use utility class
LZSSDecoder
that can be used to perform an OTA update on the fly.Since in the mbed core we provide apis for http download using callbacks it was required to adapt the code for the decode function.
Some examples for the usage of
LZSSDecoder
were added and they made it possible to measure the performance improvements obtained from a sequential download and decompress to a download and decompress on the fly:This way the OTA download and decompress operations now take 35% of the time.
This PR requires arduino/ArduinoCore-mbed#785