tweak Makefile for sdk 2.0.0

pull/193/head
Thorsten von Eicken 8 years ago
parent 8a8649aab6
commit c5d51a0654
  1. 24
      Makefile
  2. 21
      esp-link/main.c

@ -4,7 +4,6 @@
# Makefile heavily adapted to esp-link and wireless flashing by Thorsten von Eicken # Makefile heavily adapted to esp-link and wireless flashing by Thorsten von Eicken
# Lots of work, in particular to support windows, by brunnels # Lots of work, in particular to support windows, by brunnels
# Original from esphttpd and others... # Original from esphttpd and others...
# VERBOSE=1
# #
# Start by setting the directories for the toolchain a few lines down # Start by setting the directories for the toolchain a few lines down
# the default target will build the firmware images # the default target will build the firmware images
@ -52,35 +51,37 @@ ESP_HOSTNAME ?= esp-link
# Base directory for the compiler. Needs a / at the end. # Base directory for the compiler. Needs a / at the end.
# Typically you'll install https://github.com/pfalcon/esp-open-sdk # Typically you'll install https://github.com/pfalcon/esp-open-sdk
# IMPORTANT: use esp-open-sdk `make STANDALONE=n`: the SDK bundled with esp-open-sdk will *not* work!
XTENSA_TOOLS_ROOT ?= $(abspath ../esp-open-sdk/xtensa-lx106-elf/bin)/ XTENSA_TOOLS_ROOT ?= $(abspath ../esp-open-sdk/xtensa-lx106-elf/bin)/
# Firmware version # Firmware version
# WARNING: if you change this expect to make code adjustments elsewhere, don't expect # WARNING: if you change this expect to make code adjustments elsewhere, don't expect
# that esp-link will magically work with a different version of the SDK!!! # that esp-link will magically work with a different version of the SDK!!!
SDK_VERS ?= esp_iot_sdk_v1.5.4 SDK_VERS ?= esp_iot_sdk_v2.0.0.p1
# Try to find the firmware manually extracted, e.g. after downloading from Espressif's BBS, # Try to find the firmware manually extracted, e.g. after downloading from Espressif's BBS,
# http://bbs.espressif.com/viewforum.php?f=46 # http://bbs.espressif.com/viewforum.php?f=46
SDK_BASE ?= $(wildcard ../$(SDK_VERS)) SDK_BASE ?= $(wildcard ../$(SDK_VERS))
# If the firmware isn't there, see whether it got downloaded as part of esp-open-sdk # If the firmware isn't there, see whether it got downloaded as part of esp-open-sdk
ifeq ($(SDK_BASE),) # This used to work at some point, but is not supported, uncomment if you feel lucky ;-)
SDK_BASE := $(wildcard $(XTENSA_TOOLS_ROOT)/../../$(SDK_VERS)) #ifeq ($(SDK_BASE),)
endif #SDK_BASE := $(wildcard $(XTENSA_TOOLS_ROOT)/../../$(SDK_VERS))
#endif
# Clean up SDK path # Clean up SDK path
SDK_BASE := $(abspath $(SDK_BASE)) SDK_BASE := $(abspath $(SDK_BASE))
$(warning Using SDK from $(SDK_BASE)) $(warning Using SDK from $(SDK_BASE))
# Path to bootloader file # Path to bootloader file
BOOTFILE ?= $(SDK_BASE/bin/boot_v1.5.bin) BOOTFILE ?= $(SDK_BASE/bin/boot_v1.6.bin)
# Esptool.py path and port, only used for 1-time serial flashing # Esptool.py path and port, only used for 1-time serial flashing
# Typically you'll use https://github.com/themadinventor/esptool # Typically you'll use https://github.com/themadinventor/esptool
# Windows users use the com port i.e: ESPPORT ?= com3 # Windows users use the com port i.e: ESPPORT ?= com3
ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py) ESPTOOL ?= $(abspath ../esp-open-sdk/esptool/esptool.py)
ESPPORT ?= /dev/ttyUSB0 ESPPORT ?= /dev/ttyUSB0
ESPBAUD ?= 460800 ESPBAUD ?= 230400
# --------------- chipset configuration --------------- # --------------- chipset configuration ---------------
@ -117,8 +118,6 @@ MODULES ?= mqtt rest syslog web-server
# #
# Adding JPG or PNG files (and any other compressed formats) is not recommended, because GZIP # Adding JPG or PNG files (and any other compressed formats) is not recommended, because GZIP
# compression does not work effectively on compressed files. # compression does not work effectively on compressed files.
#Static gzipping is disabled by default.
GZIP_COMPRESSION ?= yes GZIP_COMPRESSION ?= yes
# If COMPRESS_W_HTMLCOMPRESSOR is set to "yes" then the static css and js files will be compressed with # If COMPRESS_W_HTMLCOMPRESSOR is set to "yes" then the static css and js files will be compressed with
@ -262,7 +261,6 @@ LD := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-gcc
OBJCP := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-objcopy OBJCP := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-objcopy
OBJDP := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-objdump OBJDP := $(XTENSA_TOOLS_ROOT)xtensa-lx106-elf-objdump
#### ####
SRC_DIR := $(MODULES) SRC_DIR := $(MODULES)
BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES)) BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES))
@ -381,7 +379,7 @@ $(FW_BASE)/user2.bin: $(USER2_OUT) $(FW_BASE)
$(Q) $(OBJCP) --only-section .data -O binary $(USER2_OUT) eagle.app.v6.data.bin $(Q) $(OBJCP) --only-section .data -O binary $(USER2_OUT) eagle.app.v6.data.bin
$(Q) $(OBJCP) --only-section .rodata -O binary $(USER2_OUT) eagle.app.v6.rodata.bin $(Q) $(OBJCP) --only-section .rodata -O binary $(USER2_OUT) eagle.app.v6.rodata.bin
$(Q) $(OBJCP) --only-section .irom0.text -O binary $(USER2_OUT) eagle.app.v6.irom0text.bin $(Q) $(OBJCP) --only-section .irom0.text -O binary $(USER2_OUT) eagle.app.v6.irom0text.bin
$(Q) COMPILE=gcc PATH=$(XTENSA_TOOLS_ROOT):$(PATH) python $(APPGEN_TOOL) $(USER2_OUT) 2 $(ESP_FLASH_MODE) $(ESP_FLASH_FREQ_DIV) $(ESP_SPI_SIZE) 0 $(Q) COMPILE=gcc PATH=$(XTENSA_TOOLS_ROOT):$(PATH) python $(APPGEN_TOOL) $(USER2_OUT) 2 $(ESP_FLASH_MODE) $(ESP_FLASH_FREQ_DIV) $(ESP_SPI_SIZE) 1
$(Q) rm -f eagle.app.v6.*.bin $(Q) rm -f eagle.app.v6.*.bin
$(Q) mv eagle.app.flash.bin $@ $(Q) mv eagle.app.flash.bin $@
$(Q) if [ $$(stat -c '%s' $@) -gt $$(( $(ESP_FLASH_MAX) )) ]; then echo "$@ too big!"; false; fi $(Q) if [ $$(stat -c '%s' $@) -gt $$(( $(ESP_FLASH_MAX) )) ]; then echo "$@ too big!"; false; fi
@ -430,7 +428,7 @@ $(BUILD_BASE)/espfs_img.o: html/ html/wifi/ espfs/mkespfsimage/mkespfsimage
$(Q) cp -r html/wifi/*.png html_compressed/wifi; $(Q) cp -r html/wifi/*.png html_compressed/wifi;
$(Q) cp -r html/wifi/*.js html_compressed/wifi; $(Q) cp -r html/wifi/*.js html_compressed/wifi;
ifeq ("$(COMPRESS_W_HTMLCOMPRESSOR)","yes") ifeq ("$(COMPRESS_W_HTMLCOMPRESSOR)","yes")
$(Q) echo "Compression assets with htmlcompressor. This may take a while..." $(Q) echo "Compressing assets with htmlcompressor. This may take a while..."
$(Q) java -jar tools/$(HTML_COMPRESSOR) \ $(Q) java -jar tools/$(HTML_COMPRESSOR) \
-t html --remove-surrounding-spaces max --remove-quotes --remove-intertag-spaces \ -t html --remove-surrounding-spaces max --remove-quotes --remove-intertag-spaces \
-o $(abspath ./html_compressed)/ \ -o $(abspath ./html_compressed)/ \
@ -440,7 +438,7 @@ ifeq ("$(COMPRESS_W_HTMLCOMPRESSOR)","yes")
-t html --remove-surrounding-spaces max --remove-quotes --remove-intertag-spaces \ -t html --remove-surrounding-spaces max --remove-quotes --remove-intertag-spaces \
-o $(abspath ./html_compressed)/wifi/ \ -o $(abspath ./html_compressed)/wifi/ \
$(WIFI_PATH)*.html $(WIFI_PATH)*.html
$(Q) echo "Compression assets with yui-compressor. This may take a while..." $(Q) echo "Compressing assets with yui-compressor. This may take a while..."
$(Q) for file in `find html_compressed -type f -name "*.js"`; do \ $(Q) for file in `find html_compressed -type f -name "*.js"`; do \
java -jar tools/$(YUI_COMPRESSOR) $$file --line-break 0 -o $$file; \ java -jar tools/$(YUI_COMPRESSOR) $$file --line-break 0 -o $$file; \
done done

@ -122,13 +122,30 @@ extern uint32_t _binary_espfs_img_start;
extern void app_init(void); extern void app_init(void);
extern void mqtt_client_init(void); extern void mqtt_client_init(void);
void user_rf_pre_init(void) { void ICACHE_FLASH_ATTR
user_rf_pre_init(void) {
//default is enabled //default is enabled
system_set_os_print(DEBUG_SDK); system_set_os_print(DEBUG_SDK);
} }
/* user_rf_cal_sector_set is a required function that is called by the SDK to get a flash
* sector number where it can store RF calibration data. This was introduced with SDK 1.5.4.1
* and is necessary because Espressif ran out of pre-reserved flash sectors. Ooops... */
uint32 ICACHE_FLASH_ATTR
user_rf_cal_sector_set(void) {
uint32_t sect = 0;
switch (system_get_flash_size_map()) {
case FLASH_SIZE_4M_MAP_256_256: // 512KB
sect = 128 - 10; // 0x76000
default:
sect = 128; // 0x80000
}
return sect;
}
// Main routine to initialize esp-link. // Main routine to initialize esp-link.
void user_init(void) { void ICACHE_FLASH_ATTR
user_init(void) {
// uncomment the following three lines to see flash config messages for troubleshooting // uncomment the following three lines to see flash config messages for troubleshooting
//uart_init(115200, 115200); //uart_init(115200, 115200);
//logInit(); //logInit();

Loading…
Cancel
Save