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

cpu/stm32_common: correctly pull periph_flash_common dependency #10146

Closed

Conversation

vincent-d
Copy link
Member

Contribution description

While working on #8774 it popped up that stm32 periph_flashpage feature did not pull periph_flashpage_common dependency correctly in some cases.

Testing procedure

Add FEATURES_REQUIRED += periph_flashpage in drivers or sys Makefile.dep. Without this PR, periph_flashpage_common is not built.

Issues/PRs references

#8774

@vincent-d vincent-d added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: cpu Area: CPU/MCU ports labels Oct 11, 2018
@vincent-d vincent-d requested a review from kYc0o October 11, 2018 06:59
@cladmi cladmi self-requested a review October 11, 2018 10:47
Copy link
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.

This is a bit more complicated than this, I will give more details.

@cladmi
Copy link
Contributor

cladmi commented Oct 11, 2018

It is a problem I have in my radar and I am working on but I missed one part that I understood while explaining it to @kYc0o

Problem in the implemented solution:

If the problem was indeed a "dependency" (same for i2c_1 and i2c_2), then:

  • The dependency must be checked with USEMODULE and not FEATURES_REQUIRED. It could be declared as a FEATURES_OPTIONAL (was also wrong before)
  • The dependency to flash_common should indeed be expressed as a FEATURES_REQUIRED because some cpu may not provide it and it should fail.
    • As currently cpu/stm32_common/Makefile.dep is not processed by Makefile.dep it would not be checked
    • In practice, all stm32 providing periph_flashpage or periph_eeprom also provide periph_flash_common so it does not add anything in practice
  • The cpu dependencies and features should be parsed by the build system (which is not the case) and depends on many things Build dependencies - processing order issues #9913

But in fact, the part that I missed before, here the selection of flash_common is not a real module dependency or anything.
It is just that the implementation of flashpage.c and eeprom.c use common functions in flash_common.c.
Using periph_ and submodules to include the source file is exposing internals of the module to the outside for nothing.
The real solution is to add things to SRC if the module is there.

I will provide a PR in this direction.

@vincent-d
Copy link
Member Author

The dependency to flash_common should indeed be expressed as a FEATURES_REQUIRED because some cpu may not provide it and it should fail

Actually flash_common is not really a feature as it exists only on stm32 for internal reasons.

I'll take a look to your PR which seems better :)

@vincent-d
Copy link
Member Author

Close in favor of #10153

@vincent-d vincent-d closed this Oct 11, 2018
@vincent-d vincent-d deleted the pr/fix_stm32_flashpage_dependency branch October 11, 2018 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR 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.

2 participants