Merge branch 'release/v2.11.0'

This commit is contained in:
Ivan Kravets
2016-06-28 18:04:20 +03:00
23 changed files with 423 additions and 101 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
docs/_build
dist
build
.cache

View File

@ -4,6 +4,22 @@ Release Notes
PlatformIO 2.0
--------------
2.11.0 (2016-06-28)
~~~~~~~~~~~~~~~~~~~
* New ESP8266-based boards: Generic ESP8285 Module, Phoenix 1.0 & 2.0, WifInfo
* Added support for Arduino M0 Pro board
(`issue #472 <https://github.com/platformio/platformio/issues/472>`_)
* Added support for Arduino MKR1000 board
(`issue #620 <https://github.com/platformio/platformio/issues/620>`_)
* Added support for Adafruit Feather M0, SparkFun SAMD21 and SparkFun SAMD21
Mini Breakout boards
(`issue #520 <https://github.com/platformio/platformio/issues/520>`_)
* Updated Arduino ESP8266 core for Espressif platform to 2.3.0
* Better removing unnecessary flags using ``build_unflags`` option
(`issue #698 <https://github.com/platformio/platformio/issues/698>`_)
* Fixed issue with ``platformio init --ide`` command for Python 2.6
2.10.3 (2016-06-15)
~~~~~~~~~~~~~~~~~~~

View File

@ -198,8 +198,9 @@ Contributing
6. Make changes to code, documentation, etc.
7. Lint source code ``tox -e lint``
8. Run the tests ``tox -e py27``
9. Commit changes to your forked repository
10. Submit a Pull Request on GitHub.
9. Build documentation ``tox -e docs`` (creates a directory _build under docs where you can find the html)
10. Commit changes to your forked repository
11. Submit a Pull Request on GitHub.
Licence
-------

View File

@ -23,6 +23,10 @@ Here are recent articles about PlatformIO:
2016
^^^^
* Jun 14, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 2/3: Firmware Continuous Test & Build <https://blog.openenergymonitor.org/2016/06/auto-build-continuous-test-firmware/>`_
* Jun 13, 2016 - **Daniel Eichhorn** - `New Weather Station Demo on Github <http://blog.squix.org/2016/06/new-weather-station-demo-on-github.html>`_
* Jun 12, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 1/3: PlatformIO open-source embedded development ecosystem <https://blog.openenergymonitor.org/2016/06/platformio/>`_
* Jun 12, 2016 - **Uli Wolf** - `Nutzung von PlatformIO im Atom Editor zur Entwicklung von Arduino Code (Use PlatformIO and Atom Editor to develop Arduino code, German) <https://wolf-u.li/5668/nutzung-von-platform-io-im-atom-editor-zur-entwicklung-von-arduino-code/>`_
* Jun 3, 2016 - **Daniel Eichhorn** - `ESP8266: Continuous Delivery Pipeline Push To Production <http://blog.squix.org/2016/06/esp8266-continuous-delivery-pipeline-push-to-production.html>`_
* May 30, 2016 - **Ron Moerman** - `IoT Development with PlatformIO <https://electronicsworkbench.io/blog/platformio>`_
* May 29, 2016 - **Chris Synan** - `Reverse Engineer RF Remote Controller for IoT! <http://www.instructables.com/id/Reverse-Engineer-RF-Remote-Controller-for-IoT/?ALLSTEPS>`_

View File

@ -1211,7 +1211,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -20,6 +20,9 @@ source code structure. The only one requirement is library's manifest file -
:ref:`library_config`. It can be located inside your library or in the another
location where |PIOAPICR| will have *HTTP* access.
Updates to existing libraries are done every 24 hours. In case a more urgent
update is required, you can post a request on PlatformIO `community <https://community.platformio.org/>`_.
.. contents::
Source Code Location
@ -152,6 +155,12 @@ to :ref:`install <cmd_lib_install>` it.
Examples
--------
Command:
.. code-block:: bash
$ platformio lib register http://my.example.com/library.json
* `GitHub + fixed release <http://platformio.org/lib/show/552/ACNoblex>`_
* `Dependencies by author and framework <http://platformio.org/lib/show/3/PID-AutoTune>`_
* `Multiple libraries in the one repository <https://github.com/jrowberg/i2cdevlib/tree/master/Arduino>`_

