From 7c1dc793b1daeffcd7fe27bf546415c37bfa0461 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 17 Sep 2026 16:04:30 -0700 Subject: [PATCH] Zephyr define the Thumb-2 assembly macros and allow benchmark argument parsing --- .wolfssl_known_macro_extras | 2 ++ wolfssl/wolfcrypt/settings.h | 8 +++++++- zephyr/user_settings.h | 11 ++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras index 273ebe0151d..7307d509697 100644 --- a/.wolfssl_known_macro_extras +++ b/.wolfssl_known_macro_extras @@ -174,6 +174,7 @@ CONFIG_TLS_STACK_WOLFSSL CONFIG_USE_WOLFSSL_ESP_SDK_TIME CONFIG_USE_WOLFSSL_ESP_SDK_WIFI CONFIG_WOLFCRYPT_ARMASM +CONFIG_WOLFCRYPT_ARMASM_THUMB2 CONFIG_WOLFCRYPT_FIPS CONFIG_WOLFCRYPT_FIPS_READY CONFIG_WOLFCRYPT_FIPS_V2 @@ -1239,6 +1240,7 @@ WOLFSSL_XILINX_CRYPTO_OLD WOLFSSL_XILINX_PATCH WOLFSSL_XIL_MSG_NO_SLEEP WOLFSSL_ZEPHYR +WOLFSSL_ZEPHYR_MAIN_ARGS WOLF_ALLOW_BUILTIN WOLF_CONF_ASN_TIME WOLF_CRYPTO_CB_ASYNC_POLL diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index bbf24534996..24475020087 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -3151,7 +3151,13 @@ #define USE_FLAT_BENCHMARK_H #define USE_FLAT_TEST_H #define EXIT_FAILURE 1 - #define MAIN_NO_ARGS + /* A Zephyr application normally has no argv to hand the test or benchmark + * entry points. One that does - it may build its own argument list to pick + * an algorithm subset - can define WOLFSSL_ZEPHYR_MAIN_ARGS to keep the + * option parsing compiled in. */ + #ifndef WOLFSSL_ZEPHYR_MAIN_ARGS + #define MAIN_NO_ARGS + #endif void *z_realloc(void *ptr, size_t size); #define realloc z_realloc diff --git a/zephyr/user_settings.h b/zephyr/user_settings.h index caacdd2e116..a6a4d2cb1e1 100644 --- a/zephyr/user_settings.h +++ b/zephyr/user_settings.h @@ -603,7 +603,16 @@ extern "C" { /* Default is ARMv8 */ - #if 0 /* ARMv7 */ + #ifdef CONFIG_WOLFCRYPT_ARMASM_THUMB2 + /* Cortex-M and Cortex-R. zephyr/CMakeLists.txt compiles the thumb2-* + * ports for this, and they export different symbol names than the + * ARMv8 and AArch32 ones, so the C side has to be told as well or the + * link fails. Matches what configure sets for --enable-armasm on a + * Thumb-2 target. */ + #define WOLFSSL_ARMASM_THUMB2 + #define WOLFSSL_ARMASM_NO_HW_CRYPTO + #define WOLFSSL_ARM_ARCH 7 + #elif 0 /* ARMv7 */ #define WOLFSSL_ARM_ARCH 7 #define WOLFSSL_ARMASM_NO_HW_CRYPTO /* enable if processor does not support aes/sha instructions */ #endif