Skip to content

Commit f771348

Browse files
committed
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.
1 parent ee6ba61 commit f771348

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ _addons: &addon_conf
2626
packages:
2727
- gcc-multilib
2828
- gcc-7-multilib
29+
- g++-multilib
2930

3031
go:
3132
- "1.16"

porting/examples/dummy/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ OBJ := $(SRC:.c=.o)
6060
TINYCRYPT_OBJ := $(TINYCRYPT_SRC:.c=.o)
6161

6262
CFLAGS := $(NIMBLE_CFLAGS)
63+
LDFLAGS := $(NIMBLE_LDFLAGS)
6364

6465
.PHONY: all clean
6566
.DEFAULT: all
@@ -76,4 +77,4 @@ $(TINYCRYPT_OBJ): CFLAGS+=$(TINYCRYPT_CFLAGS)
7677
$(CC) -c $(addprefix -I, $(INC)) $(CFLAGS) -o $@ $<
7778

7879
dummy: $(OBJ) $(TINYCRYPT_OBJ)
79-
$(CC) -o $@ $^
80+
$(CC) -o $@ $^ $(LDFLAGS)

porting/examples/linux/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ CFLAGS = \
8181
-D_GNU_SOURCE \
8282
$(NULL)
8383

84-
LIBS := -lrt -lpthread -lstdc++
84+
LIBS := $(NIMBLE_LDFLAGS) -lrt -lpthread -lstdc++
8585

8686
.PHONY: all clean
8787
.DEFAULT: all

porting/examples/linux_blemesh/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CFLAGS = \
8383
-D_GNU_SOURCE \
8484
$(NULL)
8585

86-
LIBS := -lrt -lpthread -lstdc++
86+
LIBS := $(NIMBLE_LDFLAGS) -lrt -lpthread -lstdc++
8787

8888
.PHONY: all clean
8989
.DEFAULT: all

porting/nimble/Makefile.defs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ ifeq (,$(NIMBLE_ROOT))
1919
$(error NIMBLE_ROOT shall be defined)
2020
endif
2121

22-
NIMBLE_CFLAGS :=
22+
# For now this is required as there are places in NimBLE
23+
# assumingthat pointer is 4 bytes long.
24+
NIMBLE_CFLAGS := -m32
25+
NIMBLE_LDFLAGS := -m32
2326

2427
NIMBLE_INCLUDE := \
2528
$(NIMBLE_ROOT)/nimble/include \

0 commit comments

Comments
 (0)