Skip to content

boards/stm32: use common place of openocd config files for all boards using stlink#8475

Merged
aabadie merged 6 commits intoRIOT-OS:masterfrom
aabadie:pr/common-stlink
Jun 28, 2018
Merged

boards/stm32: use common place of openocd config files for all boards using stlink#8475
aabadie merged 6 commits intoRIOT-OS:masterfrom
aabadie:pr/common-stlink

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Jan 30, 2018

Contribution description

This PR moves the st-link related codes in boards/common/nucleo/Makefile.include in a common place, e.g boards/common/stm32-stlink.
This is because not only Nucleo boards use st-link, but also b-l072z-lrwan1 and b-l475e-iot01a boards. The support for these 2 boards is also updated by this PR.

Maybe the stlink related code could go in another place so suggestions are welcome.
Maybe this common code could be reused by stm32fxdiscovery boards since they also use stlink (but some has different openocd configurations).

Issues/PRs references

None

@aabadie aabadie added Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: tools Area: Supplementary tools Area: boards Area: Board ports labels Jan 30, 2018
@aabadie aabadie requested a review from haukepetersen January 30, 2018 07:50
@aabadie aabadie added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jan 30, 2018
@jnohlgard
Copy link
Copy Markdown
Member

I like the idea, better configuration reuse, but the interdependence between the board directories is a bit messy (stm32-stlink depends on files in the nucleo common directory)
Is it possible to place some of the configuration in makefiles/tools/ if it is reusable for all st-link users?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

Is it possible to place some of the configuration in makefiles/tools/ if it is reusable for all st-link users?

Not sure, st-link allows the use of openocd and this is directly related to boards. Maybe move the common openocd in another directory boards/common/stm32-openocd ?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

the interdependence between the board directories is a bit messy

Indeed, I missed that part...

@haukepetersen
Copy link
Copy Markdown
Contributor

Good cleanup!

I am thinking though: doesn't it rather make sense to move the makefile out of the board tree and dump/merge all the lines from boards/common/stm32-stlink/Makefile.include into makefiles/tools/openocd-adapters/stlink.inc.mk? I think this would probably be the cleaner and more versatile approach.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

Updated this PR by moving the common openocd configuration from the common/nucleo to common/stm32-stlink. I think it's better like this.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

I think this would probably be the cleaner and more versatile approach.

Sorry, I missed that comment. I'll give this a try.

@haukepetersen
Copy link
Copy Markdown
Contributor

cool. (actually, I also saw this file for the first time today :-) ).

