Skip to content

Commit 96a8a5b

Browse files
committed
Fix build issues with MQTT example and python3
This commit addresses issues with building the esp_mqtt_proj example, such as: - Hard-coded call to python binary - Re-defined 'packed' attribute in xtensa-lx106-elf/include/sys/cdefs.h - Failed build due to relative paths in Makefiles GCC compiler version: 5.2.0 Default python version: 3.7.3
1 parent 8631a0d commit 96a8a5b

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

Makefile

+19-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ ifndef PDIR
44

55
endif
66

7+
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
8+
SDKDIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))/
9+
ifndef PYTHON
10+
PYTHON := python
11+
endif
12+
713
ifeq ($(COMPILE), gcc)
814
AR = xtensa-lx106-elf-ar
915
CC = xtensa-lx106-elf-gcc
@@ -260,14 +266,14 @@ $(BINODIR)/%.bin: $(IMAGEODIR)/%.out
260266
@mkdir -p $(BINODIR)
261267

262268
ifeq ($(APP), 0)
263-
@$(RM) -r ../bin/eagle.S ../bin/eagle.dump
264-
@$(OBJDUMP) -x -s $< > ../bin/eagle.dump
265-
@$(OBJDUMP) -S $< > ../bin/eagle.S
269+
@$(RM) -r $(SDKDIR)bin/eagle.S $(SDKDIR)bin/eagle.dump
270+
@$(OBJDUMP) -x -s $< > $(SDKDIR)bin/eagle.dump
271+
@$(OBJDUMP) -S $< > $(SDKDIR)bin/eagle.S
266272
else
267-
mkdir -p ../bin/upgrade
268-
@$(RM) -r ../bin/upgrade/$(BIN_NAME).S ../bin/upgrade/$(BIN_NAME).dump
269-
@$(OBJDUMP) -x -s $< > ../bin/upgrade/$(BIN_NAME).dump
270-
@$(OBJDUMP) -S $< > ../bin/upgrade/$(BIN_NAME).S
273+
mkdir -p $(SDKDIR)bin/upgrade
274+
@$(RM) -r $(SDKDIR)bin/upgrade/$(BIN_NAME).S $(SDKDIR)bin/upgrade/$(BIN_NAME).dump
275+
@$(OBJDUMP) -x -s $< > $(SDKDIR)bin/upgrade/$(BIN_NAME).dump
276+
@$(OBJDUMP) -S $< > $(SDKDIR)bin/upgrade/$(BIN_NAME).S
271277
endif
272278

273279
@$(OBJCOPY) --only-section .text -O binary $< eagle.app.v6.text.bin
@@ -279,20 +285,20 @@ endif
279285
@echo "!!!"
280286

281287
ifeq ($(app), 0)
282-
@python ../tools/gen_appbin.py $< 0 $(mode) $(freqdiv) $(size_map) $(app)
283-
@mv eagle.app.flash.bin ../bin/eagle.flash.bin
284-
@mv eagle.app.v6.irom0text.bin ../bin/eagle.irom0text.bin
288+
@$(PYTHON) $(SDKDIR)tools/gen_appbin.py $< 0 $(mode) $(freqdiv) $(size_map) $(app)
289+
@mv eagle.app.flash.bin $(SDKDIR)bin/eagle.flash.bin
290+
@mv eagle.app.v6.irom0text.bin $(SDKDIR)bin/eagle.irom0text.bin
285291
@rm eagle.app.v6.*
286292
@echo "No boot needed."
287293
@echo "Generate eagle.flash.bin and eagle.irom0text.bin successully in folder bin."
288294
@echo "eagle.flash.bin-------->0x00000"
289295
@echo "eagle.irom0text.bin---->0x10000"
290296
else
291297
ifneq ($(boot), new)
292-
@python ../tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
298+
@$(PYTHON) $(SDKDIR)tools/gen_appbin.py $< 1 $(mode) $(freqdiv) $(size_map) $(app)
293299
@echo "Support boot_v1.1 and +"
294300
else
295-
@python ../tools/gen_appbin.py $< 2 $(mode) $(freqdiv) $(size_map) $(app)
301+
@$(PYTHON) $(SDKDIR)tools/gen_appbin.py $< 2 $(mode) $(freqdiv) $(size_map) $(app)
296302

297303
ifeq ($(size_map), 6)
298304
@echo "Support boot_v1.4 and +"
@@ -305,7 +311,7 @@ else
305311
endif
306312
endif
307313

308-
@mv eagle.app.flash.bin ../bin/upgrade/$(BIN_NAME).bin
314+
@mv eagle.app.flash.bin $(SDKDIR)bin/upgrade/$(BIN_NAME).bin
309315
@rm eagle.app.v6.*
310316
@echo "Generate $(BIN_NAME).bin successully in folder bin/upgrade."
311317
@echo "boot.bin------------>0x00000"

examples/esp_mqtt_proj/Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SUBDIRS= \
2929
endif # } PDIR
3030

3131
APPDIR = .
32-
LDDIR = ../ld
32+
LDDIR = ../../ld
3333

3434
CCFLAGS += -Os
3535

@@ -53,7 +53,8 @@ COMPONENTS_eagle.app.v6 = \
5353
modules/libmodules.a
5454

5555
LINKFLAGS_eagle.app.v6 = \
56-
-L../lib \
56+
-L../../lib \
57+
-L../../ld \
5758
-nostdlib \
5859
-T$(LD_FILE) \
5960
-Wl,--no-check-sections \
@@ -123,7 +124,7 @@ DDEFINES += \
123124
#
124125

125126
INCLUDES := $(INCLUDES) -I $(PDIR)include -I $(PDIR)include/mqtt -I $(PDIR)include/modules
126-
PDIR := ../$(PDIR)
127+
PDIR := ../../$(PDIR)
127128
sinclude $(PDIR)Makefile
128129

129130
.PHONY: FORCE

examples/esp_mqtt_proj/gen_misc.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -x
4+
35
echo "gen_misc.sh version 20150511"
46
echo ""
57

0 commit comments

Comments
 (0)