Skip to content

boards/b-l072z-lrwan1: fix openocd configuration and 'make debug'#8790

Merged
cladmi merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/openocd_b-l072z-lrwan1
Jun 29, 2018
Merged

boards/b-l072z-lrwan1: fix openocd configuration and 'make debug'#8790
cladmi merged 3 commits intoRIOT-OS:masterfrom
aabadie:pr/openocd_b-l072z-lrwan1

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Mar 16, 2018

Contribution description

This PR is an attempt to fix the make flash and debug targets with the b-l072z-lrwan1 board. The current state in master prevents the debug from being used with it.

#8500 initially tried to provide a solution for flashing the board when the MCU is in low-power mode. Digging a little more in OpenOCD documentation, it appears that just the connect_assert_srst reset option was required: this option forces a wake up of the MCU before flashing (e.g ensure 'SRST is asserted'). So the first part of this PR is to restore the initial config (srst_only) and add connect_assert_srst because only this new option was required.
But the problem now is that when one adds this new option, it breaks the make debug command for this board (and maybe others).

So the second part of this PR tries to fix the make debug by forcing a reset in the openocd debug command.

It works for this board, now I can flash, even if the MCU is in low-power mode, and debug the board. But I'm not sure if the change in openocd.sh is valid.

Issues/PRs references

None

@aabadie aabadie added Area: build system Area: Build system Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: tools Area: Supplementary tools Area: boards Area: Board ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Mar 16, 2018
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 19, 2018

This PR is quite important for a good user experience with the ST LRWAN1. I don't know who could be a good reviewer for this, maybe @gebart or @vincent-d ?

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 19, 2018

This was somehow already taken into account in boards/common/nucleo/dist/ where all the configs for stlink are stored. I suppose this needs a major refactor to avoid the declaration of similar configurations for this debugger.

Though this is not a nucleo board, it uses the same debugger.

Do you know if there are major changes in the physical connections compared to a nucleo board?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 19, 2018

Do you know if there are major changes in the physical connections compared to a nucleo board?

Yes and they are very similar, see #8475, where I tried to factorize all these boards.

But this PR adds an extra reset option (connect_assert_srst), which is required when the MCU is in sleep mode. Otherwise flashing failed.

The main thing I'm unsure is the change in openocd.sh.

@aabadie aabadie force-pushed the pr/openocd_b-l072z-lrwan1 branch from 4f08b13 to b773e49 Compare March 19, 2018 13:57
@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 19, 2018

Yes and they are very similar, see #8475, where I tried to factorize all these boards.

Ok, then I'd say first merge #8475, which is almost ready as far as I see the discussion.

But this PR adds an extra reset option, which is required when the MCU is in sleep mode. Otherwise flashing failed.

Which extra reset? On openocd.sh? Anyhow, currently the stm32l0 have the options you added, minus the connect_assert_srst which is not present. Is it really necessary? Is it currently working on stm32l0 nucleo boards?

The main thing I'm unsure is the change in openocd.sh.

This would need extensive testing to see if the boards using openocd are not affected. In my small experience with it, I'd say it doesn't hurt at all, it's just an extra reset, but I'd like to test on some boards to see if it really doesn't affect.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 19, 2018

The main thing I'm unsure is the change in openocd.sh.

But this change is required if I want use make debug on that board. The problem might be more general with openocd.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Mar 19, 2018

Which extra reset? On openocd.sh? Anyhow, currently the stm32l0 have the options you added, minus the connect_assert_srst which is not present. Is it really necessary? Is it currently working on stm32l0 nucleo boards?

Sorry, maybe I was unclear, I updated my comment with the option name (already mentioned in the initial description of this PR though).

then I'd say first merge #8475, which is almost ready as far as I see the discussion

Not sure, I would say that the discussion there is staled. Maybe @haukepetersen or @gebart want to add something there.

I'd like to test on some boards to see if it really doesn't affect

That's exactly my point.

miri64
miri64 previously requested changes Mar 27, 2018
-c 'init' \
-c 'targets' \
-c 'halt' \
-c 'reset halt' \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this should be made configurable somehow so you can only set it for certain boards.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good idea !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aabadie aabadie force-pushed the pr/openocd_b-l072z-lrwan1 branch from b773e49 to f2cc3bc Compare June 4, 2018 15:24
@aabadie aabadie removed the Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR label Jun 4, 2018
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 18, 2018

@cladmi, I think this one could be merged. @miri64 you change request was already addressed and merged in #8856.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Jun 18, 2018

This PR is reverting your #8500 PRand updating the configuration.
I would really like to have the justification in the commit message(s).

Apart from that, if it works for you, I think we can go.

Maybe @jia200x you can also test if you have this board ?

@cladmi cladmi requested a review from jia200x June 18, 2018 11:50
@aabadie aabadie force-pushed the pr/openocd_b-l072z-lrwan1 branch from f2cc3bc to e28f6a0 Compare June 18, 2018 12:05
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 18, 2018

@cladmi, not sure it's better, but I added some information in the commit message.

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Jun 18, 2018

There's no need for trst signal, just srst is enough. Also not using srst_nogate
seems safer.

connect_assert_srst is used to enforce a CPU reset before connecting to
it with openocd. This is useful when debugging on-chip.

As described, there are changes for doing reset correctly == fix and changes for cleanup/safer things, + adding the 'rtos' thing. I always prefer them in separate commits in case one breaks someones board.
Also it forces to justify why a change is required.

aabadie added 3 commits June 19, 2018 13:13
There's no need for trst signal, just srst is enough. Also not using srst_nogate
seems safer.
connect_assert_srst is used to enforce a CPU reset before connecting to
it with openocd. This is useful when debugging on-chip.

For details on openocd reset configuration, see
@aabadie aabadie force-pushed the pr/openocd_b-l072z-lrwan1 branch from e28f6a0 to ba30315 Compare June 19, 2018 11:17
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 19, 2018

I always prefer them in separate commits in case one breaks someones board.

@cladmi, I split the commit in 3, hope this is fine for you :)

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 20, 2018

@miri64, are you ok with the changes here ?

@miri64 miri64 dismissed their stale review June 20, 2018 07:52

I trust @cladmi's judgement more than my own, when it comes to openocd ;-)

@cladmi cladmi merged commit d055fde into RIOT-OS:master Jun 29, 2018
@cladmi cladmi added this to the Release 2018.07 milestone Jul 10, 2018
@aabadie aabadie deleted the pr/openocd_b-l072z-lrwan1 branch September 23, 2018 08:58
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants