From bba15e0a0bf72d03b74610e9a37ac79ffbdacd1a Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Jul 2025 14:32:01 +1000 Subject: [PATCH] examples/natmod: Use LINK_RUNTIME=1 when building for armv6m. To get division helper functions, eg `__aeabi_uidiv`, `__aeabi_idiv` and `__aeabi_uidivmod`. Signed-off-by: Damien George --- examples/natmod/btree/Makefile | 5 +++++ examples/natmod/deflate/Makefile | 5 +++++ examples/natmod/framebuf/Makefile | 5 +++++ examples/natmod/re/Makefile | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/examples/natmod/btree/Makefile b/examples/natmod/btree/Makefile index bcaa7a93d..1910c67c1 100644 --- a/examples/natmod/btree/Makefile +++ b/examples/natmod/btree/Makefile @@ -39,6 +39,11 @@ endif # Use our own errno implementation if Picolibc is used CFLAGS += -D__PICOLIBC_ERRNO_FUNCTION=__errno +ifeq ($(ARCH),armv6m) +# Link with libgcc.a for division helper functions +LINK_RUNTIME = 1 +endif + include $(MPY_DIR)/py/dynruntime.mk # btree needs gnu99 defined diff --git a/examples/natmod/deflate/Makefile b/examples/natmod/deflate/Makefile index 1f63de20d..5823aa4d4 100644 --- a/examples/natmod/deflate/Makefile +++ b/examples/natmod/deflate/Makefile @@ -10,6 +10,11 @@ SRC = deflate.c # Architecture to build for (x86, x64, armv7m, xtensa, xtensawin, rv32imc) ARCH ?= x64 +ifeq ($(ARCH),armv6m) +# Link with libgcc.a for division helper functions +LINK_RUNTIME = 1 +endif + ifeq ($(ARCH),xtensa) # Link with libm.a and libgcc.a from the toolchain LINK_RUNTIME = 1 diff --git a/examples/natmod/framebuf/Makefile b/examples/natmod/framebuf/Makefile index cb821736e..35453c0bb 100644 --- a/examples/natmod/framebuf/Makefile +++ b/examples/natmod/framebuf/Makefile @@ -10,6 +10,11 @@ SRC = framebuf.c # Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) ARCH ?= x64 +ifeq ($(ARCH),armv6m) +# Link with libgcc.a for division helper functions +LINK_RUNTIME = 1 +endif + ifeq ($(ARCH),xtensa) MPY_EXTERN_SYM_FILE=$(MPY_DIR)/ports/esp8266/boards/eagle.rom.addr.v6.ld endif diff --git a/examples/natmod/re/Makefile b/examples/natmod/re/Makefile index 56b08b988..6535693dc 100644 --- a/examples/natmod/re/Makefile +++ b/examples/natmod/re/Makefile @@ -10,4 +10,9 @@ SRC = re.c # Architecture to build for (x86, x64, armv7m, xtensa, xtensawin, rv32imc) ARCH = x64 +ifeq ($(ARCH),armv6m) +# Link with libgcc.a for division helper functions +LINK_RUNTIME = 1 +endif + include $(MPY_DIR)/py/dynruntime.mk