forked from cnlohr/esp82xx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.mf
84 lines (64 loc) · 2.87 KB
/
common.mf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
###############################################################################
# This is for commom variables shared between sub-Makefiles
# The variables here are not necessary for the extensa compiler, but also
#+for client software like the command-line utilities (e.g. execute_reflash).
# Note: user.cfg can override these.
###############################################################################
# Toolchain Options
###############################################################################
GCC_FOLDER = $(ESP_ROOT)/xtensa-lx106-elf
ifndef ESPTOOL_PY
ESPTOOL_PY = python2 $(ESP_ROOT)/esptool/esptool.py
endif
SDK ?= $(PWD)/esp82xx/toolchain/esp_nonos_sdk
XTLIB = $(SDK)/lib
XTGCCLIB = $(GCC_FOLDER)/lib/gcc/xtensa-lx106-elf/$(ESP_GCC_VERS)/libgcc.a
FOLDERPREFIX = $(GCC_FOLDER)/bin
PREFIX = $(FOLDERPREFIX)/xtensa-lx106-elf-
CC = $(PREFIX)gcc
OBJCOPY = $(PREFIX)objcopy
LD = $(PREFIX)ld
AR = $(PREFIX)ar
CP = cp
INIT_DATA_ROM?=$(SDK)/bin/esp_init_data_default_v08.bin
ifneq ("$(wildcard $($(INIT_DATA_ROM)))","")
INIT_DATA_ROM?=$(INIT_DATA_ROM)
else
INIT_DATA_ROM?=$(SDK)/bin/esp_init_data_default.bin
endif
ifneq ("$(wildcard $($(SDK)/ld/linkerscript.ld))","")
LINKERSCRIPT?=$(SDK)/ld/linkerscript.ld
else
LINKERSCRIPT?=$(SDK)/ld/eagle.app.v6.ld
endif
SLOWTICK_MS ?= 50
###############################################################################
# Derived Options
###############################################################################
OPTS += -DWEB_PORT=$(WEB_PORT) -DCOM_PORT=$(COM_PORT) -DBACKEND_PORT=$(BACKEND_PORT) $(EXTRAOPTS) -DSLOWTICK_MS=$(SLOWTICK_MS)
PAGE_SCRIPTS?=$(wildcard web/page/*.js)
# Getting xtensa compiler paths from shell variables
ESP_DEFAULT = $(HOME)/esp8266/esp-open-sdk
ESP_ROOT := $(shell echo "$$ESP_ROOT")
ifeq ($(strip $(ESP_ROOT)),)
$(warning Warning: No shell variable 'ESP_ROOT', using '$(ESP_DEFAULT)')
ESP_ROOT := $(ESP_DEFAULT)
endif
ifeq ($(strip $(STRIPPED_LIBGCC)),YES)
XTGCCLIB=esp82xx/libgcc_stripped.a
endif
# Version related stuff
IS_CI_BUILD = 0
VCMD = git describe --abbrev=5 --dirty=-dev --always --tags 2>/dev/null
VERSION := $(shell $(VCMD) || { cd esp82xx 2>/dev/null; $(VCMD) ; } || echo "unknown")
BUILD_DATE := $(shell LANG=en_us_8859_1 date '+%a, %b %e %Y, %R:%S %z')
VERSSTR := "Version: $(VERSION) - Build $(BUILD_DATE) with $(OPTS). IS_CI_BUILD=$(IS_CI_BUILD)"
PROJECT_NAME := $(or $(PROJECT_NAME),$(notdir $(shell git rev-parse --show-toplevel 2>/dev/null || echo "exp82xx-project")))
PROJECT_URL := $(subst .com:,.com/,$(subst .git,,$(subst git@,https://,$(shell git config --get remote.origin.url 2>/dev/null || echo "https://github.com/con-f-use/esp82xx-basic.git"))))
# Newline and space hacks
define \n
endef
empty:=
\s:= $(empty) $(empty)
# Helper functions
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))