-
Notifications
You must be signed in to change notification settings - Fork 3k
CMake: Fix Mbed TLS compilation on Cortex-M0/0+/1/M23 #14529
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
Conversation
@LDong-Arm, thank you for your changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@harmut01 Thanks for the review, but I just force-pushed and changed the approach 😉 |
CI started |
Jenkins CI Test : ❌ FAILEDBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
mbed-os-example-crash-reporting in cmake-example-test failed on K64F. Being a Cortex-M4F target it doesn't look related to this PR. I'll try to reproduce it anyway. |
It's a CI issue that the mbed-os-example-crash-reporting test is too time-dependent.
@0xc0170 @saheerb This happens from time to time and not just for one PR: https://jenkins-mbedos.oss.arm.com/blue/organizations/jenkins/mbed-os-ci_cmake-example-test/activity We might need a permanent solution. |
Yea, what I think is the application is restarted before greentea could process. @jamesbeyond I think removing first line will make test more robust. What do you think? |
Well, this still relies on the timing of the example. The permanent solution would be an option in For now, I wonder if rerunning the CI could allow us to get this PR in. |
The main issue, what I think here is, depending on the restart attempt the first line will change. If we are not checking the first line, then timing wont matter, would it?
|
@saheerb
(many lines below) So,
If timing is correct, we should get |
This failure is seen in lots of places. Need to fix it probably. |
This can be merged. The label wasn't updated automatically. |
connectivity/mbedtls/CMakeLists.txt
Outdated
@@ -101,4 +101,6 @@ target_sources(mbed-mbedtls | |||
target_compile_definitions(mbed-mbedtls | |||
INTERFACE | |||
MBED_CONF_MBEDTLS_PRESENT=1 | |||
# workaround for https://github.com/ARMmbed/mbedtls/issues/1077 | |||
MULADDC_CANNOT_USE_R7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this conditional on an M0 or M0+ core being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check why this workaround isn't needed for GCC. But anyway the workaround is probably to set it for M0/M0+.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. The condition also includes M1 and M23 (e.g. NUMAKER_IOT_M263A), added in my latest push.
As for GCC, it compiles exactly the same assembly but doesn't fail, probably related to some optimisation.
Due to a known issue in Mbed TLS's architecture determination (Mbed-TLS/mbedtls#1077), we get the error error: inline assembly requires more registers than available when compiling `bignum.c` for Cortex-M0/0+/1/M23 which do not have the macro `__thumb2__` set by the compiler. The workaround is to define the macro `MULADDC_CANNOT_USE_R7` which is already defined by Mbed CLI 1 but missing in our CMake support. Fixes ARMmbed/mbed-os-example-lorawan#220
5f05845
to
86e7bc5
Compare
Pull request has been modified.
CI started |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 4 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
@Patater all good now ? |
Yep, looks good |
@LDong-Arm, sorry for unrelated question, but I was under the impression that mbedtls requires an Armv8-A, Armv9-A and Armv8-M core (see https://www.trustedfirmware.org/), but actually this fix is for Armv6. Is mbedtls able to run in Armv6? |
@msmttchr Mbed TLS is a generic TLS and Crypto library that runs on all kinds of hardware, even including legacy Arm architectures (prior to Armv6) and other platforms such as x86, MIPS, etc. So it is able to run on Armv6, and Mbed OS has a few v6 targets. What you mentioned is Trusted Firmware, and the firmware itself mainly targets relatively recent Arm platforms. Trusted Firmware M uses Mbed TLS as a dependency. |
Summary of changes
Due to a known issue in Mbed TLS's architecture determination (Mbed-TLS/mbedtls#1077), we get the error
when compiling
bignum.c
for Cortex-M0/0+/1/M23 which do not have the macro__thumb2__
set by the compiler.The workaround is to define the macro
MULADDC_CANNOT_USE_R7
which is already defined by Mbed CLI 1 but missing in our CMake support.Fixes ARMmbed/mbed-os-example-lorawan#220
Impact of changes
Migration actions required
Documentation
None.
Pull request type
Test results
Reviewers
@ARMmbed/mbed-os-core @Patater