mqtt/Makefile
A.M. Rowsell dee07e5fe7
Subscribe feature now works. See huge commit log!
Quite a few updates. Subscription feature is now working,
which is great. This has been tested with mosquitto broker
as well as Adafruit IO, and it works perfectly with both.

I tried to compile this project as a library (see the changes
to Makefile) but when I used that .a file in another project
the linking process failed. More research needed, I've never
tried to do that before.

I compressed some of the case statements in mqtt_send as they
are so similar, it's a waste of code space to duplicate them.
Disconnect and ping are identical except for one byte, and
unsubscribe and subscribe differ in only a few lines.

The data receive callback now prints information on what kind
of packet/data was received; again, mostly useful during
debugging, but the framework is there to expand it to do
useful things like triggering other tasks/timers, etc.

There is now a keepalive ping timer which keeps both the MQTT
and thus the TCP connection alive. It currently pings every 5
seconds, though I might change that closer to the timeout
maximum (50 seconds).

Signed-off-by: A.M. Rowsell <amrowsell@frozenelectronics.ca>
2018-08-19 02:19:25 -04:00

25 lines
626 B
Makefile

P=mqtt
CC=xtensa-lx106-elf-gcc
AR=xtensa-lx106-elf-ar
LDLIBS=-nostdlib -ggdb -Wl,-Map=output.map -Wl,--start-group -lm -lc -lhal -lpp -llwip -lphy -lnet80211 -lwpa -lat -lwpa2 -lmain -Wl,--end-group -lgcc
CFLAGS= -I. -mlongcalls -std=gnu11
LDFLAGS=-Teagle.app.v6.ld
OBJ=mqtt.o
DEPS=mqtt.h
$(P)-0x00000.bin: $(P)
esptool.py elf2image $^
$(P): $(OBJ)
%.o: %.c $(DEPS)
flash: $(P)-0x00000.bin
esptool.py --port /dev/feather1 write_flash 0 $(P)-0x00000.bin 0x10000 $(P)-0x10000.bin
clean:
rm -f $(P) $(P).o $(P)-0x00000.bin $(P)-0x10000.bin
library:
$(CC) -c -fPIC $(CFLAGS) $(P).c -o $(P).o
$(AR) rcs lib$(P).a $(P).o