From cd1c50297dc9c58000696faae13a56310ef4a855 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 20 Sep 2023 14:36:45 -0700 Subject: [PATCH] Add new `CORTEX_M3` option (default ARCH=ARM is Cortex-M4). The M3 does not support UMAAL. --- arch.mk | 24 +++++++++++++++++++----- tools/config.mk | 1 + tools/test.mk | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/arch.mk b/arch.mk index 1cdd22954..bc35246f2 100644 --- a/arch.mk +++ b/arch.mk @@ -199,16 +199,29 @@ ifeq ($(ARCH),ARM) endif endif else - # default Cortex M3/M4 + ifeq ($(CORTEX_M3),1) + CFLAGS+=-mcpu=cortex-m3 + LDFLAGS+=-mcpu=cortex-m3 ifeq ($(NO_ASM),1) ifeq ($(SPMATH),1) MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_c32.o endif - CFLAGS+=-mcpu=cortex-m3 - LDFLAGS+=-mcpu=cortex-m3 else - CFLAGS+=-mcpu=cortex-m3 -fomit-frame-pointer - LDFLAGS+=-mcpu=cortex-m3 + ifeq ($(SPMATH),1) + CFLAGS+=-DWOLFSSL_SP_ASM -DWOLFSSL_SP_ARM_CORTEX_M_ASM -DWOLFSSL_SP_NO_UMAAL + MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_cortexm.o + endif + endif + else + # default Cortex M4 + CFLAGS+=-mcpu=cortex-m4 + LDFLAGS+=-mcpu=cortex-m4 + ifeq ($(NO_ASM),1) + ifeq ($(SPMATH),1) + MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_c32.o + endif + else + CFLAGS+=-fomit-frame-pointer # required with debug builds only ifeq ($(SPMATH),1) CFLAGS+=-DWOLFSSL_SP_ASM -DWOLFSSL_SP_ARM_CORTEX_M_ASM MATH_OBJS += ./lib/wolfssl/wolfcrypt/src/sp_cortexm.o @@ -218,6 +231,7 @@ ifeq ($(ARCH),ARM) endif endif endif +endif ifeq ($(TZEN),1) CFLAGS+=-DTZEN diff --git a/tools/config.mk b/tools/config.mk index 096852b28..321365fea 100644 --- a/tools/config.mk +++ b/tools/config.mk @@ -19,6 +19,7 @@ ifeq ($(ARCH),) CORTEX_M0?=0 CORTEX_M33?=0 CORTEX_M7?=0 + CORTEX_M3?=0 NO_ASM?=0 EXT_FLASH?=0 SPI_FLASH?=0 diff --git a/tools/test.mk b/tools/test.mk index e9dde6008..86d08afda 100644 --- a/tools/test.mk +++ b/tools/test.mk @@ -961,7 +961,7 @@ test-size-all: make keysclean make test-size SIGN=ECC384 NO_ASM=1 LIMIT=15172 make keysclean - make test-size SIGN=ED448 LIMIT=13418 + make test-size SIGN=ED448 LIMIT=13420 make keysclean make test-size SIGN=RSA3072 LIMIT=11386 make keysclean