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

Fix/reload dct functions #1868

Merged
merged 3 commits into from Jul 30, 2019

Conversation

@XuGuohui
Copy link
Contributor

commented Jul 30, 2019

Problem

Particle Update fails to update a Photon/P1 from Device OS <1.2.1-rc.3 to 1.2.1 via DFU mode. This is caused by that after updating the system parts, the address of DCT functions that resided in system parts aren't consistent, so when bootloader tries accessing the DCT after that, it then crashes.

Solution

Dirty a flag after every DFU write operation to the internal flash, so that after updating the system parts, next time when bootloader calls DCT functions, it will reload the DCT functions to make sure that the address of the DCT functions in new system parts are valid.

Steps to Test

  1. Build and flash the new bootloader
  2. Flash older DeviceOS e.g. 1.0.0 onto the device
  3. Reset and go into DFU
  4. Write into DCT
  5. Write system-part1 and system-part2 of DeviceOS release v1.2.1 without resetting
  6. Write into DCT again, this should succeed and not crash the device

Example App

N/A

References

particle-iot/particle-cli#499
https://community.particle.io/t/device-os-1-2-1-and-particle-cli-1-43-fail-in-particle-update/51140

  • [bugfix] [Photon/P1] Bootloader correctly re-imports the DCT functions from system firmware after its modification through DFU.
Fixes the issue that DCT functions' address may be invalid after upda…
…ting system part firmware when in bootloader.
@avtolstoy

This comment has been minimized.

Let's prefer definitions from platforms.h for new code.

@avtolstoy

This comment has been minimized.

There is a MOD_FUNC_BOOTLOADER definition in module_info.h.

@XuGuohui XuGuohui added this to the 1.3.1-rc.1 milestone Jul 30, 2019

@XuGuohui XuGuohui requested a review from avtolstoy Jul 30, 2019

@XuGuohui XuGuohui removed the do not merge label Jul 30, 2019

@XuGuohui XuGuohui requested a review from avtolstoy Jul 30, 2019

@XuGuohui XuGuohui force-pushed the fix/reload_dct_functions branch from 302a887 to 5bd326a Jul 30, 2019

@XuGuohui XuGuohui requested a review from avtolstoy Jul 30, 2019

@avtolstoy avtolstoy merged commit 1b9a2d5 into develop Jul 30, 2019

3 checks passed

Codacy/PR Quality Review Up to standards. A positive pull request.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@avtolstoy avtolstoy deleted the fix/reload_dct_functions branch Jul 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.