Skip to content

Commit

Permalink
Merge branch 'release/v1.12.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jun 11, 2020
2 parents f23e08e + 9e48b6b commit f8d59ee
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Examples

on: [push]
on: [push, pull_request]

jobs:
build:
Expand Down
38 changes: 38 additions & 0 deletions builder/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2014-present PlatformIO <[email protected]>
#
# 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.

from SCons.Script import AlwaysBuild, Import


Import("env")


# Added in PIO Core 4.4.0
if not hasattr(env, "AddPlatformTarget"):

def AddPlatformTarget(
env,
name,
dependencies,
actions,
title=None,
description=None,
always_build=True,
):
target = env.Alias(name, dependencies, actions)
if always_build:
AlwaysBuild(target)
return target

env.AddMethod(AddPlatformTarget)
35 changes: 23 additions & 12 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __fetch_spiffs_size(target, source, env):


env = DefaultEnvironment()
env.SConscript("compat.py", exports="env")
platform = env.PioPlatform()
board = env.BoardConfig()
mcu = board.get("build.mcu", "esp32")
Expand Down Expand Up @@ -210,7 +211,7 @@ def __fetch_spiffs_size(target, source, env):
# Target: Build executable and linkable firmware or SPIFFS image
#

target_elf = env.BuildProgram()
target_elf = None
if "nobuild" in COMMAND_LINE_TARGETS:
target_elf = join("$BUILD_DIR", "${PROGNAME}.elf")
if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
Expand All @@ -219,15 +220,16 @@ def __fetch_spiffs_size(target, source, env):
else:
target_firm = join("$BUILD_DIR", "${PROGNAME}.bin")
else:
target_elf = env.BuildProgram()
if set(["buildfs", "uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
target_firm = env.DataToBin(
join("$BUILD_DIR", "${ESP32_SPIFFS_IMAGE_NAME}"), "$PROJECTDATA_DIR")
AlwaysBuild(target_firm)
AlwaysBuild(env.Alias("buildfs", target_firm))
else:
target_firm = env.ElfToBin(
join("$BUILD_DIR", "${PROGNAME}"), target_elf)

env.AddPlatformTarget("buildfs", target_firm, None, "Build Filesystem Image")
AlwaysBuild(env.Alias("nobuild", target_firm))
target_buildprog = env.Alias("buildprog", target_firm, target_firm)

Expand All @@ -246,10 +248,13 @@ def __fetch_spiffs_size(target, source, env):
# Target: Print binary size
#

target_size = env.Alias("size", target_elf,
env.VerboseAction("$SIZEPRINTCMD",
"Calculating size $SOURCE"))
AlwaysBuild(target_size)
target_size = env.AddPlatformTarget(
"size",
target_elf,
env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"),
"Program Size",
"Calculate program size",
)

#
# Target: Upload firmware or SPIFFS image
Expand Down Expand Up @@ -394,18 +399,24 @@ def __fetch_spiffs_size(target, source, env):
else:
sys.stderr.write("Warning! Unknown upload protocol %s\n" % upload_protocol)

AlwaysBuild(env.Alias(["upload", "uploadfs"], target_firm, upload_actions))
env.AddPlatformTarget("upload", target_firm, upload_actions, "Upload")
env.AddPlatformTarget("uploadfs", target_firm, upload_actions, "Upload Filesystem Image")
env.AddPlatformTarget(
"uploadfsota", target_firm, upload_actions, "Upload Filesystem Image OTA")

#
# Target: Erase Flash
#

AlwaysBuild(
env.Alias("erase", None, [
env.VerboseAction(env.AutodetectUploadPort,
"Looking for serial port..."),
env.AddPlatformTarget(
"erase",
None,
[
env.VerboseAction(env.AutodetectUploadPort, "Looking for serial port..."),
env.VerboseAction("$ERASECMD", "Erasing...")
]))
],
"Erase Flash",
)

#
# Information about obsolete method of specifying linker scripts
Expand Down
2 changes: 1 addition & 1 deletion platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-espressif32.git"
},
"version": "1.12.2",
"version": "1.12.3",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json",
Expand Down

0 comments on commit f8d59ee

Please sign in to comment.