Merge branch 'release/v0.1.1'

This commit is contained in:
Ivan Kravets
2016-11-21 12:44:59 +02:00
5 changed files with 95 additions and 86 deletions
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_ESP32_DEV",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "esp32"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "SparkFun ESP32 Thing",
"upload": {
"maximum_ram_size": 114688,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "https://www.sparkfun.com/products/13907",
"vendor": "SparkFun Electronics"
}
+1 -3
View File
@@ -30,13 +30,11 @@ env = DefaultEnvironment()
platform = env.PioPlatform()
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
FRAMEWORK_VERSION = platform.get_package_version(
"framework-arduinoespressif32")
assert isdir(FRAMEWORK_DIR)
env.Prepend(
CPPDEFINES=[
"ARDUINO=%s" % FRAMEWORK_VERSION.split(".")[1],
"ARDUINO=10600",
"ARDUINO_ARCH_ESP32"
],
+66 -34
View File
@@ -37,42 +37,47 @@ FRAMEWORK_VERSION = platform.get_package_version(
assert isdir(FRAMEWORK_DIR)
def generate_ld_script():
if not isdir(env.subst("$BUILD_DIR")):
makedirs(env.subst("$BUILD_DIR"))
result = exec_command([
join(platform.get_package_dir("toolchain-xtensa32")
or "", "bin", env.subst("$CC")),
"-I", env.subst("$PROJECTSRC_DIR"),
"-C", "-P", "-x", "c", "-E",
join(env.subst("$ESPIDF_DIR"), "components",
"esp32", "ld", "esp32.ld"),
"-o", join(env.subst("$BUILD_DIR"), "esp32_out.ld")
])
def build_espidf_bootloader():
envsafe = env.Clone()
framework_dir = env.subst("$ESPIDF_DIR")
envsafe.Replace(
CPPDEFINES=["ESP_PLATFORM", "BOOTLOADER_BUILD=1"],
if result['returncode'] != 0:
sys.stderr.write(
"Cannot create linker script! %s" % result['err'])
env.Exit(1)
LIBPATH=[
join(framework_dir, "components", "esp32", "ld"),
join(framework_dir, "components", "bootloader", "src", "main")
],
LINKFLAGS=[
"-Os",
"-nostdlib",
"-Wl,-static",
"-u", "call_user_start_cpu0",
"-Wl,-static",
"-Wl,--gc-sections",
"-T", "esp32.bootloader.ld",
"-T", "esp32.rom.ld"
]
),
def generate_ptable():
if not isdir(env.subst("$BUILD_DIR")):
makedirs(env.subst("$BUILD_DIR"))
envsafe.Append(CCFLAGS=["-fstrict-volatile-bitfields"])
result = exec_command([
env.subst("$PYTHONEXE"),
join(env.subst("$ESPIDF_DIR"), "components",
"partition_table", "gen_esp32part.py"),
"-q", join(env.subst("$ESPIDF_DIR"), "components",
"partition_table", "partitions_singleapp.csv"),
join(env.subst("$BUILD_DIR"), "partitions_table.bin"),
])
envsafe.Replace(
LIBS=[
envsafe.BuildLibrary(
join("$BUILD_DIR", "bootloaderLog"),
join(framework_dir, "components", "log")
), "gcc"
]
)
if result['returncode'] != 0:
sys.stderr.write(
"Cannot create partition table! %s" % result['err'])
env.Exit(1)
return envsafe.Program(
join("$BUILD_DIR", "bootloader.elf"),
envsafe.CollectBuildFiles(
join("$BUILD_DIR", "bootloader"),
join(framework_dir, "components", "bootloader", "src", "main")
)
)
env.Prepend(
CPPPATH=[
@@ -128,11 +133,38 @@ env.Append(
)
#
# Generate a specific linker script
# Generate partition table
#
generate_ld_script()
generate_ptable()
partition_table = env.Command(
join(env.subst("$BUILD_DIR"), "partitions_table.bin"),
join("$ESPIDF_DIR", "components",
"partition_table", "partitions_singleapp.csv"),
'"$PYTHONEXE" %s -q $SOURCE $TARGET' % join(
"$ESPIDF_DIR", "components", "partition_table", "gen_esp32part.py")
)
env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", partition_table)
#
# Generate linker script
#
linker_script = env.Command(
join("$BUILD_DIR", "esp32_out.ld"),
join("$ESPIDF_DIR", "components", "esp32", "ld", "esp32.ld"),
"$CC -I$PROJECTSRC_DIR -C -P -x c -E $SOURCE -o $TARGET"
)
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()))
#
# Target: Build Core Library
-48
View File
@@ -23,49 +23,6 @@ def _get_board_f_flash(env):
return str(int(int(frequency) / 1000000)) + "m"
def build_espidf_bootloader():
envsafe = env.Clone()
framework_dir = env.subst("$ESPIDF_DIR")
envsafe.Replace(
CPPDEFINES=["ESP_PLATFORM", "BOOTLOADER_BUILD=1"],
LIBPATH=[
join(framework_dir, "components", "esp32", "ld"),
join(framework_dir, "components", "bootloader", "src", "main")
],
LINKFLAGS=[
"-Os",
"-nostdlib",
"-Wl,-static",
"-u", "call_user_start_cpu0",
"-Wl,-static",
"-Wl,--gc-sections",
"-T", "esp32.bootloader.ld",
"-T", "esp32.rom.ld"
]
),
envsafe.Append(CCFLAGS=["-fstrict-volatile-bitfields"])
envsafe.Replace(
LIBS=[
envsafe.BuildLibrary(
join("$BUILD_DIR", "bootloaderLog"),
join(framework_dir, "components", "log")
), "gcc"
]
)
return envsafe.Program(
join("$BUILD_DIR", "bootloader.elf"),
envsafe.CollectBuildFiles(
join("$BUILD_DIR", "bootloader"),
join(framework_dir, "components", "bootloader", "src", "main")
)
)
env = DefaultEnvironment()
platform = env.PioPlatform()
@@ -214,11 +171,6 @@ target_elf = env.BuildProgram()
if "PIOFRAMEWORK" in env:
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
if "espidf" in env.subst("$PIOFRAMEWORK"):
target_boot = env.ElfToBin(
join("$BUILD_DIR", "bootloader"), build_espidf_bootloader())
env.Depends(target_firm, target_boot)
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
+1 -1
View File
@@ -13,7 +13,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-espressif32.git"
},
"version": "0.1.0",
"version": "0.1.1",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download",