-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
compiling Mbed TLS for cortex-m0 with optimization and ARMC6 compiler results in error #1077
Comments
ARM Internal Ref: IOTSSL-1704 |
By the way, could we test how big a difference this assembly "optimization" makes? I'm not sure it's that significant. (Of course this issue still needs to be fixed. It's just that we seem to assume this assembly is very important to have, while I'm firmly of the opinion that nothing is faster until you actually measure it.) |
While the measurements in #1964 are a very interesting data point, V8-A and V6-M are pretty different architectures performance-wise, for example in terms the multiplication instructions they have or the number of registers. Also, obviously the performance of handwritten assembly depends quite a lot on how it's written, and how much in improves compare to compiler-generated code depends on how good the compiler backend is for that particular platform and that particular kind of operation (sometimes C cannot express the best way a CPU could perform an operation, sometimes it can). So I'm not sure how much one can extrapolate from one case to the other. Don't get me wrong, I'm not saying this particular bit of asm on this particular platform is not worth it, I'm just saying I'd like us to make decisions based on actual specific data. I assume the person who contributed #1964 would agree, because they started by showing us some specific data right away. I'm just saying I'd like to have the same kind of data here too. OTOH, after looking a bit at this bit of asm, I'm thinking fixing could be as easy as using some other register number: it looks like r10 to r12 would be free for use in the thumb case, and even r8-r12 in the thumb2 case. (It seems the author of this asm just used registers in order, perhaps not being aware of r7's special role for some compilers with some options.) If fixing is that easy, I'd be happy with a "fix first, collect data later" strategy, but I'm still interested in some data at some point. |
Reopening due to interest in fixing this. We shouldn't fail on Cortex-M0 with the default configuration. |
According to [1], add compiler flag -DMULADDC_CANNOT_USE_R7 in mbed-crypto/mbedtls building on Armv6-M, to work around builidng issues. [1]: Mbed-TLS/mbedtls#1077 Change-Id: I091f7c93a7d275045a7ec17d39e692b27e0544e3 Signed-off-by: David Hu <[email protected]>
According to [1], add compiler flag -DMULADDC_CANNOT_USE_R7 in mbed-crypto/mbedtls building on Armv6-M, to work around builidng issues. [1]: Mbed-TLS/mbedtls#1077 Change-Id: I091f7c93a7d275045a7ec17d39e692b27e0544e3 Signed-off-by: David Hu <[email protected]>
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, 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
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, 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
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
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
|
I don't have time to try it atm, but if someone wants to try |
We still get a bunch of errors with Manuel's suggestion, I think because the likes of M0 don't support all of Thumb2. So I think the changes would have to be a lot more extensive than simply using a different register. |
2.28 backport - Use CT module more consistently
The workaround for Mbed-TLS/mbedtls#1077 is not required anymore in BL2/Crypto service Mbed TLS builds as the issue has been fixed since 2023 Signed-off-by: Antonio de Angelis <[email protected]> Change-Id: I1a9cb0f83d6b1876d00b98e87700dea9c2097616
Description
compilation error with ARMC6 toolchain, on cortex-m0 and optimization flag
Bug
OS
linux
mbed TLS build:
Version: 2.6.0
OS version: Ubuntu 16.04
ARMC6
Additional environment information:
Expected behavior
compilation to succeed
Actual behavior
compilation error:
Steps to reproduce
compile using ARMC6 with optimization, such as -Os
Reproduces only for cortex-m0
Note:
Can be worked around using
-DMULADDC_CANNOT_USE_R7
compilation flag, or without optimization flag, but this will compile without the assmebly optimizationThe text was updated successfully, but these errors were encountered: