Skip to content

cpu: move cpu level dependencies in dedicated Makefile.dep files#12898

Merged
gschorcht merged 12 commits intoRIOT-OS:masterfrom
aabadie:pr/cpu/dependencies_cleanup
Jan 28, 2020
Merged

cpu: move cpu level dependencies in dedicated Makefile.dep files#12898
gschorcht merged 12 commits intoRIOT-OS:masterfrom
aabadie:pr/cpu/dependencies_cleanup

Conversation

@aabadie
Copy link
Contributor

@aabadie aabadie commented Dec 7, 2019

Contribution description

This PR moves some modules dependencies defined at CPU level (with USEMODULE, FEATURES_REQUIRED, DEFAULT_MODULE) from Makefile.include to Makefile.dep.

Note that $(RIOTCPU)/$(CPU)/Makefile.dep is automatically included in $(RIOTBASE)/Makefile.dep:

RIOT/Makefile.dep

Lines 8 to 9 in f2dbd3b

# include cpu dependencies
-include $(RIOTCPU)/$(CPU)/Makefile.dep

That's why new Makefile.dep files were introduced (for stm32, mips, etc).

Some CPU families are not fully "fixed": kinetis, efm32 and esp. They should be handled in separate PRs because more work is needed there.

Each CPU family is modified in a separate commit, that should simply the review.

Testing procedure

  • At least a green Murdock
  • Maybe we should also check the modules loaded for each boards on each application ?

Issues/PRs references

Part of the work needed in #9913

@aabadie aabadie added Area: build system Area: Build system Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation Area: cpu Area: CPU/MCU ports labels Dec 7, 2019
@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 Dec 7, 2019
@aabadie aabadie changed the title cpu: move cpu level dependencies in a separate Makefile.dep cpu: move cpu level dependencies in dedicated Makefile.dep files Dec 7, 2019
@gschorcht
Copy link
Contributor

Should Makefile.dep really contain all USEMODULE or only those that depend on other modules? I'm not sure.

@aabadie
Copy link
Contributor Author

aabadie commented Dec 7, 2019

Should Makefile.dep really contain all USEMODULE or only those that depend on other modules? I'm not sure.

If the modules defined in those Makefile.dep are used later to resolve some dependencies then I would say yes. This will make the "normal" dependency resolution equal to the one performed by the info-boards-supported target (see info-global.inc.mk file).

@gschorcht
Copy link
Contributor

Should Makefile.dep really contain all USEMODULE or only those that depend on other modules? I'm not sure.

If the modules defined in those Makefile.dep are used later to resolve some dependencies then I would say yes.

Yes, of course, you are right.

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

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

Seems to be OK for me.

@fjmolinas
Copy link
Contributor

Maybe we should also check the modules loaded for each boards on each application ?

@aabadie you could use save_all_dependencies_resolution_variables.sh for this.

@leandrolanzieri
Copy link
Contributor

Maybe we should also check the modules loaded for each boards on each application ?

@aabadie you could use save_all_dependencies_resolution_variables.sh for this.

I'm running the script on this PR, it takes a while. I'll post the results when it's done.

@aabadie
Copy link
Contributor Author

aabadie commented Dec 10, 2019

I'm running the script on this PR, it takes a while. I'll post the results when it's done.

Thanks a lot @leandrolanzieri !

@leandrolanzieri
Copy link
Contributor

@aabadie here there is a diff only on the results for the examples. The diff is not really easy to follow, the script does not order the variables :- /

I ran the script after applying the PR (584f24c) and before (f2dbd3b). I'm seeing various false positives (e.g. oneway_malloc appearing more than once) but also some real differences (arduino_hello-world/info-global/dependencies_info-boards-supported_acd52832).

@aabadie
Copy link
Contributor Author

aabadie commented Dec 11, 2019

Thanks for providing your results @leandrolanzieri. The differences are indeed hard to read but, except some false positives with DEFAULT_MODULE, the other differences are normal I would say. For example, now it's reported that acd52832 (and in fact all nrf boards) are pulling the nrf5x_common_periph module. Before these modules were not appearing. So I think that it's a good point for this PR.
I saw the same thing with stm32.

There's another fix I could see from the results: the dependency to periph_uart/stdio_uart for lpc2387 based boards is now explicit because the newlib dependency appears (and it depends on stdio_uart). Same thing with riscv.

@aabadie aabadie force-pushed the pr/cpu/dependencies_cleanup branch from 584f24c to 8e94725 Compare December 11, 2019 06:50
@fjmolinas
Copy link
Contributor

@aabadie The differences here are really hard to read and verify, it might be easier if we split and address the changes individually.

@aabadie aabadie force-pushed the pr/cpu/dependencies_cleanup branch from 8e94725 to 7b9c487 Compare January 27, 2020 11:58
@aabadie
Copy link
Contributor Author

aabadie commented Jan 27, 2020

rebased

@fjmolinas
Copy link
Contributor

I re-ran dist/tools/buildsystem_sanity_check/save_all_dependencies_resolution_variables.sh with sorted variable output, I'll PR this change separately. I get a lot of differences but only for mips and because of the addition of FEATURES_REQUIRED += periph_timer.

The diff can be found in this https://gist.github.com/fjmolinas/b34d9d28b87915c5a904efcc381b3861

Copy link
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

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

ACK!

@fjmolinas
Copy link
Contributor

If wanted I can also provide the whole dependency dump.

@fjmolinas
Copy link
Contributor

I would like someone else to ACK this, since it affects so many modules. But otherwise I think it is good to go.

#Use UHI to handle syscalls
LINKFLAGS += -luhi
export USEMODULE += newlib_syscalls_mips_uhi
USEMODULE += newlib_syscalls_mips_uhi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line should be removed, this was introduced by a wrong rebase

Copy link
Contributor

Choose a reason for hiding this comment

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

you mean the exports had already been removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was an PR for removing the export, but this PR is moving the line in Makefile.dep. In the current state, the line is duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed now.

@aabadie aabadie force-pushed the pr/cpu/dependencies_cleanup branch from 7b9c487 to e969b2f Compare January 28, 2020 12:21
@aabadie
Copy link
Contributor Author

aabadie commented Jan 28, 2020

@fjmolinas, there's still one USE_PKG in cpu/efm32, see here but I'm not sure how to handle the condition on the CPU_ARCH variable in Makefile.dep. What do you think ?

@fjmolinas
Copy link
Contributor

@fjmolinas, there's still one USE_PKG in cpu/efm32, see here but I'm not sure how to handle the condition on the CPU_ARCH variable in Makefile.dep. What do you think ?

I would just leave it, #13174 will move it out.

@fjmolinas
Copy link
Contributor

I would just leave it, #13174 will move it out.

Or review #13174 :D

@aabadie
Copy link
Contributor Author

aabadie commented Jan 28, 2020

Or review #13174 :D

I already did in fact, just forgot about it...

@aabadie
Copy link
Contributor Author

aabadie commented Jan 28, 2020

All green here. @leandrolanzieri maybe you can give this one another brief look and eventually the second ACK ?

Copy link
Contributor

@leandrolanzieri leandrolanzieri left a comment

Choose a reason for hiding this comment

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

Changes make sense, and according to the diff provided by @fjmolinas dependency resolution variables are the same (with the exception of periph_timer feature for mips). ACK.

Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

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

ACK

@gschorcht gschorcht merged commit ddd7cb0 into RIOT-OS:master Jan 28, 2020
@gschorcht
Copy link
Contributor

@aabadie Thank you very much for this contribution. A big step towards changing the order of including the CPU Makefile.dep

@leandrolanzieri leandrolanzieri added this to the Release 2020.04 milestone Feb 20, 2020
@aabadie aabadie deleted the pr/cpu/dependencies_cleanup branch March 5, 2020 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: build system Area: Build system 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: 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.

4 participants