View File

@ -826,7 +826,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -1576,7 +1576,7 @@ OpenEnergyMonitor
- RAM
* - ``emonpi``
- `emonPi <https://github.com/openenergymonitor/emonpi>`_
- `OpenEnergyMonitor emonPi <https://github.com/openenergymonitor/emonpi>`_
- ATMEGA328P
- 16 MHz
- 32 Kb

View File

@ -240,6 +240,7 @@ Using Arduino Framework with Staging version
Articles
--------
* Jun 13, 2016 - **Daniel Eichhorn** - `New Weather Station Demo on Github <http://blog.squix.org/2016/06/new-weather-station-demo-on-github.html>`_
* Jun 3, 2016 - **Daniel Eichhorn** - `ESP8266: Continuous Delivery Pipeline Push To Production <http://blog.squix.org/2016/06/esp8266-continuous-delivery-pipeline-push-to-production.html>`_
* May 29, 2016 - **Chris Synan** - `Reverse Engineer RF Remote Controller for IoT! <http://www.instructables.com/id/Reverse-Engineer-RF-Remote-Controller-for-IoT/?ALLSTEPS>`_
* May 22, 2016 - **Pedro Minatel** - `Estação meteorológica com ESP8266 (Weather station with ESP8266, Portuguese) <http://pedrominatel.com.br/esp8266/estacao-meteorologica-com-esp8266/>`_

View File

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

View File

@ -248,5 +248,35 @@
},
"url": "http://www.adafruit.com/products/2000",
"vendor": "Adafruit"
},
"adafruit_feather_m0_usb": {
"build": {
"core": "arduino_zero",
"extra_flags": "-DARDUINO_SAMD_FEATHER_M0 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"mcu": "samd21g18a",
"cpu": "cortex-m0plus",
"usb_product": "Adafruit Feather M0",
"variant": "arduino_zero",
"ldscript": "flash_with_bootloader.ld",
"hwids": [
["0x239A", "0x800B"],
["0x239A", "0x000B"]
]
},
"frameworks": ["arduino"],
"name": "Adafruit Feather M0",
"platform": "atmelsam",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "sam-ba",
"require_upload_port" : true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.adafruit.com/product/2772",
"vendor": "Adafruit"
}
}

View File

@ -885,7 +885,7 @@
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "sam-ba",
"protocol": "openocd",
"require_upload_port" : false,
"use_1200bps_touch": false,
"wait_for_upload_port": false
@ -923,5 +923,68 @@
},
"url": "https://www.arduino.cc/en/Main/ArduinoBoardZero",
"vendor": "Arduino"
},
"mkr1000USB": {
"build": {
"core": "arduino_zero",
"extra_flags": "-DARDUINO_SAMD_MKR1000 -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"mcu": "samd21g18a",
"cpu": "cortex-m0plus",
"usb_product": "Arduino MKR1000",
"variant": "mkr1000",
"ldscript": "flash_with_bootloader.ld",
"hwids": [
["0x2341", "0x804E"],
["0x2341", "0x004E"],
["0x2341", "0x824E"],
["0x2341", "0x024E"]
]
},
"frameworks": ["arduino"],
"name": "Arduino MKR1000",
"platform": "atmelsam",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "sam-ba",
"require_upload_port" : true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.arduino.cc/en/Main/ArduinoMKR1000",
"vendor": "Arduino"
},
"mzeropro": {
"build": {
"core": "arduino_zero",
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"mcu": "samd21g18a",
"cpu": "cortex-m0plus",
"usb_product": "Arduino M0 Pro",
"variant": "arduino_zero",
"ldscript": "samd21g18a_bootloader_org.ld",
"hwids": [
["0x03EB", "0x2111"],
["0x2A03", "0x804F"]
]
},
"frameworks": ["arduino"],
"name": "Arduino M0 Pro (Programming Port)",
"platform": "atmelsam",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "openocd",
"require_upload_port" : false,
"use_1200bps_touch": false,
"wait_for_upload_port": false,
"section_start": "0x4000"
},
"url": "http://www.arduino.org/products/boards/arduino-m0-pro",
"vendor": "Arduino"
}
}

View File

@ -358,7 +358,7 @@
"d1": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
@ -383,7 +383,7 @@
"d1_mini": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_WEMOS_D1MINI",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
@ -478,5 +478,105 @@
},
"url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
"vendor": "Espressif"
},
"esp8285": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_ESP01",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dout",
"ldscript": "esp8266.flash.1m256.ld",
"mcu": "esp8266",
"variant": "generic"
},
"frameworks": ["arduino"],
"name": "Generic ESP8285 Module",
"platform": "espressif",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 434160,
"resetmethod": "ck",
"require_upload_port" : true,
"speed": 115200
},
"url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
"vendor": "Espressif"
},
"phoenix_v1": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_PHOENIX_V1",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "phoenix_v1"
},
"frameworks": ["arduino"],
"name": "Phoenix 1.0",
"platform": "espressif",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 1044464,
"resetmethod": "nodemcu",
"require_upload_port" : true,
"speed": 115200
},
"url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
"vendor": "Espressif"
},
"phoenix_v2": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DESP8266_PHOENIX_V2",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"ldscript": "esp8266.flash.4m1m.ld",
"mcu": "esp8266",
"variant": "phoenix_v2"
},
"frameworks": ["arduino"],
"name": "Phoenix 2.0",
"platform": "espressif",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 1044464,
"resetmethod": "ck",
"require_upload_port" : true,
"speed": 115200
},
"url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
"vendor": "Espressif"
},
"wifinfo": {
"build": {
"core": "esp8266",
"extra_flags": "-DESP8266 -DARDUINO_ARCH_ESP8266 -DWIFINFO",
"f_cpu": "80000000L",
"f_flash": "40000000L",
"flash_mode": "qio",
"ldscript": "esp8266.flash.1m256.ld",
"mcu": "esp8266",
"variant": "wifinfo"
},
"frameworks": ["arduino"],
"name": "WifInfo",
"platform": "espressif",
"upload": {
"maximum_ram_size": 81920,
"maximum_size": 434160,
"resetmethod": "nodemcu",
"require_upload_port" : true,
"speed": 115200
},
"url": "http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family",
"vendor": "Espressif"
}
}

View File

@ -52,7 +52,7 @@
"variant": "standard"
},
"frameworks": ["arduino"],
"name": "emonPi",
"name": "OpenEnergyMonitor emonPi",
"platform": "atmelavr",
"upload": {
"maximum_ram_size": 2048,

View File

@ -238,5 +238,67 @@
},
"url": "https://www.sparkfun.com/products/12923",
"vendor": "SparkFun"
},
"sparkfun_samd21_dev_usb": {
"build": {
"core": "arduino_zero",
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"mcu": "samd21g18a",
"cpu": "cortex-m0plus",
"usb_product": "SparkFun SAMD21",
"variant": "arduino_zero",
"ldscript": "flash_with_bootloader.ld",
"hwids": [
["0x1B4F", "0x8D21"],
["0x1B4F", "0x0D21"]
]
},
"frameworks": ["arduino"],
"name": "SparkFun SAMD21 Dev Breakout",
"platform": "atmelsam",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "sam-ba",
"require_upload_port" : true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.sparkfun.com/products/13672",
"vendor": "SparkFun"
},
"sparkfun_samd21_mini_usb": {
"build": {
"core": "arduino_zero",
"extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__",
"f_cpu": "48000000L",
"mcu": "samd21g18a",
"cpu": "cortex-m0plus",
"usb_product": "SparkFun SAMD21",
"variant": "SparkFun_SAMD_Mini",
"ldscript": "flash_with_bootloader.ld",
"hwids": [
["0x1B4F", "0x8D21"],
["0x1B4F", "0x0D21"]
]
},
"frameworks": ["arduino"],
"name": "SparkFun SAMD21 Mini Breakout",
"platform": "atmelsam",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 32768,
"maximum_size": 262144,
"protocol": "sam-ba",
"require_upload_port" : true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.sparkfun.com/products/13664",
"vendor": "SparkFun"
}
}
}

