Skip to content

Commit

Permalink
Added NO_ARM_ASM option
Browse files Browse the repository at this point in the history
  • Loading branch information
danielinux committed Oct 24, 2024
1 parent da0350c commit 10b6cde
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
8 changes: 5 additions & 3 deletions arch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ ifeq ($(CORTEX_A5),1)
else
# All others use boot_arm.o
OBJS+=src/boot_arm.o
CORTEXM_ARM_EXTRA_OBJS= \
ifneq ($(NO_ARM_ASM),1)
CORTEXM_ARM_EXTRA_OBJS= \
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha256.o \
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-sha512.o \
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-32-sha256-asm.o \
Expand All @@ -216,12 +217,13 @@ else
./lib/wolfssl/wolfcrypt/src/port/arm/armv8-32-sha3-asm_c.o


CORTEXM_ARM_THUMB_EXTRA_OBJS= \
CORTEXM_ARM_THUMB_EXTRA_OBJS= \
./lib/wolfssl/wolfcrypt/src/port/arm/thumb2-sha256-asm.o \
./lib/wolfssl/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.o

CORTEXM_ARM_EXTRA_CFLAGS+=-DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_NO_HW_CRYPTO \
CORTEXM_ARM_EXTRA_CFLAGS+=-DWOLFSSL_ARMASM -DWOLFSSL_ARMASM_NO_HW_CRYPTO \
-DWOLFSSL_ARMASM_INLINE -DWOLFSSL_ARMASM_NO_NEON
endif
ifeq ($(CORTEX_M33),1)
CFLAGS+=-mcpu=cortex-m33 -DCORTEX_M33
LDFLAGS+=-mcpu=cortex-m33
Expand Down
12 changes: 12 additions & 0 deletions docs/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ By default, wolfBoot is compiled for ARM Cortex-M3/4/7. To compile for Cortex-M0

`CORTEX_M0=1`

### Speed vs. size

On a number of targets, algorithm may be optimized automatically to use assembly
optimizations. To disable assembly optimizations, use `NO_ASM=1`. This option will
produce smaller code, but will also impact on the boot time.

ARM-specific ARM optimizations affecting hash and symmetric key ciphers can be
disabled with the option `NO_ARM_ASM=1`. This is useful for example when you want
to use SP math optimizations for key verification, but exclude SHA2/AES optimizations
to save some space.


### Flash partitions

The file [include/target.h](../include/target.h) is generated according to the configured flash geometry,
Expand Down
4 changes: 3 additions & 1 deletion tools/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ifeq ($(ARCH),)
CORTEX_M7?=0
CORTEX_M3?=0
NO_ASM?=0
NO_ARM_ASM?=0
EXT_FLASH?=0
SPI_FLASH?=0
QSPI_FLASH?=0
Expand Down Expand Up @@ -104,5 +105,6 @@ CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO
NXP_CUSTOM_DCD NXP_CUSTOM_DCD_OBJS \
FLASH_OTP_KEYSTORE \
KEYVAULT_OBJ_SIZE \
KEYVAULT_MAX_ITEMS
KEYVAULT_MAX_ITEMS \
NO_ARM_ASM

30 changes: 15 additions & 15 deletions tools/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -986,37 +986,37 @@ test-all: clean


test-size-all:
make test-size SIGN=NONE LIMIT=4816
make test-size SIGN=NONE LIMIT=4816 NO_ARM_ASM=1
make keysclean
make test-size SIGN=ED25519 LIMIT=11396
make test-size SIGN=ED25519 LIMIT=11396 NO_ARM_ASM=1
make keysclean
make test-size SIGN=ECC256 LIMIT=17936
make test-size SIGN=ECC256 LIMIT=17936 NO_ARM_ASM=1
make clean
make test-size SIGN=ECC256 NO_ASM=1 LIMIT=13480
make test-size SIGN=ECC256 NO_ASM=1 LIMIT=13480 NO_ARM_ASM=1
make keysclean
make test-size SIGN=RSA2048 LIMIT=11212
make test-size SIGN=RSA2048 LIMIT=11212 NO_ARM_ASM=1
make clean
make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=11788
make test-size SIGN=RSA2048 NO_ASM=1 LIMIT=11788 NO_ARM_ASM=1
make keysclean
make test-size SIGN=RSA4096 LIMIT=11500
make test-size SIGN=RSA4096 LIMIT=11500 NO_ARM_ASM=1
make clean
make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=12076
make test-size SIGN=RSA4096 NO_ASM=1 LIMIT=12076 NO_ARM_ASM=1
make keysclean
make test-size SIGN=ECC384 LIMIT=17504
make test-size SIGN=ECC384 LIMIT=17504 NO_ARM_ASM=1
make clean
make test-size SIGN=ECC384 NO_ASM=1 LIMIT=14872
make test-size SIGN=ECC384 NO_ASM=1 LIMIT=14872 NO_ARM_ASM=1
make keysclean
make test-size SIGN=ED448 LIMIT=13408
make test-size SIGN=ED448 LIMIT=13408 NO_ARM_ASM=1
make keysclean
make test-size SIGN=RSA3072 LIMIT=11352
make test-size SIGN=RSA3072 LIMIT=11352 NO_ARM_ASM=1
make clean
make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=11892
make test-size SIGN=RSA3072 NO_ASM=1 LIMIT=11892 NO_ARM_ASM=1
make keysclean
make test-size SIGN=LMS LMS_LEVELS=2 LMS_HEIGHT=5 LMS_WINTERNITZ=8 \
WOLFBOOT_SMALL_STACK=0 IMAGE_SIGNATURE_SIZE=2644 \
IMAGE_HEADER_SIZE?=5288 LIMIT=7504
IMAGE_HEADER_SIZE?=5288 LIMIT=7504 NO_ARM_ASM=1
make keysclean
make test-size SIGN=XMSS XMSS_PARAMS='XMSS-SHA2_10_256' \
IMAGE_SIGNATURE_SIZE=2500 IMAGE_HEADER_SIZE?=4096 \
LIMIT=8220
LIMIT=8220 NO_ARM_ASM=1
make keysclean

0 comments on commit 10b6cde

Please sign in to comment.