Maybe we can add a cfg or config sub-dir to dist/tools/openocd/ where we can put all the openocd `.cfg files? This way we can maybe improve reusage of them also for many other platforms?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

I also saw this file for the first time today :-)

Same here !

This way we can maybe improve reusage of them also for many other platforms?

That's what I'm trying to do :)

@aabadie aabadie force-pushed the pr/common-stlink branch 2 times, most recently from d15d0ce to 72b6156 Compare January 30, 2018 13:01
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 30, 2018

I reworked a bit this PR, including previous comments. Here the actual status:

  • move stm32 openocd config files to makefiles/tools/openocd-adapters/configs. It will certainly be possible to move other openocd configurations there (for other CPUs) and have a common place for all of them
  • kept boards/common/stm32-stlink to have a single place with common serial, stlink and includes

Copy link
Copy Markdown
Contributor

@haukepetersen haukepetersen left a comment

Choose a reason for hiding this comment

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

I still like this PR and it is getting there :-)

But I am also still convinced, that we can get rid of boards/common/stm32-stlink/Makefile.include and move the contained information to more general makefiles.

export STLINK_VERSION ?= 2-1

# Include openocd adapters for st-link
include $(RIOTMAKE)/tools/openocd-adapters/stlink.inc.mk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there seems to be a include-loop: here we include stlink.inc.mk and below openocd.inc.mk. But openocd.inc.mk does also include stlink.inc.mk... So seems to me we can drop this line.


# Default is to use ST-link v2-1 adapter (used by all Nucleos)
export DEBUG_ADAPTER ?= stlink
export STLINK_VERSION ?= 2-1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about to more this line to the top of makefiles/tools/openocd-adapters/stlink.inc.mk and add doc that version 2-1 is the default?

# configure the serial terminal
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it is not very clean to put the common serial configuration into a common board folder that is referring to a programmer...

I think I have an alternative idea, will PR something later tonight.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

forgot to mention: examples where this might get confusion are for example the green discovery boards, which have an on-board stlink, but don't supply any serial adapter...

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.

ok, I was not aware of that.

I think I have an alternative idea, will PR something later tonight.

Describe what you have in mind and I'll update this PR

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright, so how about #8484 for this part.

Copy link
Copy Markdown
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

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

Why move the openocd configs to dist/tools/openocd-adapters?
I'd prefer them in boards/common, or maybe if dist, why not just dist/tools/openocd/configs?


# select OpenOCD configuration depending on CPU type
ifeq (,$(OPENOCD_CONFIG))
ifeq ($(CPU),stm32f0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not OPENOCD_CONFIG := $(RIOTMAKE)/tools/openocd-adapters/configs/$(CPU).cfg?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 31, 2018

I am also still convinced, that we can get rid of boards/common/stm32-stlink/Makefile.include

Done, since #7695 might be a good solution for common serial port configuration

I'd prefer them in boards/common, or maybe in dist, why not just dist/tools/openocd/configs?

I can move them to boards/common, where I think it's simpler to find. In fact, I don't have a strong opinion on that.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 31, 2018

Why not OPENOCD_CONFIG := $(RIOTMAKE)/tools/openocd-adapters/configs/$(CPU).cfg?

Good point! Completely missed that factorisation. Done !

@aabadie aabadie force-pushed the pr/common-stlink branch 2 times, most recently from 34e12ae to c6b895f Compare January 31, 2018 14:44
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Feb 5, 2018

I'd prefer them in boards/common, or maybe in dist, why not just dist/tools/openocd/configs?

Thinking of it now and it makes more sense to put the common openocd config files in boards/common. This is because those files contains openocd options that are specific to some boards.
Why not boards/common/stm32/openocd ?

@kYc0o
Copy link
Copy Markdown
Contributor

kYc0o commented Mar 19, 2018

Thinking of it now and it makes more sense to put the common openocd config files in boards/common. This is because those files contains openocd options that are specific to some boards.
Why not boards/common/stm32/openocd ?

I don't think it's directly bound to stm32, since that's a cpu and the config depends on the board. For this, I would say a bigger refactor on the boards folder is necessary, on which we can maybe separate the boards according to it's CPUs, or a similar approach.

However, it's also not bound to nucleo devices, even though they're very similar.

I'd vote for something like boards/common/st, which is bound only to the manufacturer.

@aabadie aabadie force-pushed the pr/common-stlink branch from d83613d to 12f884c Compare June 6, 2018 19:50
Copy link
Copy Markdown
Contributor

@cladmi cladmi left a comment

Choose a reason for hiding this comment

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

ACK please squash

@aabadie aabadie force-pushed the pr/common-stlink branch from 12f884c to 6a54b6a Compare June 7, 2018 10:36
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 7, 2018

squashed. @haukepetersen @kaspar030 do you still have comments or can we dismiss your reviews since I think your previous comments were addressed ?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 12, 2018

@cladmi @kaspar030 @haukepetersen, now that #8549 is merged, putting the openocd common configuration file in boards/stm32 makes more sense to me. What do you think ?

@aabadie aabadie changed the title boards/stm32-stlink: introduce common place for boards using stlink (nucleos and others) boards/stm32: use common place of openocd config files for all boards using stlink Jun 12, 2018
@kaspar030 kaspar030 dismissed their stale review June 12, 2018 21:17

no time

@kaspar030
Copy link
Copy Markdown
Contributor

This looks OK to me.

@aabadie aabadie force-pushed the pr/common-stlink branch from 6a54b6a to 21e0af1 Compare June 12, 2018 21:28
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 13, 2018

@cladmi, @haukepetersen do you have more comments here ? or can I squash ?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 14, 2018

@haukepetersen @cladmi, ok to squash here ?

@cladmi
Copy link
Copy Markdown
Contributor

cladmi commented Jun 14, 2018

Ok for me

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 14, 2018

It would be great if someone could ping @haukepetersen IRL or at least dismiss his review.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 14, 2018

Seems that @haukepetersen will never reply here. @cladmi @kaspar030, are you ok for dismissing his review ?

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 19, 2018

@haukepetersen, if you don't reply or if you are not interested anymore by this PR, please let us know.

@aabadie aabadie force-pushed the pr/common-stlink branch from a83ee8d to 265c152 Compare June 26, 2018 18:45
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 26, 2018

rebased and squashed. @cladmi, I think we left enough time to @haukepetersen to leave his opinion here and since it never came, I'll dismiss his review.

@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jun 28, 2018

Let's merge this one.

@aabadie aabadie merged commit 4e1f07b into RIOT-OS:master Jun 28, 2018
@cladmi cladmi added this to the Release 2018.07 milestone Jul 10, 2018
@aabadie aabadie deleted the pr/common-stlink branch December 28, 2018 16:31
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: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants