-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Build dependencies - processing order issues #9913
Comments
To not re-add another file for nothing, I thought about putting It would contain "everything that needs to be defined before being able to process dependencies". |
I'm unclear on what the problem is with |
Changing it is a mix of somehow required, it makes sense, do not repeat the same information 3 times, and many things in our makefiles have hard ordering requirements so leads to the proposed solution. One hint that moving RIOT/boards/samr21-xpro/Makefile.features Line 15 in 1e6009c
Main issueThe first main issue that is causing me problems, is that board and CPUs need to declare dependencies, and some of their internal modules too. However, this is right now often done in One example is here: RIOT/boards/common/nrf52xxxdk/Makefile.include Lines 21 to 27 in 1e6009c
Another one here: RIOT/cpu/stm32_common/Makefile.include Lines 13 to 15 in 1e6009c
This one is even using FEATURES_REQUIRED to work because of course USEMODULE is not defined yet. But it fails if the main application only declares a dependency on a module that will add the FEATURES_REQUIRED as does the test in #9892 and the OTA task force branch.
Proposed solutionSo for this I want to move the processing of dependencies, before parsing all modules Makefile.include files (boards, cpu, sys, drivers, pkgs). ConstraintMoving the dependency handling before
Which would require having I say somehow, because it could be But I am not going to push toward having 3 times the cpu name defined between Then on the somehow required:The CPU variable is used in
However, it is still concept a dependency that the board depends/uses on this cpu so makes sense to be explicit when resolving |
We can also see this problem with the esp32 board that need to define CFLAGS depending on included modules. #9426 They could in theory be defined in inline |
Found another case showing the issue:
But when compiling we get
Because
|
@MrKevinWeiss The issue I talk to you about with the dependencies processing |
Thanks for reviving this issue, which is still valid. I just had a look at it and there is still some work to be done, and in many different places. That will require several PRs before Makefile.dep can be included before Makefile.include. |
@gschorcht, if you are interested, I have a branch where I started to move cpu dependencies in dedicated Makefile.dep. I'm hesitating to PR it. If you think it's worth, I'll do. I could already see problems if we include Makefile.dep before board/cpus Makefile.include: some cpu add modules based on variables defined in board/cpu level Makefile.include (for example pic32, esp32). There's also the kinetis-info.mk that should be split I think (maybe @fjmolinas has some ideas here). I haven't looked at esp. |
The ESP32 wont be a problem. For ESPs, some variables are defined dependent on some modules but not vise versa. Therefore, some module dependencies have to be defined at the very beginning of But, once
I think it is worth. It would be further step to cleanup the makefiles. |
@aabadie If you'd like, I can contribute the ESP changes to your branch. |
My branch is touching almost all CPUs so I think it will be difficult to review it and get it merged fast. Some reviewers may also ask to split it. I would prefer you open a separate PR for esp. |
OK, I see. It seems like a chicken-and-egg problem 😟 It's certainly not possible to split the PRs without affecting the compilability for some CPUs. On the other hand, I can't provide the changes as separate PRs until the include order is changed without affecting the compilability for the EPSs. |
Ok, then it's here: #12898 For ESP, you can still move forward to an intermediate state where non conditional dependencies could be moved to Makefile.dep. |
nrf52 includes include $(RIOTBOARD)/$(BOARD)/Makefile.dep to know if `nordic_softdevice_ble` is used, this changes dependency resolution sinnce -include $(APPDIR)/Makefile.board.dep should be resolved before. This can be removed once RIOT-OS#9913 is if `nordic_softdevice` is deprecated.
@fjmolinas @leandrolanzieri, what is the status of this issue ? Are all cpu dependencies addressed ? |
I think we are at a point where we could test changing the inclusion order, other than |
I believe:
are done, can you think of something that is missing @aabadie @leandrolanzieri? |
There currently are concurrency issues in the order dependencies are defined and used, and cpu dependencies cannot be easily parsed.
I plan to address this by moving the processing of
Makefile.dep
before including$(BOARD)/Makefile.include
Dependencies resolution uses the following variables
Steps
Add a new file in board that include the common files too and currently only definesReuseCPU
,Makefile.board
.Makefile.features
to defineCPU
$(CPU)/Makefile.dep
stm32_common
issue described in Makefile.dep: process cpu dependencies and fix stm32_common #9892cpu/stm32_common: fix source selection declared as module dependencies (broken) #10153include $(RIOTCPU)/$(CPU)/Makefile.features
instead of hardwriting it.CPU_FAM
andCPU_ARCH
defined inMakefile.include
when they should be already available forMakefile.dep
. Define them inMakefile.cpu
Makefile.features
files.$(BOARD)/Makefile.dep
and$(CPU)/Makefile.dep
Makefile.include
issues (can be done in parallel)/sys/arduino/Makefile.include
Makefile.dep
before doingMakefile.include
. Makefile.include: resolve dependencies before Makefile.include #14351Prerequisites cleanup
And even future improvement to remove multiple duplication between board/board_common cpu/cpu_common path:
Makefile.board
andMakefile.cpu
, define someBOARD_IMPLEMENTATION_DIRS
like variables that can be re-used to remove duplication inMakefile
,Makefile.deps
,Makefile.include
,Makefile.features
.Explanation
To summarize, the main
Makefile.include
does regarding modules:(a more detailed version is available here https://gist.github.com/cladmi/1c5af63c753635b7cb173cf8311d0b5b)
The main
Makefile.dep
only includes$(BOARD)/Makefile.dep
which may sometime also end up includinghardwritten_cpu_name/Makefile.dep
.In the same time
makefiles/info-global.inc.mk
does:And so never takes into account any of the dependencies defined in
$(BOARD)/Makefile.include
or any otherMakeflie.include
files.The text was updated successfully, but these errors were encountered: