From 0bf2fd7ad034404208d79339c1bd82136b1cd4e3 Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Mon, 7 Apr 2025 22:36:26 +0200 Subject: [PATCH] examples/natmod/random: Fix build for Xtensa. This commit provides the appropriate external symbol addresses to let the "random" example natmod build for the Xtensa platform. On the ESP8266, signed 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/random/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/natmod/random/Makefile b/examples/natmod/random/Makefile index 8abdb66dc8..5d23eac1e9 100644 --- a/examples/natmod/random/Makefile +++ b/examples/natmod/random/Makefile @@ -8,6 +8,10 @@ MOD = random_$(ARCH) SRC = random.c # Architecture to build for (x86, x64, armv7m, xtensa, xtensawin, rv32imc) -ARCH = x64 +ARCH ?= x64 + +ifeq ($(ARCH),xtensa) +MPY_EXTERN_SYM_FILE=$(MPY_DIR)/ports/esp8266/boards/eagle.rom.addr.v6.ld +endif include $(MPY_DIR)/py/dynruntime.mk