Skip to content

Instantly share code, notes, and snippets.

@xerpi
Created September 17, 2016 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xerpi/fccebc0d480babf32cd4d624e6f05e7b to your computer and use it in GitHub Desktop.
Save xerpi/fccebc0d480babf32cd4d624e6f05e7b to your computer and use it in GitHub Desktop.
TARGET = $(notdir $(CURDIR))
OBJS = main.o
CC = xtensa-lx106-elf-gcc
CFLAGS = -I. -mlongcalls
LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -Wl,--end-group -lgcc
LDFLAGS = -Teagle.app.v6.ld
BAUDRATE = 921600
all: $(TARGET)-0x00000.bin
$(TARGET)-0x00000.bin: $(TARGET).elf
esptool.py elf2image $^ -o "$(basename $^)-"
$(TARGET).elf: $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS)
flash: $(TARGET)-0x00000.bin
esptool.py -b $(BAUDRATE) write_flash 0 $(TARGET)-0x00000.bin 0x40000 $(TARGET)-0x40000.bin
clean:
rm -f $(TARGET).elf $(OBJS) $(TARGET)-0x00000.bin $(TARGET)-0x40000.bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment