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/stm32l0: Fix openocd to prevent flash locking #10343

Merged
merged 1 commit into from
Mar 14, 2019

Conversation

MrKevinWeiss
Copy link
Contributor

Contribution description

This commit add the connect_assert_srst which requires the SRST to be asserted before trying to connect.
Certain firmwares will cause it to get to a state where flashing fails and the reset button must be pushed at the correct time to recover.

Testing procedure

on 7645c66 commit
BOARD=nucleo-l073rz make flash -C tests/driver_my9221
then try flashing anything after.
It seems in master the driver_my9221 doesn't cause lockup anymore but if it is already locked up it doesn't fix it (this pr does).

Issues/PRs references

Fixes #10341

@MrKevinWeiss MrKevinWeiss added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: tools Area: Supplementary tools labels Nov 7, 2018
@MrKevinWeiss MrKevinWeiss self-assigned this Nov 7, 2018
@MrKevinWeiss MrKevinWeiss requested a review from aabadie November 7, 2018 13:09
@aabadie
Copy link
Contributor

aabadie commented Nov 7, 2018

Certain firmwares will cause it to get to a state where flashing fails and the reset button must be pushed at the correct time to recover.

This happens mainly when the firmware uses sleep pm modes (off or standby). I agree that this PR is useful for such cases.

@MrKevinWeiss
Copy link
Contributor Author

@aabadie Is there anything more that this needs?

@aabadie
Copy link
Contributor

aabadie commented Nov 22, 2018

I just realized that this change is also affecting other nucleo boards: nucleo-l053r8 and nucleo-l031k8, because this openocd configuration file is shared between them.

Since you are reusing the same openocd configuration than the one use by the b-l072z-lrwan1 board, maybe you could use the shared openocd configuration with this board as well ?

@MrKevinWeiss
Copy link
Contributor Author

I think we should may even expand this, the reason why the assert was left out seems to be so one could debug without resetting it catching a failure state. I am not sure if this should be the default action though, maybe it would be better to just set a flag to stop the reset assert from happening? If that is the case than many should be changed.

@smlng
Copy link
Member

smlng commented Nov 30, 2018

so, how to move this forward?

@MrKevinWeiss
Copy link
Contributor Author

It would be good to see if the problem occurs on the other nucleo boards and if this fix is valid.

This commit add the connect_assert_srst which requires the SRST to be asserted before trying to connect.
Certain firmwares will cause it to get to a state where flashing fails and the reset button must be pushed at the correct time to recover.
@aabadie
Copy link
Contributor

aabadie commented Nov 30, 2018

It would be good to see if the problem occurs on the other nucleo boards and if this fix is valid.

I think it is. Some months ago, in a previous PR (maybe #8475), I already tried to pass this change. IT was working on all L0 nucleo boards (for sure). But this is not the question.
This is the question:

the reason why the assert was left out seems to be so one could debug without resetting it catching a failure state. I am not sure if this should be the default action though, maybe it would be better to just set a flag to stop the reset assert from happening?

It is also related to #10479 and #8976 I think.

@MrKevinWeiss
Copy link
Contributor Author

Since you are reusing the same openocd configuration than the one use by the b-l072z-lrwan1 board, maybe you could use the shared openocd configuration with this board as well ?

Done, and it makes everything slightly cleaner!

@smlng smlng added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Dec 19, 2018
@smlng
Copy link
Member

smlng commented Jan 10, 2019

so @aabadie is this mergeable? seems to work with the L0s a we have...

@MrKevinWeiss
Copy link
Contributor Author

I think there was a PR that changed the reset assert to default and allows you to select if you want to flash without reset (so you can get into debug mode)... I don't know if that takes care of this.

@m214089
Copy link

m214089 commented Jan 31, 2019

I have had the same problem with an f401re and appling the change to
boards/common/stm32/dist/stm32f4.cfg
resolved the problem. Might it be a good change for all stm32 boards?

@MrKevinWeiss
Copy link
Contributor Author

Ya, I think the issue is that one cannot enter into debug mode without it resetting. I will ask around, I thought there was a pr that would give the option but I couldn't find it.

I would be nice to have this in for everything, it seems to make the flasher more robust.

ping @kaspar030 @gebart @smlng

@aabadie
Copy link
Contributor

aabadie commented Mar 14, 2019

I'm fine with this PR, but once it's merged we'll also have to merge #10479 rather soonish, otherwise make debug won't work on stm32l0 (and possibly other stm32).

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

@aabadie aabadie added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 14, 2019
@aabadie
Copy link
Contributor

aabadie commented Mar 14, 2019

I retriggered Murdock just in case and it's still green. Let's go!

@aabadie aabadie merged commit e3b10e3 into RIOT-OS:master Mar 14, 2019
@MrKevinWeiss
Copy link
Contributor Author

Thanks @aabadie! I forgot about this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: ARM Platform: This PR/issue effects ARM-based platforms 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.

driver_my9221 prevents further flashing of nucleo-l073rz
5 participants