View File

@ -25,14 +25,6 @@ from platformio.util import get_serialports
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
board_type = env.subst("$BOARD")
if "zero" not in board_type:
env.Append(
UPLOADERFLAGS=[
"-U",
"true" if ("usb" in board_type.lower(
) or board_type == "digix") else "false"
])
upload_options = env.get("BOARD_OPTIONS", {}).get("upload", {})
@ -48,7 +40,8 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))
# use only port name for BOSSA
if "/" in env.subst("$UPLOAD_PORT"):
if ("/" in env.subst("$UPLOAD_PORT") and
env.subst("$UPLOAD_PROTOCOL") == "sam-ba"):
env.Replace(UPLOAD_PORT=basename(env.subst("$UPLOAD_PORT")))
@ -56,41 +49,8 @@ env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
if env.subst("$BOARD") == "zero":
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-openocd", "bin", "openocd"),
UPLOADERFLAGS=[
"-d2",
"-s",
join(
"$PIOPACKAGES_DIR",
"tool-openocd", "share", "openocd", "scripts"),
"-f",
join(
"$PLATFORMFW_DIR", "variants",
"${BOARD_OPTIONS['build']['variant']}", "openocd_scripts",
"${BOARD_OPTIONS['build']['variant']}.cfg"
),
"-c", "\"telnet_port", "disabled;",
"program", "{{$SOURCES}}",
"verify", "reset", "0x00002000;", "shutdown\""
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
)
else:
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
UPLOADERFLAGS=[
"--info",
"--port", '"$UPLOAD_PORT"',
"--erase",
"--write",
"--verify",
"--reset",
"--debug"
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
)
BOARD_OPTIONS = env.get("BOARD_OPTIONS", {})
env.Append(
@ -120,8 +80,21 @@ env.Append(
]
)
user_code_section = BOARD_OPTIONS.get("upload", {}).get("section_start", False)
if "sam3x8e" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
if user_code_section:
env.Append(
CPPDEFINES=[
"printf=iprintf"
],
LINKFLAGS=[
"-Wl,--entry=Reset_Handler",
"-Wl,--section-start=.text=%s" % user_code_section
]
)
if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""):
env.Append(
CPPDEFINES=[
"printf=iprintf"
@ -137,7 +110,7 @@ if "sam3x8e" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("mcu", None):
]
)
elif "zero" in env.subst("$BOARD"):
elif "samd" in BOARD_OPTIONS.get("build", {}).get("mcu", ""):
env.Append(
LINKFLAGS=[
"--specs=nosys.specs",
@ -145,6 +118,62 @@ elif "zero" in env.subst("$BOARD"):
]
)
upload_protocol = BOARD_OPTIONS.get("upload", {}).get("protocol", None)
if upload_protocol == "openocd":
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "tool-openocd", "bin", "openocd"),
UPLOADERFLAGS=[
"-d2",
"-s", join(
"$PIOPACKAGES_DIR",
"tool-openocd",
"share",
"openocd",
"scripts"
),
"-f", join(
"$PLATFORMFW_DIR",
"variants",
"${BOARD_OPTIONS['build']['variant']}",
"openocd_scripts",
"${BOARD_OPTIONS['build']['variant']}.cfg"
),
"-c", "\"telnet_port", "disabled;",
"program", "{{$SOURCES}}",
"verify", "reset",
"%s;" % user_code_section if user_code_section else "0x2000",
"shutdown\""
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS'
)
elif upload_protocol == "sam-ba":
board_type = env.subst("$BOARD")
env.Replace(
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
UPLOADERFLAGS=[
"--info",
"--port", '"$UPLOAD_PORT"',
"--erase",
"--write",
"--verify",
"--reset",
"--debug",
"-U",
"true" if ("usb" in board_type.lower(
) or board_type == "digix") else "false"
],
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
)
#
# Target: Build executable and linkable firmware
#
@ -171,7 +200,7 @@ AlwaysBuild(target_size)
# Target: Upload by default .bin file
#
if env.subst("$BOARD") == "zero":
if upload_protocol == "openocd":
upload = env.Alias(["upload", "uploadlazy"], target_firm, "$UPLOADCMD")
else:
upload = env.Alias(

View File

@ -82,8 +82,7 @@ env.Replace(
"-falign-functions=4",
"-U__STRICT_ANSI__",
"-ffunction-sections",
"-fdata-sections",
"-MMD" # output dependancy info
"-fdata-sections"
],
CXXFLAGS=[

View File

@ -60,8 +60,11 @@ elif env.get("PLATFORM") == "espressif":
join("$PLATFORMFW_DIR", "tools", "sdk", "lwip", "include")
],
LIBPATH=[join("$PLATFORMFW_DIR", "tools", "sdk", "lib")],
LIBS=["mesh", "wpa2", "smartconfig", "pp", "main", "wpa", "lwip",
"net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", "m"]
LIBS=[
"mesh", "wpa2", "smartconfig", "pp", "main", "wpa", "lwip",
"net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc",
"m", "stdc++"
]
)
env.VariantDirWrap(
join("$BUILD_DIR", "generic"),

View File

@ -163,7 +163,7 @@ def add_mbedlib(libname, libar):
continue
if "TARGET_" in root:
if all([p not in root.upper() for p in target_includes]):
if all([p not in root for p in target_includes]):
continue
var_dir = join("$BUILD_DIR", "FrameworkMbed%sInc%d" %
@ -264,13 +264,12 @@ env.Replace(
)
# restore external build flags
env.ProcessFlags([
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
])
env.ProcessFlags(
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"))
# remove base flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
# apply user flags
env.ProcessFlags([env.get("BUILD_FLAGS")])
env.ProcessFlags(env.get("BUILD_FLAGS"))
# Hook for K64F and K22F
if board_type in ("frdm_k22f", "frdm_k64f"):

View File

@ -122,8 +122,8 @@ def ConvertInoToCpp(env):
remove(file_)
except: # pylint: disable=bare-except
if isfile(file_):
print ("Warning: Could not remove temporary file '%s'. "
"Please remove it manually." % file_)
print("Warning: Could not remove temporary file '%s'. "
"Please remove it manually." % file_)
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
@ -202,9 +202,7 @@ def DumpIDEData(env):
def get_defines(env_):
defines = []
# global symbols
for item in env_.get("CPPDEFINES", []):
if isinstance(item, list):
item = "=".join(item)
for item in env.Flatten(env_.get("CPPDEFINES", [])):
defines.append(env_.subst(item).replace('\\"', '"'))
# special symbol for Atmel AVR MCU
@ -232,9 +230,7 @@ def DumpIDEData(env):
# https://github.com/platformio/platformio-atom-ide/issues/34
_new_defines = []
for item in env_.get("CPPDEFINES", []):
if isinstance(item, list):
item = "=".join(item)
for item in env.Flatten(env_.get("CPPDEFINES", [])):
item = item.replace('\\"', '"')
if " " in item:
_new_defines.append(item.replace(" ", "\\\\ "))

View File

@ -36,12 +36,9 @@ SRC_DEFAULT_FILTER = " ".join([
def BuildProgram(env):
def _append_pio_macros():
if any(["PLATFORMIO=" in str(d) for d in env.get("CPPDEFINES", [])]):
return
env.Append(
env.AppendUnique(
CPPDEFINES=["PLATFORMIO={0:02d}{1:02d}{2:02d}".format(
*pioversion_to_intstr())],
)
*pioversion_to_intstr())])
_append_pio_macros()
@ -53,13 +50,12 @@ def BuildProgram(env):
)
# process extra flags from board
env.ProcessFlags([
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
])
env.ProcessFlags(
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"))
# remove base flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
# apply user flags
env.ProcessFlags([env.get("BUILD_FLAGS")])
env.ProcessFlags(env.get("BUILD_FLAGS"))
if env.get("FRAMEWORK"):
env.BuildFrameworks([
@ -88,7 +84,7 @@ def BuildProgram(env):
)
# Handle SRC_BUILD_FLAGS
env.ProcessFlags([env.get("SRC_BUILD_FLAGS", None)])
env.ProcessFlags(env.get("SRC_BUILD_FLAGS"))
env.Append(
CPPPATH=["$PROJECTSRC_DIR"],
@ -117,18 +113,17 @@ def BuildProgram(env):
def ProcessFlags(env, flags):
for f in flags:
if not f:
if not flags:
return
parsed_flags = env.ParseFlags(str(flags))
for flag in parsed_flags.pop("CPPDEFINES"):
if not isinstance(flag, list):
env.Append(CPPDEFINES=flag)
continue
parsed_flags = env.ParseFlags(str(f))
for flag in parsed_flags.pop("CPPDEFINES"):
if not isinstance(flag, list):
env.Append(CPPDEFINES=flag)
continue
if '\"' in flag[1]:
flag[1] = flag[1].replace('\"', '\\\"')
env.Append(CPPDEFINES=[flag])
env.Append(**parsed_flags)
if '\"' in flag[1]:
flag[1] = flag[1].replace('\"', '\\\"')
env.Append(CPPDEFINES=[flag])
env.Append(**parsed_flags)
# fix relative CPPPATH & LIBPATH
for k in ("CPPPATH", "LIBPATH"):
@ -153,10 +148,17 @@ def ProcessFlags(env, flags):
def ProcessUnFlags(env, flags):
if not flags:
return
for var, values in env.ParseFlags(flags).items():
for v in values:
if v in env[var]:
env[var].remove(v)
parsed_flags = env.ParseFlags(flags)
all_flags = []
for items in parsed_flags.values():
all_flags.extend(items)
all_flags = set(all_flags)
for key in parsed_flags.keys():
cur_flags = set(env.get(key, []))
for item in cur_flags & all_flags:
while item in env[key]:
env[key].remove(item)
def IsFileWithExt(env, file_, ext): # pylint: disable=W0613

View File

@ -52,6 +52,8 @@ def cli():
r = None
try:
for cmd in cmds:
if sys.version_info < (2, 7, 0):
cmd[0] += ".__main__"
cmd = [os.path.normpath(sys.executable), "-m"] + cmd
r = None
r = util.exec_command(cmd)

View File

@ -66,7 +66,12 @@ class ProjectGenerator(object):
envdata = self.get_project_env()
if "env_name" not in envdata:
return data
cmd = [normpath(sys.executable), "-m", "platformio", "-f"]
cmd = [
normpath(sys.executable), "-m",
"platformio" + (
".__main__" if sys.version_info < (2, 7, 0) else ""),
"-f"
]
if app.get_session_var("caller_id"):
cmd.extend(["-c", app.get_session_var("caller_id")])
cmd.extend(["run", "-t", "idedata", "-e", envdata['env_name']])