Skip to content

make/cortexm: fix -mfpu flag value for CortexM7#13021

Merged
vincent-d merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/cpu/cortexm_fpu_m7_fix
Jan 2, 2020
Merged

make/cortexm: fix -mfpu flag value for CortexM7#13021
vincent-d merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/cpu/cortexm_fpu_m7_fix

Conversation

@aabadie
Copy link
Copy Markdown
Contributor

@aabadie aabadie commented Jan 2, 2020

Contribution description

This PR fixes an issue when using FPU on Cortex-M7 CPU by using a different flag to use single precision instead of double precision (this is also the case with M4).

See https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html and search for -mfpu= to find available options.

From my tests (on nucleo-f746zg), this PR fixes #12286.

Testing procedure

Run compile_and_test_for_board.py on a F7 board:

./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . nucleo-f746zg --jobs=4 --with-test-only

With this PR, you get the following behavior with tests that failed in #12286:

Details
./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . nucleo-f746zg --jobs=4 --with-test-only --applications="tests/bloom_bytes tests/float tests/libfixmath_unittests tests/pkg_cn-cbor tests/pkg_lora-serialization tests/pkg_ubasic tests/rng tests/unittests"
INFO:nucleo-f746zg:Saving toolchain
INFO:nucleo-f746zg.tests/bloom_bytes:Board supported: True
INFO:nucleo-f746zg.tests/bloom_bytes:Board has enough memory: True
INFO:nucleo-f746zg.tests/bloom_bytes:Application has test: True
INFO:nucleo-f746zg.tests/bloom_bytes:Run compilation
INFO:nucleo-f746zg.tests/bloom_bytes:Run test
INFO:nucleo-f746zg.tests/bloom_bytes:Run test.flash
INFO:nucleo-f746zg.tests/bloom_bytes:Success
INFO:nucleo-f746zg.tests/float:Board supported: True
INFO:nucleo-f746zg.tests/float:Board has enough memory: True
INFO:nucleo-f746zg.tests/float:Application has test: True
INFO:nucleo-f746zg.tests/float:Run compilation
INFO:nucleo-f746zg.tests/float:Run test
INFO:nucleo-f746zg.tests/float:Run test.flash
INFO:nucleo-f746zg.tests/float:Success
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Board supported: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Application has test: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run compilation
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run test
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run test.flash
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Success
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Board supported: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Application has test: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run compilation
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run test
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run test.flash
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Success
INFO:nucleo-f746zg.tests/pkg_ubasic:Board supported: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Application has test: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Run compilation
INFO:nucleo-f746zg.tests/pkg_ubasic:Run test
INFO:nucleo-f746zg.tests/pkg_ubasic:Run test.flash
INFO:nucleo-f746zg.tests/pkg_ubasic:Success
INFO:nucleo-f746zg.tests/rng:Board supported: True
INFO:nucleo-f746zg.tests/rng:Board has enough memory: True
INFO:nucleo-f746zg.tests/rng:Application has test: True
INFO:nucleo-f746zg.tests/rng:Run compilation
INFO:nucleo-f746zg.tests/rng:Run test
INFO:nucleo-f746zg.tests/rng:Run test.flash
INFO:nucleo-f746zg.tests/rng:Success
INFO:nucleo-f746zg.tests/unittests:Board supported: True
INFO:nucleo-f746zg.tests/unittests:Board has enough memory: True
INFO:nucleo-f746zg.tests/unittests:Application has test: True
INFO:nucleo-f746zg.tests/unittests:Run compilation
INFO:nucleo-f746zg.tests/unittests:Run test
INFO:nucleo-f746zg.tests/unittests:Run test.flash
INFO:nucleo-f746zg.tests/unittests:Success
INFO:nucleo-f746zg:Tests successful

Issues/PRs references

Fixes #12286

Use single precision, like with M4 instead of double precision
@aabadie aabadie added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jan 2, 2020
@aabadie aabadie requested review from fjmolinas and vincent-d January 2, 2020 13:47
@fjmolinas fjmolinas added this to the Release 2020.01 milestone Jan 2, 2020
Copy link
Copy Markdown
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.

Tested it fixes the issue on nucleo-f7426zg:

