-
Notifications
You must be signed in to change notification settings - Fork 2k
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
sys/riotboot/flashwrite: display progress bar during copy/download #12551
sys/riotboot/flashwrite: display progress bar during copy/download #12551
Conversation
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'm not happy with integrating the progress bar into the flashwrite module.
The suit module is adapted to retrieve the firmware size from the manifest and pass it to the flashwrite module.
A much less intrusive option for getting the progress bar into suit would be:
- as soon as the image size is known, store it in sth like
static size_t _imgsize;
, as global in suit/coap.c - replace the DEBUG in
suit_flashwrite_helper()
with the appropriateprogress_bar_print(prefix, suffix, (offset + len) * 100 / _imgsize)
call.
riotboot_flashwrite is a quite low-level module. At the moment, it is quite verbose through LOG_INFO, but in general, its caller has all the information on how, if and when to display a progress bar. flashwrite can only globally enable it. |
4df2958
to
2c07e11
Compare
I've reworked this PR following your suggestion @kaspar030. The problematic part now is how to share the image size between the handler code and the coap code in suit (it's using an ugly extern now). Maybe a better solution is to define the manifest static in coap.c ? |
I added the change to move the manifest as a static variable in 20ccbc6. I think it's a little better. |
20ccbc6
to
b9457b9
Compare
b9457b9
to
0013036
Compare
pls rebase! |
ebcad87
to
1311aae
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.
I have a suggestion that also allows the code to be the same as before if MODULE_PROGRESS_BAR
is not included.
I don't know why part of my comment got lost: With the proposed change we only allocate a The ptr can be set to NULL of the end of the function and the
|
1311aae
to
239e517
Compare
I don't understand which function you are talking about here. Otherwise, I think I mostly addressed your other comments. |
0445778
to
f1e3da8
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.
The ptr can be set to NULL of the end of the function and the progress_bar code can check against it being defined.
I don't understand which function you are talking about here.
At the end of _suit_handle_url(), the memmory address where manfiest_ptr
points to might be occupied by something else after the function exits. I think it should probably be set to NULL and in:
_print_download_progress
verify the pointer is not NULL, maybe I'm worried for nothing?
I think your whole suggestion is dangerous because as you says the pointer to the manifest could be invalid when the function exits. |
As discussed offline with @aabadie I think the new state is the best approach. But it does change @kaspar030 do you agree with the latest approach? |
I removed the ready for build for now, to not waste CO2. |
@kaspar030 @fjmolinas, are you ok with the current state of this PR ? May I squash/rebase ? |
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.
ACK, @kaspar030 does your change request still stand?
EDIT: @aabadie please squash
7c317cf
to
0597fc9
Compare
Thanks @kaspar030, @fjmolinas. This PR is now squashed and rebased. |
Contribution description
This PR makes use of the progress bar introduced in #12550 to nicely follow the copy/download of a firmware on flash.
The logic for updating the progress bar is added in riotboot/flashwrite submodule. The API had to be updated to add a
firmware_size
argument. There might be a better way, so suggestions are welcome.The suit module is adapted to retrieve the firmware size from the manifest and pass it to the flashwrite module.
In the
riotboot_flashwrite
, the max uint32_t value is used for the firmware_size. It is used as a fallback when the firmware_size is not known in advance.Testing procedure
Run the
examples/suit_update
testing procedure. The progress bar is displayed during the update, the automatic test works.Issues/PRs references
Depends on #12550