Skip to content
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

Add UpdateHub.io support lib #13039

Merged
merged 3 commits into from
Jun 4, 2019
Merged

Conversation

otavio
Copy link
Contributor

@otavio otavio commented Feb 4, 2019

UpdateHub provides an end-to-end solution for Over-The-Air update
of embedded devices.

Signed-off-by: Christian Tavares christian.tavares@ossystems.com.br
Reviewed-by: Otavio Salvador otavio@ossystems.com.br

@zephyrbot
Copy link
Collaborator

zephyrbot commented Feb 4, 2019

All checks are passing now.

Review history of this comment for details about previous failed status.
Note that some checks might have not completed yet.

@pfalcon pfalcon requested a review from nashif February 5, 2019 08:01
@pfalcon
Copy link
Contributor

pfalcon commented Feb 5, 2019

This looks pretty cool, but I doubt it belongs to subsys/ . Rather, lib/ . I also would suggest to join initiative of #12129 and put headers under include/zephyr/ right away. But don't haste with these changes, until others provided feedback too.

But you definitely would need to act on @zephyrbot's comments ;-).

@pfalcon
Copy link
Contributor

pfalcon commented Feb 5, 2019

Also, please consider how would we ensure that this works over time. We'd need a sample, tests, etc.

@pfalcon pfalcon changed the title Add UpdateHub support Add UpdateHub.io support lib Feb 5, 2019
@pfalcon pfalcon added the area: OTA Over-the-Air Firmware Upgrade label Feb 5, 2019
@carlescufi
Copy link
Member

Thank you for this contribution!
This looks pretty good already. I agree that with @pfalcon this does not belong directly on subsys/. I think the reasonable options are:

  • lib/dfu/updatehub
  • lib/updatehub

Also please include a buildable test (a simple application that uses the library) in tests/. This will allow us to include the new code in CI so that we make sure it is not broken in the future.

Finally we would need a bit of documentation in doc/.

Copy link
Collaborator

@Laczen Laczen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @chtavares592 and @otavio, thanks for this PR. My review is only limited to the use of nvs; as my knowledge on the other (most important part) is limited:
You are using NVS to store the id, in the creation of the nvs filesystem you are using a very short (64 bytes) sector size. The sector size should be a multiple of the flash_erase_page size, so probably 64 is to small. You are also using FLASH_AREA_STORAGE as the offset of the nvs file system, this would make it impossible for other modules to use it.
My advice would be to use the settings module to store the id, this will allow other modules to use the same storage area. If you need advice/help on how to do this, let me know.

subsys/updatehub/Kconfig Outdated Show resolved Hide resolved
@otavio
Copy link
Contributor Author

otavio commented Feb 5, 2019

@pfalcon

This looks pretty cool, but I doubt it belongs to subsys/ . Rather, lib/ . I also would suggest to join initiative of #12129 and put headers under include/zephyr/ right away. But don't haste with these changes, until others provided feedback too.

We can do the inclusion of the headers on the new location for sure; we also are in process of moving it to lib/updatehub as suggested by @carlescufi.

@Laczen

You are using NVS to store the id, in the creation of the nvs filesystem you are using a very short (64 bytes) sector size. The sector size should be a multiple of the flash_erase_page size, so probably 64 is to small. You are also using FLASH_AREA_STORAGE as the offset of the nvs file system, this would make it impossible for other modules to use it.
My advice would be to use the settings module to store the id, this will allow other modules to use the same storage area. If you need advice/help on how to do this, let me know.

We are looking at this and hope to have something to share soon (or questions, hehe)...

@Laczen
Copy link
Collaborator

Laczen commented Feb 5, 2019

@Laczen

You are using NVS to store the id, in the creation of the nvs filesystem you are using a very short (64 bytes) sector size. The sector size should be a multiple of the flash_erase_page size, so probably 64 is to small. You are also using FLASH_AREA_STORAGE as the offset of the nvs file system, this would make it impossible for other modules to use it.
My advice would be to use the settings module to store the id, this will allow other modules to use the same storage area. If you need advice/help on how to do this, let me know.

We are looking at this and hope to have something to share soon (or questions, hehe)...

OK, a example on how it is used can be found in:
zephyr/samples/boards/nrf52/mesh/onoff_level_lighting_vnd_app/src/storage.c

@otavio
Copy link
Contributor Author

otavio commented Feb 6, 2019

We did get the settings integrated by then we found a problem: we lose the information when upgrade is done.

Essentially, what seems to be happening is:

Step 1: updatehub -> set updatehub/ip -> reboot
Step 2: mcuboot -> swap slots -> reboot
Step 3: updatehub -> get updatehub/ip (fail!)