Details
INFO:nucleo-f746zg:Saving toolchain
INFO:nucleo-f746zg.tests/bloom_bytes:Board supported: True
INFO:nucleo-f746zg.tests/bloom_bytes:Board has enough memory: True
INFO:nucleo-f746zg.tests/bloom_bytes:Application has test: True
INFO:nucleo-f746zg.tests/bloom_bytes:Run compilation
INFO:nucleo-f746zg.tests/bloom_bytes:Run test
INFO:nucleo-f746zg.tests/bloom_bytes:Run test.flash
INFO:nucleo-f746zg.tests/bloom_bytes:Success
INFO:nucleo-f746zg.tests/float:Board supported: True
INFO:nucleo-f746zg.tests/float:Board has enough memory: True
INFO:nucleo-f746zg.tests/float:Application has test: True
INFO:nucleo-f746zg.tests/float:Run compilation
INFO:nucleo-f746zg.tests/float:Run test
INFO:nucleo-f746zg.tests/float:Run test.flash
INFO:nucleo-f746zg.tests/float:Success
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Board supported: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Application has test: True
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run compilation
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run test
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Run test.flash
INFO:nucleo-f746zg.tests/pkg_cn-cbor:Success
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Board supported: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Application has test: True
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run compilation
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run test
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Run test.flash
INFO:nucleo-f746zg.tests/pkg_lora-serialization:Success
INFO:nucleo-f746zg.tests/pkg_ubasic:Board supported: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Board has enough memory: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Application has test: True
INFO:nucleo-f746zg.tests/pkg_ubasic:Run compilation
INFO:nucleo-f746zg.tests/pkg_ubasic:Run test
INFO:nucleo-f746zg.tests/pkg_ubasic:Run test.flash
INFO:nucleo-f746zg.tests/pkg_ubasic:Success
INFO:nucleo-f746zg.tests/rng:Board supported: True
INFO:nucleo-f746zg.tests/rng:Board has enough memory: True
INFO:nucleo-f746zg.tests/rng:Application has test: True
INFO:nucleo-f746zg.tests/rng:Run compilation
INFO:nucleo-f746zg.tests/rng:Run test
INFO:nucleo-f746zg.tests/rng:Run test.flash
INFO:nucleo-f746zg.tests/rng:Success
INFO:nucleo-f746zg.tests/unittests:Board supported: True
INFO:nucleo-f746zg.tests/unittests:Board has enough memory: True
INFO:nucleo-f746zg.tests/unittests:Application has test: True
INFO:nucleo-f746zg.tests/unittests:Run compilation
INFO:nucleo-f746zg.tests/unittests:Run test
INFO:nucleo-f746zg.tests/unittests:Run test.flash
INFO:nucleo-f746zg.tests/unittests:Success
INFO:nucleo-f746zg:Tests successful

Copy link
Copy Markdown
Member

@vincent-d vincent-d left a comment

Choose a reason for hiding this comment

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

Looks good.

Tested and confirmed by @fjmolinas.

ACK

@vincent-d vincent-d merged commit 4c1c4fa into RIOT-OS:master Jan 2, 2020
@fjmolinas
Copy link
Copy Markdown
Contributor

This is an incomplete fix, the issue although present with stm32f746 is not with all cortexm7, it depends on their FPU precision support ( see https://www.st.com/en/microcontrollers-microprocessors/stm32f7-series.html), e.g.:

./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py . nucleo-f767zi --jobs=4 --with-test-only --applications="tests/bloom_bytes tests/float tests/libfixmath_unittests tests/pkg_cn-cbor tests/pkg_lora-serialization tests/pkg_ubasic tests/rng tests/unittests"

Passes.

@aabadie aabadie deleted the pr/cpu/cortexm_fpu_m7_fix branch January 2, 2020 15:32
@aabadie
Copy link
Copy Markdown
Contributor Author

aabadie commented Jan 2, 2020

Thanks for merging @vincent-d!

@fjmolinas, the proposed fix is still valid for nucleo-f767zi which has double precision. An enhancement could be to add a configuration variable to enable double precision when possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms 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.

Some tests are failing on STM32F7

3 participants