From 4227654d4294b778b2bbba8a3b735882786b1d2d Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Sun, 1 Jun 2025 11:24:48 +0200 Subject: [PATCH] examples/natmod/btree: Fix build for Xtensa. This commit provides the appropriate external symbol addresses to let the "btree" example natmod build for the Xtensa platform. On the ESP8266, unsigned integer division code isn't provided as part of libgcc.a, libm.a, or libc.a, but it is instead provided by the ROM. Regular builds inject the appropriate symbol addresses as part of the linking process (see eagle.rom.addr.v6.ld), but natmods need this information brought in from somewhere else. Signed-off-by: Alessandro Gatti --- examples/natmod/btree/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/natmod/btree/Makefile b/examples/natmod/btree/Makefile index ff130d61b3..6273ccc657 100644 --- a/examples/natmod/btree/Makefile +++ b/examples/natmod/btree/Makefile @@ -8,7 +8,7 @@ MOD = btree_$(ARCH) SRC = btree_c.c # Architecture to build for (x86, x64, armv7m, xtensa, xtensawin, rv32imc) -ARCH = x64 +ARCH ?= x64 BTREE_DIR = $(MPY_DIR)/lib/berkeley-db-1.xx BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\" @@ -32,6 +32,10 @@ SRC += $(addprefix $(realpath $(BTREE_DIR))/,\ mpool/mpool.c \ ) +ifeq ($(ARCH),xtensa) +MPY_EXTERN_SYM_FILE=$(MPY_DIR)/ports/esp8266/boards/eagle.rom.addr.v6.ld +endif + include $(MPY_DIR)/py/dynruntime.mk # btree needs gnu99 defined