@Laczen any suggestion how to approach this?

@mike-scott
Copy link
Contributor

@otavio Thank you for the PR. Overall I agree with the others in several regards (location in lib/, PR quality is good and the need for a sample / test).

I notice you are using device_identity.c which has some hard-coded values per SoC for reading device unique values. There is a Zephyr-generic solution mostly in place here: https://github.com/zephyrproject-rtos/zephyr/tree/master/drivers/hwinfo And I believe NXP support is nearly approved. You might consider using that API for getting the initial seed for your unique identifier.

RE: the settings values going away after update, make sure the partition sizes aren't overlapping between MCUboot, slot0, slot1, mcuboot's scratch area, the NVS settings, etc. If they do overlap it could explain why those settings go away during OTA.

@Laczen
Copy link
Collaborator

Laczen commented Feb 6, 2019

I agree with @mike-scott , probably there is some problem with the flash partitions. If you can put your sample somewhere I can have a look (please don't forget to mention your board).

@mike-scott
Copy link
Contributor

@otavio could provide a diff of the previous commit vs. the new one pushed a few days ago?

Copy link
Contributor

@dbkinder dbkinder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my clarity edits that I didn't introduce a technical error.

samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
samples/updatehub/README.rst Outdated Show resolved Hide resolved
@otavio
Copy link
Contributor Author

otavio commented Feb 12, 2019

@mike-scott

@otavio could provide a diff of the previous commit vs. the new one pushed a few days ago?

I am afraid we can't. We amended the changes and we later dropped those branches. We are now working on fixing the mcuboot image swap issue and we ought to have it ready for a new review.

@nashif nashif requested review from d3zd3z and jukkar April 30, 2019 14:54
@zephyrproject-rtos zephyrproject-rtos deleted a comment from codecov-io Apr 30, 2019
@chtavares chtavares force-pushed the master branch 3 times, most recently from 9911615 to 21bca3c Compare April 30, 2019 21:15
Copy link
Member

@jukkar jukkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chtavares chtavares force-pushed the master branch 2 times, most recently from 7ed404f to cd170eb Compare May 2, 2019 13:51
@nashif nashif removed dev-review To be discussed in dev-review meeting labels May 2, 2019
@chtavares chtavares force-pushed the master branch 2 times, most recently from 22da262 to c1d8206 Compare May 7, 2019 12:01
@jukkar
Copy link
Member

jukkar commented May 8, 2019

ping @d3zd3z @galak are you ok with the PR?

otavio pushed a commit to UpdateHub/zephyr that referenced this pull request May 15, 2019
This extends the UpdateHub library code to allow the
use of CoAPS/DTLS for communication.

Refs: zephyrproject-rtos#13039.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
@otavio
Copy link
Contributor Author

otavio commented May 16, 2019

@galak @d3zd3z do you mind to have a new look at this? We are not aware of any pending change.

Christian Tavares added 2 commits May 24, 2019 08:33
UpdateHub is an enterprise-grade solution which makes simple to
remotely update all your embedded devices in the field. It
handles all aspects related to sending Firmware Over-the-Air(FOTA)
updates with maximum security and efficiency, while you focus in
adding value to your product.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This extends the UpdateHub library code to allow the
use of CoAPS/DTLS for communication.

Refs: zephyrproject-rtos#13039.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
chtavares pushed a commit to OSSystems/zephyr that referenced this pull request May 24, 2019
This extends the UpdateHub library code to allow the
use of CoAPS/DTLS for communication.

Refs: zephyrproject-rtos#13039.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
This extends the UpdateHub library code to allow the
use of IPV6 for communication.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
@otavio
Copy link
Contributor Author

otavio commented Jun 4, 2019

Hello everyone. We believe it is ready to go and we addressed all issues. Is it possible for you guys to check it?

@carlescufi carlescufi dismissed stale reviews from d3zd3z and galak June 4, 2019 22:15

stale

@carlescufi
Copy link
Member

Looked through this and the only real unresolved question is where the updatehub.h header belongs. Since @nashif is doing a cleanup of headers anyway, I suggest we discuss where to place it after the fact in order to prevent this PR from bitrotting.

It could be in include/dfu or include/mgmt

@carlescufi carlescufi merged commit 543de09 into zephyrproject-rtos:master Jun 4, 2019
carlescufi pushed a commit that referenced this pull request Jun 4, 2019
This extends the UpdateHub library code to allow the
use of CoAPS/DTLS for communication.

Refs: #13039.

Signed-off-by: Christian Tavares <christian.tavares@ossystems.com.br>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking area: OTA Over-the-Air Firmware Upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.