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/cortexm-fpu: use it via a feature instead of DEFAULT_MODULE #13236

Closed
wants to merge 6 commits into from

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented Jan 30, 2020

Contribution description

This PR reworks how cortexm_fpu is managed: it applies the suggestion from @haukepetersen in #6630 (comment).

This allows to remove reference to DEFAULT_MODULE from a file that is included from a Makefile.include and not from a Makefile.dep but also to finely filter when the feature should be used or not.

To achieve this, I have to know which CPU_ARCH is used early (in Makefile.features): so the first commit of this PR is moving all CPU_ARCH/MODEL defined in Makefile.include to Makefile.features. I can provide this commit in a separate PR if requested by reviewers.
The other commits are just introducing and using the usual management of feature, and applying it to the new cortexm_fpu feature.

Testing procedure

  • A green Murdock
  • The following commands should work, with and without the patch below:
make BOARD=nucleo-l476rg -C tests/thread_float flash term
make BOARD=nucleo-f722ze -C tests/thread_float flash term
make BOARD=nucleo-l073rz -C tests/thread_float flash term

patch:

diff --git a/tests/thread_float/Makefile b/tests/thread_float/Makefile
index 59810e199fa..bc3015cd4c0 100644
--- a/tests/thread_float/Makefile
+++ b/tests/thread_float/Makefile
@@ -4,6 +4,6 @@ USEMODULE += printf_float
 USEMODULE += xtimer
 
 # Use CortexM FPU when available (only on M4F and M7 CPUs)
-FEATURES_OPTIONAL += cortexm_fpu
+# FEATURES_OPTIONAL += cortexm_fpu
 
 include $(RIOTBASE)/Makefile.include

Issues/PRs references

This PR is based on #13174 to be able to know the value of CPU_ARCH early and be able to determine if the cortexm_fpu feature is provided.

@aabadie aabadie added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Area: build system Area: Build system Area: cpu Area: CPU/MCU ports labels Jan 30, 2020
@aabadie aabadie added the State: waiting for other PR State: The PR requires another PR to be merged first label Jan 30, 2020
@aabadie aabadie force-pushed the pr/cpu/cortexm_fpu_rework branch from ab5f989 to 58a483a Compare February 9, 2020 11:02
@aabadie aabadie removed the State: waiting for other PR State: The PR requires another PR to be merged first label Feb 13, 2020
@aabadie aabadie force-pushed the pr/cpu/cortexm_fpu_rework branch from 58a483a to 986d393 Compare February 13, 2020 07:07
@aabadie
Copy link
Contributor Author

aabadie commented Feb 13, 2020

@fjmolinas, if you have some time today, this PR is ready for review (since #13174 was merged!)

@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 Feb 13, 2020
@@ -3,6 +3,7 @@ include ../Makefile.tests_common
USEMODULE += printf_float
USEMODULE += xtimer

#DISABLE_MODULE += cortexm_fpu
# Use CortexM FPU when available (only on M4F and M7 CPUs)
FEATURES_OPTIONAL += cortexm_fpu
Copy link
Contributor

Choose a reason for hiding this comment

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

So the FPU only gets used in this test (or when explicitly requested), otherwise software emulation is used.
What is the benefit of that?

If you have an FPU that should always be preffered over float-abi=soft, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, I'll update the PR in that direction !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've been trying and I realized that to be possible it would need #9913 to be fixed first.
This is because cortexm.inc.mk is included before processing the dependency resolution and this PR relies on this mechanism. Even if we would keep the FPU by default (using a default module), that would still be required (this is what I was thinking of and tried actually).

If you have an FPU that should always be preffered over float-abi=soft, no?

Yes probably.

I think I'll rework that PR and cut the CPU_ARCH/FAM move out of it.

@fjmolinas
Copy link
Contributor

@aabadie can you give me an update on the status here?

@aabadie
Copy link
Contributor Author

aabadie commented Mar 27, 2020

closing in favor of #13738

@aabadie aabadie closed this Mar 27, 2020
@aabadie aabadie deleted the pr/cpu/cortexm_fpu_rework branch June 24, 2020 06:08
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: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants