This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new f771348 ports: Build NimBLE with 32-bit environment
f771348 is described below
commit f771348a4ee7b5fd757aec810ebb0766cc300efc
Author: Szymon Janc <[email protected]>
AuthorDate: Mon Dec 6 16:30:45 2021 +0100
ports: Build NimBLE with 32-bit environment
Some code in NimBLE assumes that pointers are 4 bytes. Until this
is properly fixed build with -m32 to make sure resulting binary
is no misbehaving.
---
.travis.yml | 1 +
porting/examples/dummy/Makefile | 3 ++-
porting/examples/linux/Makefile | 2 +-
porting/examples/linux_blemesh/Makefile | 2 +-
porting/nimble/Makefile.defs | 5 ++++-
5 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 0b59e7a..185ca35 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,7 @@ _addons: &addon_conf
packages:
- gcc-multilib
- gcc-7-multilib
+ - g++-multilib
go:
- "1.16"
diff --git a/porting/examples/dummy/Makefile b/porting/examples/dummy/Makefile
index 861934f..1c38ac4 100644
--- a/porting/examples/dummy/Makefile
+++ b/porting/examples/dummy/Makefile
@@ -60,6 +60,7 @@ OBJ := $(SRC:.c=.o)
TINYCRYPT_OBJ := $(TINYCRYPT_SRC:.c=.o)
CFLAGS := $(NIMBLE_CFLAGS)
+LDFLAGS := $(NIMBLE_LDFLAGS)
.PHONY: all clean
.DEFAULT: all
@@ -76,4 +77,4 @@ $(TINYCRYPT_OBJ): CFLAGS+=$(TINYCRYPT_CFLAGS)
$(CC) -c $(addprefix -I, $(INC)) $(CFLAGS) -o $@ $<
dummy: $(OBJ) $(TINYCRYPT_OBJ)
- $(CC) -o $@ $^
+ $(CC) -o $@ $^ $(LDFLAGS)
diff --git a/porting/examples/linux/Makefile b/porting/examples/linux/Makefile
index 11f4ebc..c3eee16 100644
--- a/porting/examples/linux/Makefile
+++ b/porting/examples/linux/Makefile
@@ -81,7 +81,7 @@ CFLAGS = \
-D_GNU_SOURCE \
$(NULL)
-LIBS := -lrt -lpthread -lstdc++
+LIBS := $(NIMBLE_LDFLAGS) -lrt -lpthread -lstdc++
.PHONY: all clean
.DEFAULT: all
diff --git a/porting/examples/linux_blemesh/Makefile
b/porting/examples/linux_blemesh/Makefile
index c1518e0..67783f2 100644
--- a/porting/examples/linux_blemesh/Makefile
+++ b/porting/examples/linux_blemesh/Makefile
@@ -83,7 +83,7 @@ CFLAGS = \
-D_GNU_SOURCE \
$(NULL)
-LIBS := -lrt -lpthread -lstdc++
+LIBS := $(NIMBLE_LDFLAGS) -lrt -lpthread -lstdc++
.PHONY: all clean
.DEFAULT: all
diff --git a/porting/nimble/Makefile.defs b/porting/nimble/Makefile.defs
index 5bab893..78f73fb 100644
--- a/porting/nimble/Makefile.defs
+++ b/porting/nimble/Makefile.defs
@@ -19,7 +19,10 @@ ifeq (,$(NIMBLE_ROOT))
$(error NIMBLE_ROOT shall be defined)
endif
-NIMBLE_CFLAGS :=
+# For now this is required as there are places in NimBLE
+# assumingthat pointer is 4 bytes long.
+NIMBLE_CFLAGS := -m32
+NIMBLE_LDFLAGS := -m32
NIMBLE_INCLUDE := \
$(NIMBLE_ROOT)/nimble/include \