Skip to content

Commit a045c0f

Browse files
committed
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 <a.gatti@frob.it>
1 parent df4d21d commit a045c0f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

examples/natmod/btree/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ MOD = btree_$(ARCH)
88
SRC = btree_c.c
99

1010
# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin, rv32imc)
11-
ARCH = x64
11+
ARCH ?= x64
1212

1313
BTREE_DIR = $(MPY_DIR)/lib/berkeley-db-1.xx
1414
BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
@@ -32,6 +32,10 @@ SRC += $(addprefix $(realpath $(BTREE_DIR))/,\
3232
mpool/mpool.c \
3333
)
3434

35+
ifeq ($(ARCH),xtensa)
36+
MPY_EXTERN_SYM_FILE=$(MPY_DIR)/ports/esp8266/boards/eagle.rom.addr.v6.ld
37+
endif
38+
3539
include $(MPY_DIR)/py/dynruntime.mk
3640

3741
# btree needs gnu99 defined

0 commit comments

Comments
 (0)