Discuss here different C compiler set ups, and compiling executables for the ESP8266
User avatar
By Agentsmithers
#68953 Hi Everyone!
I am not super aquinted with makefile's but what I am trying to do is create the user1.bin and user2.bin files and in this case named blinky-0x1000.bin and blinky 0x81000.bin. This requires compiling Blinky.c then fashing it with the Esptool then clearing the Blinky files then changing the LDFlag to eagle.app.v6.new.1024.app2 then repeating to a different address. I've burned about 8 hours stright trying to bend this make file on regenerating the two files and flashing them to the chip. Any makefile Guru's out there? Thank you so much!!

Code: Select allCC = xtensa-lx106-elf-gcc
CFLAGS = -I. -DICACHE_FLASH -mlongcalls
LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -lc -Wl,--end-group -lgcc
LDFLAGS = -Teagle.app.v6.new.1024.app1.ld
INCLUDES = -Iinclude -I../driver_lib/include

ifeq ($(OS),Darwin)
    $(info OS is $(OS))
    CC=g++
    LDFLAGS=-lm -framework OpenCL
    CFLAGS+=-O3
endif

blinky-0x00000.bin: blinky
   echo a
   echo $(LDFLAGS)
   esptool.py elf2image $^

fotablinky-0x81000.bin: LDFLAGS=-Teagle.app.v6.new.1024.app2.ld
fotablinky-0x81000.bin: blinky
   echo b
   echo $(LDFLAGS)
   rm -f blinky.o
   esptool.py elf2image --version 2 blinky
   esptool.py write_flash --flash_size 32m-c1 0x81000 blinky-0x81000.bin

fotablinky-0x01000.bin: blinky
   echo c
   echo $(LDFLAGS)
   esptool.py elf2image --version 2 blinky   
   esptool.py write_flash --flash_size 32m-c1 0 boot_v1.7.bin 0x1000 blinky-0x01000.bin 0x7e000 blank.bin 0xFE000 blank.bin 0x3FC000 esp_init_data_default.bin

blinky: blinky.o

blinky.o: blinky.c

dhonewire: dhonewire.o

dhonewire.o: dhonewire.c

fresh: blinky-0x00000.bin
   echo d
   echo %LDFLAGS%
   #kill $(ps aux | grep '[S]CREEN' | awk '{print $2}')
   esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin 0x7e000 blank.bin 0x3fc000 esp_init_data_default.bin 0x3fe000 blank.bin 0x60000 index.html 0x80000 config.html
   #screen /dev/ttyUSB0 74880
   screen /dev/ttyUSB0 115200

flash: blinky-0x00000.bin
   echo e
   echo %LDFLAGS%
   esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin 0x60000 index.html 0x80000 config.html
   screen /dev/ttyUSB0 115200

quick: blinky-0x00000.bin
   echo f
   echo $(LDFLAGS)
   esptool.py write_flash 0 blinky-0x00000.bin 0x10000 blinky-0x10000.bin
   screen /dev/ttyUSB0 115200

build: blinky-0x00000.bin
   echo g
   echo $(LDFLAGS)
   screen /dev/ttyUSB0 115200

ota: fotablinky-0x01000.bin fotablinky-0x81000.bin
   #export -p
   echo h
   echo $(LDFLAGS)
   #esptool.py write_flash --flash_size 32m-c1 0x81000 blinky-0x81000.bin
   screen /dev/ttyUSB0 115200

clean:
   echo i
   rm -f blinky blinky.o blinky-0x00000.bin blinky-0x10000.bin blinky-0x81000.bin blinky-0x01000.bin
   #echo 'osboxes.org' | sudo -S chmod 777 /dev/ttyUSB0 #No longer needed, osboxes added to dialout group with usermod
User avatar
By Agentsmithers
#68965 Yes Sir Davy! I had to I couldn't find out for the love of me what was going on with the script. I tried for hours. The Eagle.LD I am linking with spits out an 0x81000 in lieu of a 0x101000. I think a modification needs to be done for it to work with the open-esp-sdk I am using.

I really really appreciate your help too on that one Davy, I will one day turn around and fiddle with your script more.