Skip to content

Commit 10b6cde

Browse files
committed
Added NO_ARM_ASM option
1 parent da0350c commit 10b6cde

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

arch.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ ifeq ($(CORTEX_A5),1)
205205
else
206206
# All others use boot_arm.o
207207
OBJS+=src/boot_arm.o
208-
CORTEXM_ARM_EXTRA_OBJS= \
208+
ifneq ($(NO_ARM_ASM),1)
209+
CORTEXM_ARM_EXTRA_OBJS= \
209210
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha256.o \
210211
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha512.o \
211212
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-32-sha256-asm.o \
@@ -216,12 +217,13 @@ else
216217
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.o
217218

218219

219-
CORTEXM_ARM_THUMB_EXTRA_OBJS= \
220+
CORTEXM_ARM_THUMB_EXTRA_OBJS= \
220221
./lib/wolfssl/wolfcrypt/src/port/arm/thumb2-sha256-asm.o \
221222
./lib/wolfssl/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.o
222223

223-
CORTEXM_ARM_EXTRA_CFLAGS+=-DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_NO_HW_CRYPTO \
224+
CORTEXM_ARM_EXTRA_CFLAGS+=-DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_NO_HW_CRYPTO \
224225
-DWOLFSSL_ARMASM_INLINE -DWOLFSSL_ARMASM_NO_NEON
226+
endif
225227
ifeq ($(CORTEX_M33),1)
226228
CFLAGS+=-mcpu=cortex-m33 -DCORTEX_M33
227229
LDFLAGS+=-mcpu=cortex-m33

docs/compile.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ By default, wolfBoot is compiled for ARM Cortex-M3/4/7. To compile for Cortex-M0
4242

4343
`CORTEX_M0=1`
4444

45+
### Speed vs. size
46+
47+
On a number of targets, algorithm may be optimized automatically to use assembly
48+
optimizations. To disable assembly optimizations, use `NO_ASM=1`. This option will
49+
produce smaller code, but will also impact on the boot time.
50+
51+
ARM-specific ARM optimizations affecting hash and symmetric key ciphers can be
52+
disabled with the option `NO_ARM_ASM=1`. This is useful for example when you want
53+
to use SP math optimizations for key verification, but exclude SHA2/AES optimizations
54+
to save some space.
55+
56+
4557
### Flash partitions
4658

4759
The file [include/target.h](../include/target.h) is generated according to the configured flash geometry,

tools/config.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ifeq ($(ARCH),)
2323
CORTEX_M7?=0
2424
CORTEX_M3?=0
2525
NO_ASM?=0
26+
NO_ARM_ASM?=0
2627
EXT_FLASH?=0
2728
SPI_FLASH?=0
2829
QSPI_FLASH?=0
@@ -104,5 +105,6 @@ CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO
104105
NXP_CUSTOM_DCD NXP_CUSTOM_DCD_OBJS \
105106
FLASH_OTP_KEYSTORE \
106107
KEYVAULT_OBJ_SIZE \
107-
KEYVAULT_MAX_ITEMS
108+
KEYVAULT_MAX_ITEMS \
109+
NO_ARM_ASM
108110

tools/test.mk

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -986,37 +986,37 @@ test-all: clean
986986

987987

988988
test-size-all:
989-
make test-size SIGN=NONE LIMIT=4816
989+
make test-size SIGN=NONE LIMIT=4816 NO_ARM_ASM=1
990990
make keysclean
991-
make test-size SIGN=ED25519 LIMIT=11396
991+
make test-size SIGN=ED25519 LIMIT=11396 NO_ARM_ASM=1
992992
make keysclean
993-
make test-size SIGN=ECC256 LIMIT=17936
993+
make test-size SIGN=ECC256 LIMIT=17936 NO_ARM_ASM=1
994994
make clean
995-
make test-size SIGN=ECC256 NO_ASM=1 LIMIT=13480
995+
make test-size SIGN=ECC256 NO_ASM=1 LIMIT=13480 NO_ARM_ASM=1
996996
make keysclean
997-
make test-size SIGN=RSA2048 LIMIT=11212
997+
make test-size SIGN=RSA2048 LIMIT=11212 NO_ARM_ASM=1
998998
make clean
999-
make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=11788
999+
make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=11788 NO_ARM_ASM=1
10001000
make keysclean
1001-
make test-size SIGN=RSA4096 LIMIT=11500
1001+
make test-size SIGN=RSA4096 LIMIT=11500 NO_ARM_ASM=1
10021002
make clean
1003-
make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=12076
1003+
make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=12076 NO_ARM_ASM=1
10041004
make keysclean
1005-
make test-size SIGN=ECC384 LIMIT=17504
1005+
make test-size SIGN=ECC384 LIMIT=17504 NO_ARM_ASM=1
10061006
make clean
1007-
make test-size SIGN=ECC384 NO_ASM=1 LIMIT=14872
1007+
make test-size SIGN=ECC384 NO_ASM=1 LIMIT=14872 NO_ARM_ASM=1
10081008
make keysclean
1009-
make test-size SIGN=ED448 LIMIT=13408
1009+
make test-size SIGN=ED448 LIMIT=13408 NO_ARM_ASM=1
10101010
make keysclean
1011-
make test-size SIGN=RSA3072 LIMIT=11352
1011+
make test-size SIGN=RSA3072 LIMIT=11352 NO_ARM_ASM=1
10121012
make clean
1013-
make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=11892
1013+
make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=11892 NO_ARM_ASM=1
10141014
make keysclean
10151015
make test-size SIGN=LMS LMS_LEVELS=2 LMS_HEIGHT=5 LMS_WINTERNITZ=8 \
10161016
WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2644 \
1017-
IMAGE_HEADER_SIZE?=5288 LIMIT=7504
1017+
IMAGE_HEADER_SIZE?=5288 LIMIT=7504 NO_ARM_ASM=1
10181018
make keysclean
10191019
make test-size SIGN=XMSS XMSS_PARAMS='XMSS-SHA2_10_256' \
10201020
IMAGE_SIGNATURE_SIZE=2500 IMAGE_HEADER_SIZE?=4096 \
1021-
LIMIT=8220
1021+
LIMIT=8220 NO_ARM_ASM=1
10221022
make keysclean

0 commit comments

Comments
 (0)