2016-10-22 02:20:57 +03:00
|
|
|
# Copyright 2014-present PlatformIO <contact@platformio.org>
|
|
|
|
|
#
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
|
#
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
#
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
|
|
"""
|
2016-10-24 20:23:25 +03:00
|
|
|
Espressif IDF
|
2016-10-22 02:20:57 +03:00
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
Espressif IoT Development Framework for ESP32 MCU
|
2016-10-22 02:20:57 +03:00
|
|
|
|
|
|
|
|
https://github.com/espressif/esp-idf
|
|
|
|
|
"""
|
|
|
|
|
|
2017-05-19 19:58:10 +03:00
|
|
|
from glob import glob
|
2017-02-19 21:23:04 +02:00
|
|
|
from os import listdir, walk
|
|
|
|
|
from os.path import basename, isdir, isfile, join
|
2016-10-24 20:23:25 +03:00
|
|
|
|
2017-05-19 19:58:10 +03:00
|
|
|
from shutil import copy
|
|
|
|
|
import sys
|
2016-10-24 20:23:25 +03:00
|
|
|
from SCons.Script import DefaultEnvironment
|
|
|
|
|
|
2016-11-06 16:46:33 +02:00
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
env = DefaultEnvironment()
|
|
|
|
|
platform = env.PioPlatform()
|
|
|
|
|
|
|
|
|
|
FRAMEWORK_DIR = platform.get_package_dir("framework-espidf")
|
2017-01-25 15:42:36 +02:00
|
|
|
assert FRAMEWORK_DIR and isdir(FRAMEWORK_DIR)
|
2016-10-24 20:23:25 +03:00
|
|
|
|
|
|
|
|
|
2017-02-19 21:23:04 +02:00
|
|
|
def parse_mk(path):
|
|
|
|
|
result = {}
|
|
|
|
|
variable = None
|
|
|
|
|
multi = False
|
|
|
|
|
with open(path) as fp:
|
|
|
|
|
for line in fp.readlines():
|
|
|
|
|
line = line.strip()
|
|
|
|
|
if not line or line.startswith("#"):
|
2017-09-05 19:55:05 +03:00
|
|
|
multi = False
|
2017-02-19 21:23:04 +02:00
|
|
|
continue
|
|
|
|
|
# remove inline comments
|
|
|
|
|
if " # " in line:
|
|
|
|
|
line = line[:line.index(" # ")]
|
|
|
|
|
if not multi and "=" in line:
|
|
|
|
|
variable, line = line.split("=", 1)
|
|
|
|
|
if variable.endswith((":", "+")):
|
|
|
|
|
variable = variable[:-1]
|
|
|
|
|
variable = variable.strip()
|
|
|
|
|
line = line.strip()
|
|
|
|
|
if not variable or not line:
|
|
|
|
|
continue
|
|
|
|
|
multi = line.endswith('\\')
|
|
|
|
|
if multi:
|
|
|
|
|
line = line[:-1].strip()
|
|
|
|
|
if variable not in result:
|
|
|
|
|
result[variable] = []
|
|
|
|
|
result[variable].extend([l.strip() for l in line.split()])
|
|
|
|
|
if not multi:
|
|
|
|
|
variable = None
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_component(path):
|
|
|
|
|
envsafe = env.Clone()
|
2017-08-16 15:33:58 +03:00
|
|
|
src_filter = "+<*> -<test*>"
|
2017-02-19 21:23:04 +02:00
|
|
|
if isfile(join(path, "component.mk")):
|
|
|
|
|
params = parse_mk(join(path, "component.mk"))
|
|
|
|
|
if params.get("COMPONENT_PRIV_INCLUDEDIRS"):
|
|
|
|
|
inc_dirs = params.get("COMPONENT_PRIV_INCLUDEDIRS")
|
|
|
|
|
envsafe.Prepend(
|
|
|
|
|
CPPPATH=[join(path, d) for d in inc_dirs])
|
|
|
|
|
if params.get("CFLAGS"):
|
|
|
|
|
envsafe.Append(CCFLAGS=params.get("CFLAGS"))
|
|
|
|
|
if params.get("COMPONENT_OBJS"):
|
|
|
|
|
src_filter = "-<*>"
|
|
|
|
|
for f in params.get("COMPONENT_OBJS"):
|
|
|
|
|
src_filter += " +<%s>" % f.replace(".o", ".c")
|
|
|
|
|
elif params.get("COMPONENT_SRCDIRS"):
|
|
|
|
|
src_filter = "-<*>"
|
|
|
|
|
src_dirs = params.get("COMPONENT_SRCDIRS")
|
|
|
|
|
if "." in src_dirs:
|
|
|
|
|
src_dirs.remove(".")
|
|
|
|
|
src_filter += " +<*.c*>"
|
|
|
|
|
for f in src_dirs:
|
|
|
|
|
src_filter += " +<%s/*.c*>" % f
|
|
|
|
|
|
|
|
|
|
return envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "%s" % basename(path)), path,
|
|
|
|
|
src_filter=src_filter
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2016-11-20 12:59:28 +02:00
|
|
|
def build_espidf_bootloader():
|
|
|
|
|
envsafe = env.Clone()
|
2017-02-20 21:59:41 +02:00
|
|
|
envsafe.Append(CPPDEFINES=[("BOOTLOADER_BUILD", 1)])
|
2016-11-20 12:59:28 +02:00
|
|
|
envsafe.Replace(
|
|
|
|
|
LIBPATH=[
|
2017-01-25 15:42:36 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "ld"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "lib"),
|
2017-01-25 15:42:36 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "bootloader", "src", "main")
|
2016-11-20 12:59:28 +02:00
|
|
|
],
|
|
|
|
|
|
|
|
|
|
LINKFLAGS=[
|
|
|
|
|
"-nostdlib",
|
|
|
|
|
"-Wl,-static",
|
|
|
|
|
"-u", "call_user_start_cpu0",
|
|
|
|
|
"-Wl,--gc-sections",
|
|
|
|
|
"-T", "esp32.bootloader.ld",
|
2017-02-19 21:23:04 +02:00
|
|
|
"-T", "esp32.rom.ld",
|
2017-08-16 15:33:58 +03:00
|
|
|
"-T", "esp32.peripherals.ld",
|
2017-02-19 21:23:04 +02:00
|
|
|
"-T", "esp32.bootloader.rom.ld"
|
2016-11-20 12:59:28 +02:00
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
|
2017-02-19 21:23:04 +02:00
|
|
|
envsafe.Append(
|
|
|
|
|
CPPPATH=[
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "esp32")
|
|
|
|
|
]
|
|
|
|
|
)
|
2016-11-20 12:59:28 +02:00
|
|
|
|
|
|
|
|
envsafe.Replace(
|
|
|
|
|
LIBS=[
|
2017-02-19 21:23:04 +02:00
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "bootloaderSupport"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "bootloader_support"),
|
|
|
|
|
src_filter="+<*> -<test>"
|
2017-02-19 21:23:04 +02:00
|
|
|
),
|
2016-11-20 12:59:28 +02:00
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "bootloaderLog"),
|
2017-01-25 15:42:36 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "log")
|
2017-02-19 21:23:04 +02:00
|
|
|
),
|
|
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "bootloaderSPIFlash"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "spi_flash"),
|
|
|
|
|
src_filter="-<*> +<spi_flash_rom_patch.c>"
|
|
|
|
|
),
|
|
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "bootloaderMicroEcc"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "micro-ecc"),
|
|
|
|
|
src_filter="+<*> -<micro-ecc/test>"
|
|
|
|
|
),
|
2017-08-16 15:33:58 +03:00
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "bootloaderSoc"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "soc"),
|
|
|
|
|
src_filter="+<*> -<test> -<esp32/test>"
|
|
|
|
|
),
|
|
|
|
|
"gcc", "stdc++"
|
2016-11-20 12:59:28 +02:00
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return envsafe.Program(
|
|
|
|
|
join("$BUILD_DIR", "bootloader.elf"),
|
|
|
|
|
envsafe.CollectBuildFiles(
|
|
|
|
|
join("$BUILD_DIR", "bootloader"),
|
2017-01-25 15:42:36 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "bootloader", "src", "main")
|
2016-11-20 12:59:28 +02:00
|
|
|
)
|
|
|
|
|
)
|
2016-11-13 21:42:12 +02:00
|
|
|
|
2017-01-24 23:25:18 +02:00
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
env.Prepend(
|
|
|
|
|
CPPPATH=[
|
2016-11-13 21:42:12 +02:00
|
|
|
join("$PROJECTSRC_DIR"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "aws_iot", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "aws_iot",
|
|
|
|
|
"aws-iot-device-sdk-embedded-C", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "app_trace", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "app_update", "include"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "xtensa-debug-module", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "bootloader_support", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components",
|
|
|
|
|
"bootloader_support", "include_priv"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "bt", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "coap", "port", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "coap", "port", "include", "coap"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "coap", "libcoap", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "coap",
|
|
|
|
|
"libcoap", "include", "coap"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "cxx", "include"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "driver", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "driver", "include", "driver"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "ethernet", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "expat", "include", "expat"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "expat", "port", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "fatfs", "src"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "freertos", "include"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "jsmn", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "json", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "json", "port", "include"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "libsodium", "libsodium", "src",
|
|
|
|
|
"libsodium", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "libsodium", "libsodium", "src",
|
|
|
|
|
"libsodium", "include", "sodium"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "log", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "port"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "posix"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "lwip", "apps", "ping"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "mbedtls", "port", "include"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "mbedtls", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "mdns", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "micro-ecc", "micro-ecc"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "newlib", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "newlib", "platform_include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "nghttp", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "nghttp", "port", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "nvs_flash", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "openssl", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "openssl", "include", "internal"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "openssl", "include", "platform"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "openssl", "include", "openssl"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "sdmmc", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "spi_flash", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "tcpip_adapter", "include"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "soc", "esp32", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "soc", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "heap", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "ulp", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "vfs", "include"),
|
2017-08-16 15:33:58 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "wear_levelling", "include"),
|
2017-02-19 21:23:04 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "wpa_supplicant", "include"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "wpa_supplicant", "port", "include")
|
2016-10-24 20:23:25 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
|
|
LIBPATH=[
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "esp32"),
|
2016-11-13 21:42:12 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "ld"),
|
2016-10-24 20:23:25 +03:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "lib"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "bt", "lib"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "newlib", "lib"),
|
2016-11-13 21:42:12 +02:00
|
|
|
"$BUILD_DIR"
|
2016-10-24 20:23:25 +03:00
|
|
|
],
|
|
|
|
|
|
|
|
|
|
LIBS=[
|
2017-08-16 15:33:58 +03:00
|
|
|
"btdm_app", "hal", "coexist", "core", "net80211", "phy", "rtc", "pp",
|
2017-02-19 21:23:04 +02:00
|
|
|
"wpa", "wpa2", "wps", "smartconfig", "m", "c", "gcc", "stdc++"
|
2016-10-24 20:23:25 +03:00
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
|
2017-02-19 21:23:04 +02:00
|
|
|
for root, dirs, _ in walk(join(
|
|
|
|
|
FRAMEWORK_DIR, "components", "bt", "bluedroid")):
|
|
|
|
|
for d in dirs:
|
|
|
|
|
if (d == "include"):
|
2017-09-05 19:55:05 +03:00
|
|
|
env.Prepend(CPPPATH=[join(root, d)])
|
2017-02-19 21:23:04 +02:00
|
|
|
|
|
|
|
|
|
2017-02-20 21:59:41 +02:00
|
|
|
env.Prepend(
|
|
|
|
|
CFLAGS=["-Wno-old-style-declaration"],
|
|
|
|
|
|
|
|
|
|
CPPDEFINES=[
|
|
|
|
|
"WITH_POSIX",
|
|
|
|
|
("IDF_VER", '\\"%s\\"' %
|
|
|
|
|
platform.get_package_version("framework-espidf"))
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
CCFLAGS=[
|
|
|
|
|
"-Wall",
|
|
|
|
|
"-Werror=all",
|
|
|
|
|
"-Wno-error=deprecated-declarations",
|
|
|
|
|
"-Wextra",
|
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
|
"-Wno-sign-compare",
|
|
|
|
|
"-Wno-error=unused-function"
|
2016-10-24 20:23:25 +03:00
|
|
|
],
|
|
|
|
|
|
2017-02-20 21:59:41 +02:00
|
|
|
LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
env.Append(
|
2016-10-24 20:23:25 +03:00
|
|
|
LINKFLAGS=[
|
2017-02-20 21:59:41 +02:00
|
|
|
"-u", "__cxa_guard_dummy",
|
2016-10-24 20:23:25 +03:00
|
|
|
"-T", "esp32.common.ld",
|
|
|
|
|
"-T", "esp32.rom.ld",
|
|
|
|
|
"-T", "esp32.peripherals.ld"
|
|
|
|
|
],
|
2017-01-24 23:25:18 +02:00
|
|
|
|
|
|
|
|
UPLOADERFLAGS=[
|
|
|
|
|
"0x1000", join("$BUILD_DIR", "bootloader.bin"),
|
2017-02-19 21:23:04 +02:00
|
|
|
"0x8000", join("$BUILD_DIR", "partitions_table.bin"),
|
2017-01-24 23:25:18 +02:00
|
|
|
"0x10000"
|
|
|
|
|
]
|
2016-10-24 20:23:25 +03:00
|
|
|
)
|
|
|
|
|
|
2017-05-19 19:58:10 +03:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Handle missing sdkconfig.h
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
if not isfile(join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h")):
|
|
|
|
|
search_path = join(
|
|
|
|
|
env.subst("$PIOHOME_DIR"), "platforms",
|
|
|
|
|
env.subst("$PIOPLATFORM"), "examples", "*", "src", "sdkconfig.h"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
files = glob(search_path)
|
|
|
|
|
if not files:
|
|
|
|
|
sys.stderr.write(
|
|
|
|
|
"Error: \"sdkconfig.h\" file is required for esp-idf framework!\n")
|
|
|
|
|
env.Exit(1)
|
|
|
|
|
|
|
|
|
|
print("Warning! Cannot find \"sdk_config.h\" file. "
|
|
|
|
|
"Default \"sdk_config.h\" will be added to your project!")
|
|
|
|
|
copy(files[0], join(env.subst("$PROJECTSRC_DIR"), "sdkconfig.h"))
|
|
|
|
|
|
|
|
|
|
|
2016-11-06 16:46:33 +02:00
|
|
|
#
|
2016-11-20 12:59:28 +02:00
|
|
|
# Generate partition table
|
2016-11-06 16:46:33 +02:00
|
|
|
#
|
|
|
|
|
|
2016-11-20 12:59:28 +02:00
|
|
|
partition_table = env.Command(
|
2017-01-25 15:42:36 +02:00
|
|
|
join("$BUILD_DIR", "partitions_table.bin"),
|
2017-02-20 12:22:24 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "partition_table",
|
|
|
|
|
"partitions_singleapp.csv"),
|
|
|
|
|
env.VerboseAction('"$PYTHONEXE" "%s" -q $SOURCE $TARGET' % join(
|
|
|
|
|
FRAMEWORK_DIR, "components", "partition_table", "gen_esp32part.py"),
|
2017-02-20 21:59:41 +02:00
|
|
|
"Generating partitions $TARGET"))
|
2016-11-20 12:59:28 +02:00
|
|
|
|
|
|
|
|
|
2017-02-20 21:59:41 +02:00
|
|
|
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
|
2016-11-20 12:59:28 +02:00
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Generate linker script
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
linker_script = env.Command(
|
|
|
|
|
join("$BUILD_DIR", "esp32_out.ld"),
|
2017-01-25 15:42:36 +02:00
|
|
|
join(FRAMEWORK_DIR, "components", "esp32", "ld", "esp32.ld"),
|
2017-02-20 12:22:24 +02:00
|
|
|
env.VerboseAction(
|
2017-08-28 11:09:51 +03:00
|
|
|
'$CC -I"$PROJECTSRC_DIR" -C -P -x c -E $SOURCE -o $TARGET',
|
2017-02-20 12:22:24 +02:00
|
|
|
"Generating LD script $TARGET"))
|
2016-11-20 12:59:28 +02:00
|
|
|
|
|
|
|
|
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", linker_script)
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Compile bootloader
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", env.ElfToBin(
|
|
|
|
|
join("$BUILD_DIR", "bootloader"), build_espidf_bootloader()))
|
2016-11-06 16:46:33 +02:00
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
#
|
|
|
|
|
# Target: Build Core Library
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
libs = []
|
|
|
|
|
|
2016-11-13 21:42:12 +02:00
|
|
|
ignore_dirs = (
|
2017-02-19 21:23:04 +02:00
|
|
|
"bootloader",
|
|
|
|
|
"bootloader_support",
|
|
|
|
|
"esptool_py",
|
|
|
|
|
"idf_test",
|
|
|
|
|
"partition_table",
|
|
|
|
|
"nghttp",
|
2017-08-16 15:33:58 +03:00
|
|
|
"soc",
|
|
|
|
|
"spi_flash",
|
|
|
|
|
"libsodium"
|
2017-02-19 21:23:04 +02:00
|
|
|
)
|
2016-11-13 21:42:12 +02:00
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
for d in listdir(join(FRAMEWORK_DIR, "components")):
|
2016-11-13 21:42:12 +02:00
|
|
|
if d in ignore_dirs:
|
2016-10-24 20:23:25 +03:00
|
|
|
continue
|
2017-02-19 21:23:04 +02:00
|
|
|
component_dir = join(FRAMEWORK_DIR, "components", d)
|
|
|
|
|
if isdir(component_dir):
|
|
|
|
|
libs.append(build_component(component_dir))
|
|
|
|
|
|
|
|
|
|
|
2017-08-16 15:33:58 +03:00
|
|
|
# component.mk contains configuration for bootloader
|
2017-02-19 21:23:04 +02:00
|
|
|
libs.append(env.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "spi_flash"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "spi_flash"),
|
2017-08-16 15:33:58 +03:00
|
|
|
src_filter="+<*> -<test*>"
|
2017-02-19 21:23:04 +02:00
|
|
|
))
|
2016-10-24 20:23:25 +03:00
|
|
|
|
2017-08-16 15:33:58 +03:00
|
|
|
libs.append(env.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "app_trace"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "app_trace"),
|
|
|
|
|
src_filter="+<*> -<test> -<sys_view>"
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
libs.append(env.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "soc"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "soc"),
|
|
|
|
|
src_filter="+<*> -<test> -<esp32/test>"
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
envsafe = env.Clone()
|
2017-09-05 19:55:05 +03:00
|
|
|
envsafe.Prepend(
|
2017-08-16 15:33:58 +03:00
|
|
|
CPPDEFINES=[
|
|
|
|
|
"CONFIGURED", "NATIVE_LITTLE_ENDIAN", "HAVE_WEAK_SYMBOLS",
|
|
|
|
|
"__STDC_LIMIT_MACROS", "__STDC_CONSTANT_MACROS"
|
|
|
|
|
],
|
2017-09-05 19:55:05 +03:00
|
|
|
CCFLAGS=["-Wno-type-limits", "-Wno-unknown-pragmas"],
|
|
|
|
|
CPPPATH=[
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "libsodium", "port_include",
|
|
|
|
|
"sodium")
|
|
|
|
|
]
|
2017-08-16 15:33:58 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
libs.append(
|
|
|
|
|
envsafe.BuildLibrary(
|
|
|
|
|
join("$BUILD_DIR", "libsodium"),
|
|
|
|
|
join(FRAMEWORK_DIR, "components", "libsodium", "libsodium", "src",
|
|
|
|
|
"libsodium")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
2016-10-24 20:23:25 +03:00
|
|
|
env.Prepend(LIBS=libs)
|