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

boards/stm32f3discovery: fix openocd config to flash from invalid state #11550

Merged
merged 1 commit into from
Sep 11, 2019

Conversation

cladmi
Copy link
Contributor

@cladmi cladmi commented May 20, 2019

Contribution description

When flashing some applications the flasher sometimes gets stuck which
prevents flashing after.
It may be from a specific firmware or operation but do not have one yet.
Connect with reset asserted fix flashing from this state.

It was found after the stm32f3discovery get stuck in a non-flashable mode
after some firmwares.

Testing procedure

TODO: find a firmware that prevents re-flashing it

Flashing still works.

It should also fix flashing from invalid state but I do not know any way of re-creating it.

Issues/PRs references

Found while running the test suite on the board in #10870

Depends on #11976

@cladmi cladmi added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Area: build system Area: Build system Area: tools Area: Supplementary tools Area: boards Area: Board ports labels May 20, 2019
@cladmi cladmi added this to the Release 2019.07 milestone May 20, 2019
@cladmi cladmi requested a review from aabadie May 20, 2019 12:29
@cladmi
Copy link
Contributor Author

cladmi commented May 20, 2019

@aabadie I think you may have more insight on this, how to do a failing test and what should be changed in general. It would be nice to add a testable firmware to show it must be fixed in general.

@cladmi cladmi changed the title boards/stm32f3: fix openocd config to flash from invalid state WIP boards/stm32f3: fix openocd config to flash from invalid state May 20, 2019
@cladmi cladmi requested a review from MrKevinWeiss May 28, 2019 10:19
@MrKevinWeiss
Copy link
Contributor

If it is any help I have a commit and firmware (though it is for the nucleo-l073rz, maybe it would also work for your board) documented in #10343.
I don't think I have a board to test.

@cladmi
Copy link
Contributor Author

cladmi commented May 28, 2019

@MrKevinWeiss unfortunately it does not make it non flashable

@MrKevinWeiss
Copy link
Contributor

I mean, it isn't the worst thing if we can't break the board 😄

@cladmi
Copy link
Contributor Author

cladmi commented Jun 3, 2019

I mean, it isn't the worst thing if we can't break the board smile

It only breaks the flasher configuration, not the board :)

@cladmi
Copy link
Contributor Author

cladmi commented Sep 2, 2019

Now depending on #11976

@cladmi cladmi changed the title WIP boards/stm32f3: fix openocd config to flash from invalid state boards/stm32f3discovery: fix openocd config to flash from invalid state Sep 2, 2019
@cladmi cladmi force-pushed the pr/stm32f3discovery/fix_flashing branch 2 times, most recently from e579f97 to 1f6f008 Compare September 2, 2019 13:58
@cladmi
Copy link
Contributor Author

cladmi commented Sep 2, 2019

Rebased and kept only the update after #11976 was merged

@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines labels Sep 9, 2019
@aabadie aabadie removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Sep 9, 2019
Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

Tested this PR and couldn't find any obvious regression. My main problem with testing is to find a firmware that avoid reflashing the board after. I tried to toggle the CPU to deep sleep, but OpenOCD is still able to reflash.

In any case, the changes strengthen the actual configuration. So ACK
Please fix the minor typo reported and squash directly.

@@ -8,5 +8,9 @@ include $(RIOTMAKE)/tools/serial.inc.mk
DEBUG_ADAPTER ?= stlink
STLINK_VERSION ?= 2

# The board can become un-flashable after a some execution,
Copy link
Contributor

Choose a reason for hiding this comment

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

s/after a some execution/after some execution/

@cladmi
Copy link
Contributor Author

cladmi commented Sep 11, 2019

Tested this PR and couldn't find any obvious regression. My main problem with testing is to find a firmware that avoid reflashing the board after. I tried to toggle the CPU to deep sleep, but OpenOCD is still able to reflash.

Somehow I think it would need to be a firmware that does it, or a hardfault as it was for the stm32l boards, as first step in main with no init done before.

Because if openocd resets the board, and manages to start writing before it hardfaults or sleep, it would work.

When flashing some applications the flasher sometimes gets stuck which
prevents flashing after.
It may be from a specific firmware or operation but do not have one yet.
Connect with reset asserted fix flashing from this state.

It was found after the `stm32f3discovery` get stuck in a non-flashable mode
after some firmwares.
@cladmi cladmi force-pushed the pr/stm32f3discovery/fix_flashing branch from f5bafa0 to f5f275b Compare September 11, 2019 10:19
@cladmi
Copy link
Contributor Author

cladmi commented Sep 11, 2019

Typo fixed and squashed.

Copy link
Contributor

@aabadie aabadie left a comment

Choose a reason for hiding this comment

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

ACK and go (when Murdock is ready ;) )

@benpicco benpicco merged commit 6c35e86 into RIOT-OS:master Sep 11, 2019
@cladmi
Copy link
Contributor Author

cladmi commented Sep 11, 2019

Thank you for the review.

@cladmi cladmi deleted the pr/stm32f3discovery/fix_flashing branch September 11, 2019 12:49
@kb2ma kb2ma added this to the Release 2019.10 milestone Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: boards Area: Board ports Area: build system Area: Build system Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Reviewed: 1-fundamentals The fundamentals of the PR were reviewed according to the maintainer guidelines Reviewed: 2-code-design The code design of the PR was reviewed according to the maintainer guidelines Reviewed: 4-code-style The adherence to coding conventions by the PR were reviewed according to the maintainer guidelines Reviewed: 5-documentation The documentation details of the PR were reviewed according to the maintainer guidelines Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants