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

Cortex-M/Thumb2 ASM: fix label #7753

Merged
merged 1 commit into from
Jul 26, 2024
Merged

Conversation

SparkiDev
Copy link
Contributor

@SparkiDev SparkiDev commented Jul 16, 2024

Description

IAR doesn't like %=.
Fix code to be consistent in use of labels and branch instructions.

Fixes zd#18315

Testing

./configure '--disable-shared' '--enable-all' '--enable-sp-asm' '--enable-armasm' 'LDFLAGS=--static' '--host=armv7m' 'CC=arm-linux-gnueabi-gcc' '--disable-crl-monitor'
./configure '--disable-shared' '--enable-all' '--enable-sp-asm' '--enable-armasm=inline' 'LDFLAGS=--static' '--host=armv7m' 'CC=arm-linux-gnueabi-gcc' '--disable-crl-monitor'

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@SparkiDev SparkiDev self-assigned this Jul 16, 2024
@SparkiDev SparkiDev force-pushed the cortexm_label_fix_2 branch from 0211646 to a18ea90 Compare July 16, 2024 21:27
@josepho0918
Copy link
Contributor

@SparkiDev I'm using wolfSSL with IAR v9.50.2 and haven't seen issues with %=. I wonder if this is specific to older IAR versions. Might an IAR version check be helpful?

@SparkiDev SparkiDev force-pushed the cortexm_label_fix_2 branch from a18ea90 to 19c6b28 Compare July 22, 2024 02:11
@SparkiDev
Copy link
Contributor Author

Hi @josepho0918,

I've modified the code to check the version of IAR.
Please let us know if the label is getting %= for you.

Thanks,
Sean

@SparkiDev
Copy link
Contributor Author

SparkiDev commented Jul 22, 2024

Hi @josepho0918

Could you please tell me what value you have for: IAR_SYSTEMS_ICC'
The cusotmer using 8.32.1.18631 is seeing 9.

Thanks,
Sean

@josepho0918
Copy link
Contributor

Hi @josepho0918

Could you please tell me what value you have for: IAR_SYSTEMS_ICC' The cusotmer using 8.32.1.18631 is seeing 9.

Thanks, Sean

Hi @SparkiDev

The value I have for __IAR_SYSTEMS_ICC__ is also 9. I think it should be checked with defined(__IAR_SYSTEMS_ICC__) && (__VER__ < 9000000).

@SparkiDev
Copy link
Contributor Author

Hi @josepho0918,

Thanks for the help!
I'll be adjusting the code and updating the PR.

Sean

@SparkiDev SparkiDev force-pushed the cortexm_label_fix_2 branch from 19c6b28 to a3a0247 Compare July 22, 2024 22:12
@josepho0918
Copy link
Contributor

Hi @SparkiDev,

I have tested the latest changes, and IAR is complaining Error[Og006]: Error in inline assembly: "Branch offset too long" for BNE, BEQ and BLT. We may need to use BNE.W, BEQ.W and BLT.W with IAR.

IAR doesn't like %=.
Fix code to be consistent in use of labels and branch instructions.
@SparkiDev SparkiDev force-pushed the cortexm_label_fix_2 branch from a3a0247 to 3284f53 Compare July 23, 2024 23:20
@SparkiDev
Copy link
Contributor Author

Hi @josepho0918,

I've modified the code to use B*.W/N for IAR.
Please let me know whether this compiles for you!

Thanks,
Sean

@josepho0918
Copy link
Contributor

Hi @josepho0918,

I've modified the code to use B*.W/N for IAR. Please let me know whether this compiles for you!

Thanks, Sean

Hi @SparkiDev,

Excellent work! There're no compilation errors now, and the tests have passed.

@SparkiDev SparkiDev assigned wolfSSL-Bot and unassigned SparkiDev Jul 25, 2024
@SparkiDev SparkiDev requested a review from wolfSSL-Bot July 25, 2024 21:14
@dgarske dgarske merged commit c3b5322 into wolfSSL:master Jul 26, 2024
121 checks passed
@dgarske
Copy link
Contributor

dgarske commented Aug 6, 2024

@SparkiDev seeing consistent failures with GCC after this PR. Thanks @night1rider for spotting it. Can reproduce easily.

#define WOLFSSL_SP_SMALL
#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_ECC
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: warning: STM32H753.elf has a LOAD segment with RWX permissions
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: ./Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.o: in function `sp_2048_cmp_32':
/Users/davidgarske/Projects/WolfSSL/STM/STM32H7/STM32H753/Debug/../Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.c:4758: undefined reference to `L_sp_2048_cmp_32_words'
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: ./Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.o: in function `sp_2048_cmp_64':
/Users/davidgarske/Projects/WolfSSL/STM/STM32H7/STM32H753/Debug/../Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.c:7527: undefined reference to `L_sp_2048_cmp_64_words'
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: ./Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.o: in function `sp_3072_cmp_48':
/Users/davidgarske/Projects/WolfSSL/STM/STM32H7/STM32H753/Debug/../Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.c:16255: undefined reference to `L_sp_3072_cmp_48_words'
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: ./Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.o: in function `sp_3072_cmp_96':
/Users/davidgarske/Projects/WolfSSL/STM/STM32H7/STM32H753/Debug/../Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.c:19784: undefined reference to `L_sp_3072_cmp_96_words'
/Applications/STM32CubeIDE.app/Contents/Eclipse/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.macos64_1.0.200.202406191456/tools/bin/../lib/gcc/arm-none-eabi/12.3.1/../../../../arm-none-eabi/bin/ld: ./Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.o: in function `sp_256_cmp_8':
/Users/davidgarske/Projects/WolfSSL/STM/STM32H7/STM32H753/Debug/../Middlewares/Third_Party/wolfSSL_wolfSSL_wolfSSL/wolfssl/wolfcrypt/src/sp_cortexm.c:34633: undefined reference to `L_sp_256_cmp_8_words'
collect2: error: ld returned 1 exit status

dgarske added a commit to dgarske/wolfssl that referenced this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants