Allow to upload SPIFFS image using OTA // Issue #382

This commit is contained in:
Ivan Kravets
2015-12-30 14:14:36 +02:00
parent 2d2ce0661f
commit 044486d46f
3 changed files with 24 additions and 23 deletions

View File

@ -65,10 +65,17 @@ Uploading files to file system SPIFFS
1. Create :ref:`projectconf_pio_data_dir` and put files here
2. Run target ``uploadfs`` via :option:`platformio run --target` command.
To upload SPIFFS image using OTA update please specify ``upload_port`` /
``--upload-port`` as IP address. For the details please follow to
:ref:`platform_espressif_ota`. For example, ``platformio run -t uploadfs
--upload_port 192.168.0.255``.
By default, will be used default LD Script for the board where is specified
SPIFFS offsets (start, end, page, block). You can override it using
:ref:`platform_espressif_customflash`.
.. _platform_espressif_ota:
Over-the-Air (OTA) update
-------------------------

View File

@ -14,7 +14,7 @@
import sys
VERSION = (2, 7, "0.dev8")
VERSION = (2, 7, "0.dev9")
__version__ = ".".join([str(s) for s in VERSION])
__title__ = "platformio"

View File

@ -113,11 +113,6 @@ env.Replace(
"-cb", "$UPLOAD_SPEED",
"-cp", "$UPLOAD_PORT"
],
UPLOADERFSFLAGS=[
"$UPLOADERFLAGS",
"$UPLOAD_FLAGS",
"-ca", "$SPIFFS_START"
],
UPLOADEROTAFLAGS=[
"--debug",
"--progress",
@ -126,7 +121,6 @@ env.Replace(
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -cf $SOURCE',
UPLOADFSCMD='"$UPLOADER" $UPLOADERFSFLAGS -cf $SOURCE',
UPLOADOTACMD='"$UPLOADEROTA" $UPLOADEROTAFLAGS -f $SOURCE',
#
@ -217,6 +211,13 @@ env.Append(
)
)
if "uploadfs" in COMMAND_LINE_TARGETS:
env.Append(
UPLOADERFLAGS=[
"-ca", "$SPIFFS_START"
]
)
#
# Framework and SDK specific configuration
#
@ -291,10 +292,15 @@ else:
target_elf = env.BuildProgram()
#
# Target: Build the .hex
# Target: Build the .hex or SPIFFS image
#
if "uploadlazy" in COMMAND_LINE_TARGETS:
if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
target_firm = env.DataToBin(
join("$BUILD_DIR", "spiffs"), "$PROJECTDATA_DIR")
AlwaysBuild(target_firm)
elif "uploadlazy" in COMMAND_LINE_TARGETS:
if "FRAMEWORK" not in env:
target_firm = [
join("$BUILD_DIR", "firmware_00000.bin"),
@ -318,26 +324,14 @@ target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
AlwaysBuild(target_size)
#
# Target: Upload firmware
# Target: Upload firmware or SPIFFS image
#
target_upload = env.Alias(
["upload", "uploadlazy"], target_firm,
["upload", "uploadlazy", "uploadfs"], target_firm,
[lambda target, source, env: env.AutodetectUploadPort(), "$UPLOADCMD"])
env.AlwaysBuild(target_upload)
#
# Target: Upload SPIFFS image
#
target_mkspiffs = None
if "uploadfs" in COMMAND_LINE_TARGETS:
target_mkspiffs = env.DataToBin(join("$BUILD_DIR", "spiffs_image"),
"$PROJECTDATA_DIR")
target_uploadfs = env.Alias(
"uploadfs", target_mkspiffs,
[lambda target, source, env: env.AutodetectUploadPort(), "$UPLOADFSCMD"])
env.AlwaysBuild(target_mkspiffs, target_uploadfs)
#
# Target: Define targets