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

Support for software update to Direct-XIP built applications #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

de-nordic
Copy link
Contributor

Depends on #114

The PR contains two PRs that

  1. Add automatic selection of running application slot at compile time
  2. Remove restrictions on uploading applications to "pending" slots for Direct-XIP applications

@de-nordic
Copy link
Contributor Author

@mlaz , @nvlsianpu , @utzig Can you take a look?


#define DT_CODE_PARTITION_NODE DT_CHOSEN(zephyr_code_partition)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether this can be included as a zephyr-rtos header?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean that it should be in separate header taken directly from Zrephyr code base?
I was also thinking about that and that is one of reasons behind zephyrproject-rtos/zephyr#32257

@@ -400,6 +400,7 @@ int img_mgmt_impl_erase_if_needed(uint32_t off, uint32_t len)
int
img_mgmt_impl_swap_type(void)
{
#if !defined(CONFIG_IMG_MGMT_DIRECT_XIP)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is possible to distinguish test-run while app is polling the swap type as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does the direct-xip support test runs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if I understand reasoning behind this patch.
If in direct-xip mode one can upload image to pending slot than why bother with pending flag at all in this mode?

Copy link
Contributor Author

@de-nordic de-nordic Mar 15, 2021

Choose a reason for hiding this comment

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

@sjanc In this mode application will run from the slot it has been uploaded to. The problem is that you could still set the "opposite" slot in pending mode which means it would not be possible to overwrite and the flag would never be lifted as in XIP mode it will not switch slots, example:
0) let have app_v0.0.0 and app_v0.0.1

  1. the app_v0.0.0 is running
  2. set the "opposite" slot to pending
  3. try to upload app_v0.0.1, will fail
  4. reboot
  5. the app_v0.0.0 is running, the "opposite" slot is in pending state, it is not possible to overwrite it at this point anymore.
  6. reboot and you are at 5 again.

Copy link
Contributor

@sjanc sjanc Mar 15, 2021

Choose a reason for hiding this comment

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

yes, this is what I mean. Isn't the whole point of pending flag is to prevent it?
it == uploading new image before current proces of testing 'previous new image' is done?

The changes IMG_MGMT_BOOT_CURR_SLOT defintion from being hard-coded
to 0 to automatically assigned value corresponding to slot occupied by
DTS chosen zephyr,code-partition.

Signed-off-by: Dominik Ermel <[email protected]>
The commit removes restriction from uploading to slot marked as pending
(confirmed or for test) when mcumgr has been compiled into application
that has been configured with CONFIG_IMG_MGMT_DIRECT_XIP, which means
that it will be accepting Direct-XIP only updates.

Signed-off-by: Dominik Ermel <[email protected]>
de-nordic added a commit to de-nordic/zephyr that referenced this pull request Feb 25, 2021
This is test update of west.yml that tests:
 apache/mynewt-mcumgr#115

that introduce:
 1) compile time selection of slot from which application is running
    to mcumgr;
 2) removal of restrictions on uploading images to slots marked as
    pending, for Direct-XIP enabled applications.

Signed-off-by: Dominik Ermel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants