From cb6d433e1501021936f838b9f8823d83b4633d4b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 31 Jul 2015 14:21:30 +0300 Subject: [PATCH 01/86] Add Facebook page --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index b18d99bf..09b2caa0 100644 --- a/README.rst +++ b/README.rst @@ -33,6 +33,7 @@ PlatformIO `Project Examples `_ | `Blog `_ | `Reddit `_ | +`Facebook `_ | `Twitter `_ .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png From edcad9c2518279039d62528e0a811cd8a5ba22cf Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 31 Jul 2015 14:22:46 +0300 Subject: [PATCH 02/86] Add link to Facebook page --- docs/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.rst b/docs/index.rst index a0d4a37c..25ef8d5c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,6 +19,7 @@ libOpenCM3, etc.* `Issues `_ * `Blog `_ | `Reddit `_ | + `Facebook `_ | `Twitter `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* From 86e39f9b4408c330d760bc7db827d968b39bd3ff Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Aug 2015 17:30:20 +0300 Subject: [PATCH 03/86] More explanations about run --targets --- docs/projectconf.rst | 10 ++-------- docs/userguide/cmd_run.rst | 11 ++++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 34c0feeb..53656704 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -435,14 +435,8 @@ See built-in examples of `PlatformIO build scripts Date: Sat, 1 Aug 2015 17:39:15 +0300 Subject: [PATCH 04/86] Use cyclic linker options just for gcc-based compilers --- platformio/__init__.py | 2 +- platformio/builder/tools/piomisc.py | 17 +++++++++++++++++ platformio/builder/tools/platformio.py | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 48b1e7d2..f5191be8 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 2, 2) +VERSION = (2, 3, "0.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 851b1f97..a1324ab4 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -7,6 +7,8 @@ from glob import glob from os import remove from os.path import basename, join +from platformio.util import exec_command + class InoToCPPConverter(object): @@ -157,6 +159,20 @@ def DumpIDEData(env): return data +def getCompilerType(env): + try: + result = exec_command([env.subst("$CC"), "-v"], env=env['ENV']) + except OSError: + return None + if result['returncode'] != 0: + return None + output = "".join([result['out'], result['err']]).lower() + for type_ in ("clang", "gcc"): + if type_ in output: + return type_ + return None + + def exists(_): return True @@ -164,4 +180,5 @@ def exists(_): def generate(env): env.AddMethod(ConvertInoToCpp) env.AddMethod(DumpIDEData) + env.AddMethod(getCompilerType) return env diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index a2c9746a..07fd4e45 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -43,7 +43,7 @@ def BuildFirmware(env): ) # enable "cyclic reference" for linker - if env.get("LIBS", deplibs): + if env.get("LIBS", deplibs) and env.getCompilerType() == "gcc": env.Prepend( _LIBFLAGS="-Wl,--start-group " ) From e102fb2880b187682eabe0a9e895a4261b504d75 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Aug 2015 17:41:05 +0300 Subject: [PATCH 05/86] Allow PROGNAME & PROGSUFFIX to be configurable within platform --- platformio/builder/scripts/basearm.py | 5 ++++- platformio/builder/scripts/baseavr.py | 5 ++++- platformio/builder/scripts/espressif.py | 5 ++++- platformio/builder/scripts/timsp430.py | 5 ++++- platformio/builder/tools/platformio.py | 5 ++--- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py index 33114dca..cb685caf 100644 --- a/platformio/builder/scripts/basearm.py +++ b/platformio/builder/scripts/basearm.py @@ -52,7 +52,10 @@ env.Replace( LIBS=["c", "gcc", "m"], - SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES' + SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/scripts/baseavr.py b/platformio/builder/scripts/baseavr.py index 3ac52b00..7566bcc4 100644 --- a/platformio/builder/scripts/baseavr.py +++ b/platformio/builder/scripts/baseavr.py @@ -49,7 +49,10 @@ env.Replace( LIBS=["m"], - SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES' + SIZEPRINTCMD='"$SIZETOOL" --mcu=$BOARD_MCU -C -d $SOURCES', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index 3875dd15..fa035f6d 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -80,7 +80,10 @@ env.Replace( "-ca", "0x40000" if "FRAMEWORK" not in env else "0x10000", "-cf", "${SOURCES[1]}" ], - UPLOADCMD='$UPLOADER $UPLOADERFLAGS' + UPLOADCMD='$UPLOADER $UPLOADERFLAGS', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index 90507539..c928b357 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -57,7 +57,10 @@ env.Replace( "$UPLOAD_PROTOCOL" if system() != "Windows" else "tilib", "--force-reset" ], - UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"' + UPLOADCMD='$UPLOADER $UPLOADERFLAGS "prog $SOURCES"', + + PROGNAME="firmware", + PROGSUFFIX=".elf" ) env.Append( diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 07fd4e45..be537d7d 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -63,14 +63,13 @@ def BuildFirmware(env): ) return env.Program( - join("$BUILD_DIR", "firmware"), + join("$BUILD_DIR", env.subst("$PROGNAME")), env.LookupSources( "$BUILDSRC_DIR", "$PROJECTSRC_DIR", duplicate=False, src_filter=getenv("PLATFORMIO_SRC_FILTER", env.get("SRC_FILTER", None))), LIBS=env.get("LIBS", []) + deplibs, - LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"], - PROGSUFFIX=".elf" + LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"] ) From ce82b14f6b56c86eaa18d336fe00cb39245b413a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 1 Aug 2015 18:33:41 +0300 Subject: [PATCH 06/86] Fix sys env for Windows --- platformio/builder/tools/piomisc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index a1324ab4..4721884e 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -4,7 +4,7 @@ import atexit import re from glob import glob -from os import remove +from os import environ, remove from os.path import basename, join from platformio.util import exec_command @@ -161,7 +161,9 @@ def DumpIDEData(env): def getCompilerType(env): try: - result = exec_command([env.subst("$CC"), "-v"], env=env['ENV']) + sysenv = environ.copy() + sysenv['PATH'] = str(env['ENV']['PATH']) + result = exec_command([env.subst("$CC"), "-v"], env=sysenv) except OSError: return None if result['returncode'] != 0: From 75edcef0990046504213f553b6353966740c6dcb Mon Sep 17 00:00:00 2001 From: Benjamin Kudria Date: Tue, 28 Jul 2015 00:55:46 -0700 Subject: [PATCH 07/86] Adafruit Gemma support --- platformio/boards/adafruit.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/platformio/boards/adafruit.json b/platformio/boards/adafruit.json index 38ff5b4a..6e81d2f7 100644 --- a/platformio/boards/adafruit.json +++ b/platformio/boards/adafruit.json @@ -47,6 +47,26 @@ "vendor": "Adafruit" }, + "gemma": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_GEMMA", + "f_cpu": "8000000L", + "mcu": "attiny85", + "variant": "gemma" + }, + "frameworks": ["arduino"], + "name": "Adafruit Gemma", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 512, + "maximum_size": 8192, + "protocol": "usbtiny" + }, + "url": "http://www.adafruit.com/products/1222", + "vendor": "Adafruit" + }, + "trinket5": { "build": { "core": "arduino", From 0d196ef7b77ab364bc7dbb5730acda0207b8d8ac Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 2 Aug 2015 19:52:37 +0300 Subject: [PATCH 08/86] Rename env.BuildFirmware to env.BuildProgram --- docs/platforms/creating_platform.rst | 6 +++--- platformio/builder/scripts/atmelavr.py | 2 +- platformio/builder/scripts/atmelsam.py | 2 +- platformio/builder/scripts/espressif.py | 2 +- platformio/builder/scripts/freescalekinetis.py | 2 +- platformio/builder/scripts/nordicnrf51.py | 2 +- platformio/builder/scripts/nxplpc.py | 2 +- platformio/builder/scripts/siliconlabsefm32.py | 2 +- platformio/builder/scripts/ststm32.py | 2 +- platformio/builder/scripts/teensy.py | 2 +- platformio/builder/scripts/timsp430.py | 2 +- platformio/builder/scripts/titiva.py | 2 +- platformio/builder/tools/piomisc.py | 4 ++-- platformio/builder/tools/platformio.py | 6 +++--- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index dfbd0bdc..7e1199cb 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -200,7 +200,7 @@ Build Script Platform's build script is based on a next-generation build tool named `SCons `_. PlatformIO has own built-in firmware builder -``env.BuildFirmware`` with the nested libraries search. Please look into a +``env.BuildProgram`` with the nested libraries search. Please look into a base template of ``test-builder.py``. .. code-block:: python @@ -260,7 +260,7 @@ base template of ``test-builder.py``. # # Target: Build executable and linkable firmware # - target_elf = env.BuildFirmware() + target_elf = env.BuildProgram() # # Target: Build the .bin file @@ -383,7 +383,7 @@ and copy there two files: # Target: Build executable and linkable firmware # - target_elf = env.BuildFirmware() + target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/atmelavr.py b/platformio/builder/scripts/atmelavr.py index 1027b6a4..6bdc2b62 100644 --- a/platformio/builder/scripts/atmelavr.py +++ b/platformio/builder/scripts/atmelavr.py @@ -95,7 +95,7 @@ else: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Extract EEPROM data (from EEMEM directive) to .eep file diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py index 083f4136..00d0fa78 100644 --- a/platformio/builder/scripts/atmelsam.py +++ b/platformio/builder/scripts/atmelsam.py @@ -77,7 +77,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py index fa035f6d..09c7196b 100644 --- a/platformio/builder/scripts/espressif.py +++ b/platformio/builder/scripts/espressif.py @@ -132,7 +132,7 @@ if "FRAMEWORK" not in env: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .hex diff --git a/platformio/builder/scripts/freescalekinetis.py b/platformio/builder/scripts/freescalekinetis.py index c80d7134..0f23c8f6 100644 --- a/platformio/builder/scripts/freescalekinetis.py +++ b/platformio/builder/scripts/freescalekinetis.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py index 15e67cc2..caed2f55 100644 --- a/platformio/builder/scripts/nordicnrf51.py +++ b/platformio/builder/scripts/nordicnrf51.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/nxplpc.py b/platformio/builder/scripts/nxplpc.py index 39b9dfd9..9585eb5a 100644 --- a/platformio/builder/scripts/nxplpc.py +++ b/platformio/builder/scripts/nxplpc.py @@ -27,7 +27,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/siliconlabsefm32.py b/platformio/builder/scripts/siliconlabsefm32.py index 29692f6f..1fd710b9 100644 --- a/platformio/builder/scripts/siliconlabsefm32.py +++ b/platformio/builder/scripts/siliconlabsefm32.py @@ -18,7 +18,7 @@ SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/ststm32.py b/platformio/builder/scripts/ststm32.py index c1622028..aeff2818 100644 --- a/platformio/builder/scripts/ststm32.py +++ b/platformio/builder/scripts/ststm32.py @@ -65,7 +65,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index fc4f4f91..e7a5643f 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -61,7 +61,7 @@ else: # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the firmware file diff --git a/platformio/builder/scripts/timsp430.py b/platformio/builder/scripts/timsp430.py index c928b357..b38d4c12 100644 --- a/platformio/builder/scripts/timsp430.py +++ b/platformio/builder/scripts/timsp430.py @@ -83,7 +83,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .hex diff --git a/platformio/builder/scripts/titiva.py b/platformio/builder/scripts/titiva.py index db14ecdf..a94a64e7 100644 --- a/platformio/builder/scripts/titiva.py +++ b/platformio/builder/scripts/titiva.py @@ -31,7 +31,7 @@ env.Append( # Target: Build executable and linkable firmware # -target_elf = env.BuildFirmware() +target_elf = env.BuildProgram() # # Target: Build the .bin file diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index 4721884e..fb3f3fca 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -159,7 +159,7 @@ def DumpIDEData(env): return data -def getCompilerType(env): +def GetCompilerType(env): try: sysenv = environ.copy() sysenv['PATH'] = str(env['ENV']['PATH']) @@ -182,5 +182,5 @@ def exists(_): def generate(env): env.AddMethod(ConvertInoToCpp) env.AddMethod(DumpIDEData) - env.AddMethod(getCompilerType) + env.AddMethod(GetCompilerType) return env diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index be537d7d..1f1d145e 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -20,7 +20,7 @@ SRC_DEFAULT_FILTER = " ".join([ ]) -def BuildFirmware(env): +def BuildProgram(env): # fix ASM handling under non-casitive OS if not case_sensitive_suffixes(".s", ".S"): @@ -43,7 +43,7 @@ def BuildFirmware(env): ) # enable "cyclic reference" for linker - if env.get("LIBS", deplibs) and env.getCompilerType() == "gcc": + if env.get("LIBS", deplibs) and env.GetCompilerType() == "gcc": env.Prepend( _LIBFLAGS="-Wl,--start-group " ) @@ -330,7 +330,7 @@ def exists(_): def generate(env): - env.AddMethod(BuildFirmware) + env.AddMethod(BuildProgram) env.AddMethod(ProcessFlags) env.AddMethod(IsFileWithExt) env.AddMethod(VariantDirWrap) From f0d849a7023b20b05966090b0744ee949243bf84 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Aug 2015 12:33:37 +0300 Subject: [PATCH 09/86] Added native development platform --- HISTORY.rst | 7 +++ docs/platforms/index.rst | 18 +++++++ docs/platforms/native.rst | 9 ++++ platformio/builder/scripts/native.py | 36 ++++++++++++++ platformio/platforms/native.py | 18 +++++++ scripts/docspregen.py | 70 ++++++++++++++++++---------- 6 files changed, 133 insertions(+), 25 deletions(-) create mode 100644 docs/platforms/native.rst create mode 100644 platformio/builder/scripts/native.py create mode 100644 platformio/platforms/native.py diff --git a/HISTORY.rst b/HISTORY.rst index 880f3c02..7924a633 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,13 @@ Release History =============== +2.3.0 (2015-??-??) +------------------ + +* Added `native `_ + development platform + (`issue #263 `_) + 2.2.2 (2015-07-30) ------------------ diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index 1ed7a115..eaf05de1 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -11,6 +11,9 @@ Also it has pre-configured settings for most popular **Embedded Platform Boards**. You have no need to specify in :ref:`projectconf` type or frequency of MCU, upload protocol or etc. Please use ``board`` option. +Embedded +-------- + .. toctree:: :maxdepth: 2 @@ -25,5 +28,20 @@ MCU, upload protocol or etc. Please use ``board`` option. teensy timsp430 titiva + +Desktop +------- + +.. toctree:: + :maxdepth: 2 + + native + +Own Platform/Board +------------------ + +.. toctree:: + :maxdepth: 2 + creating_platform creating_board diff --git a/docs/platforms/native.rst b/docs/platforms/native.rst new file mode 100644 index 00000000..5a01d633 --- /dev/null +++ b/docs/platforms/native.rst @@ -0,0 +1,9 @@ +.. _platform_native: + +Platform ``native`` +=================== +Native development platform is intended to be used for desktop OS. This platform uses built-in tool chains (preferable based on GCC), frameworks, libs from particular OS where it will be run. + +For more detailed information please visit `vendor site `_. + +.. contents:: \ No newline at end of file diff --git a/platformio/builder/scripts/native.py b/platformio/builder/scripts/native.py new file mode 100644 index 00000000..bdbcd372 --- /dev/null +++ b/platformio/builder/scripts/native.py @@ -0,0 +1,36 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for native platform +""" + +from SCons.Script import DefaultEnvironment, AlwaysBuild, Default + +env = DefaultEnvironment() + +env.Replace( + + SIZEPRINTCMD="size $SOURCES", + + PROGNAME="program" +) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/platforms/native.py b/platformio/platforms/native.py new file mode 100644 index 00000000..f02478cb --- /dev/null +++ b/platformio/platforms/native.py @@ -0,0 +1,18 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform + + +class NativePlatform(BasePlatform): + + """ + Native development platform is intended to be used for desktop OS. + This platform uses built-in tool chains (preferable based on GCC), + frameworks, libs from particular OS where it will be run. + + http://platformio.org/#!/platforms/native + """ + + PACKAGES = { + } diff --git a/scripts/docspregen.py b/scripts/docspregen.py index 5f9f3ac5..becb9b57 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -67,8 +67,14 @@ def generate_boards(boards): def generate_packages(packages): + if not packages: + return allpackages = get_packages() lines = [] + lines.append(""" +Packages +-------- +""") lines.append(""".. list-table:: :header-rows: 1 @@ -116,13 +122,30 @@ For more detailed information please visit `vendor site <%s>`_.""" % p.get_vendor_url()) lines.append(""" .. contents::""") - lines.append(""" -Packages --------- -""") - lines.append(generate_packages(p.get_packages())) - lines.append(""" + # + # Packages + # + _packages_content = generate_packages(p.get_packages()) + if _packages_content: + lines.append(_packages_content) + + # + # Frameworks + # + _frameworks = util.get_frameworks() + _frameworks_lines = [] + for framework in sorted(_frameworks.keys()): + if not is_compat_platform_and_framework(name, framework): + continue + _frameworks_lines.append(""" + * - :ref:`framework_{type_}` + - {description}""".format( + type_=framework, + description=_frameworks[framework]['description'])) + + if _frameworks_lines: + lines.append(""" Frameworks ---------- .. list-table:: @@ -130,18 +153,23 @@ Frameworks * - Name - Description""") + lines.extend(_frameworks_lines) - _frameworks = util.get_frameworks() - for framework in sorted(_frameworks.keys()): - if not is_compat_platform_and_framework(name, framework): - continue + # + # Boards + # + vendors = {} + for board, data in util.get_boards().items(): + platform = data['platform'] + vendor = data['vendor'] + if name in platform: + if vendor in vendors: + vendors[vendor].append({board: data}) + else: + vendors[vendor] = [{board: data}] + + if vendors: lines.append(""" - * - :ref:`framework_{type_}` - - {description}""".format( - type_=framework, - description=_frameworks[framework]['description'])) - - lines.append(""" Boards ------ @@ -152,19 +180,11 @@ Boards horizontal. """) - vendors = {} - for board, data in util.get_boards().items(): - platform = data['platform'] - vendor = data['vendor'] - if name in platform: - if vendor in vendors: - vendors[vendor].append({board: data}) - else: - vendors[vendor] = [{board: data}] for vendor, boards in sorted(vendors.iteritems()): lines.append(str(vendor)) lines.append("~" * len(vendor)) lines.append(generate_boards(boards)) + return "\n".join(lines) From 0646ffc93f9d7036422c28cf46fda13768e7d033 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Aug 2015 12:53:21 +0300 Subject: [PATCH 10/86] Restore process $PATH for SCons --- platformio/builder/main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index d74f6c50..ca4e8881 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -123,10 +123,13 @@ for opt in ("LIB_IGNORE", "LIB_USE"): continue env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] -env.PrependENVPath( - "PATH", - env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) -) +# restore process $PATH +env['ENV']['PATH'] = getenv("PATH") +if env.subst("$PIOPACKAGE_TOOLCHAIN"): + env.PrependENVPath( + "PATH", + env.subst(join("$PIOPACKAGES_DIR", "$PIOPACKAGE_TOOLCHAIN", "bin")) + ) SConscriptChdir(0) SConscript(env.subst("$BUILD_SCRIPT")) From 584d03c8029ca5f1a752618385f2fd84447b1b11 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Aug 2015 15:08:54 +0300 Subject: [PATCH 11/86] Propagating External Environment --- platformio/builder/main.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index ca4e8881..d55c9ca1 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -12,7 +12,7 @@ except ImportError: from platformio import util import json -from os import getenv +from os import environ from os.path import isfile, join from time import time @@ -63,6 +63,9 @@ DefaultEnvironment( toolpath=[join("$PIOBUILDER_DIR", "tools")], variables=commonvars, + # Propagating External Environment + ENV=environ, + UNIX_TIME=int(time()), PIOHOME_DIR=util.get_home_dir(), @@ -123,8 +126,6 @@ for opt in ("LIB_IGNORE", "LIB_USE"): continue env[opt] = [l.strip() for l in env[opt].split(",") if l.strip()] -# restore process $PATH -env['ENV']['PATH'] = getenv("PATH") if env.subst("$PIOPACKAGE_TOOLCHAIN"): env.PrependENVPath( "PATH", @@ -134,8 +135,8 @@ if env.subst("$PIOPACKAGE_TOOLCHAIN"): SConscriptChdir(0) SConscript(env.subst("$BUILD_SCRIPT")) -if getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)): - SConscript(getenv("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT"))) +if environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT", None)): + SConscript(environ.get("PLATFORMIO_EXTRA_SCRIPT", env.get("EXTRA_SCRIPT"))) if "envdump" in COMMAND_LINE_TARGETS: print env.Dump() From 7d5a2c4dfc63345ddea51d3fb0797cf9c3b4084d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 3 Aug 2015 23:10:47 +0300 Subject: [PATCH 12/86] Set default PROGNAME to "program" --- platformio/builder/main.py | 1 + platformio/builder/scripts/native.py | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/platformio/builder/main.py b/platformio/builder/main.py index d55c9ca1..629c1ef9 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -67,6 +67,7 @@ DefaultEnvironment( ENV=environ, UNIX_TIME=int(time()), + PROGNAME="program", PIOHOME_DIR=util.get_home_dir(), PROJECT_DIR=util.get_project_dir(), diff --git a/platformio/builder/scripts/native.py b/platformio/builder/scripts/native.py index bdbcd372..fec4610b 100644 --- a/platformio/builder/scripts/native.py +++ b/platformio/builder/scripts/native.py @@ -11,9 +11,7 @@ env = DefaultEnvironment() env.Replace( - SIZEPRINTCMD="size $SOURCES", - - PROGNAME="program" + SIZEPRINTCMD="size $SOURCES" ) # From 7e5c22706b039203453180a9ba4014619ec0c975 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 4 Aug 2015 00:27:13 +0300 Subject: [PATCH 13/86] Use own mirror when SF is offline --- platformio/pkgmanager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/pkgmanager.py b/platformio/pkgmanager.py index b149b04c..110b9c23 100644 --- a/platformio/pkgmanager.py +++ b/platformio/pkgmanager.py @@ -89,7 +89,8 @@ class PackageManager(object): dlpath = None try: dlpath = self.download(info['url'], pkg_dir, info['sha1']) - except requests.exceptions.ConnectionError: + except (requests.exceptions.ConnectionError, + exception.FDUnrecognizedStatusCode): if info['url'].startswith("http://sourceforge.net"): dlpath = self.download( "http://dl.platformio.org/packages/%s" % From b75db38e45fa1441cf52afda9f7b69a5f7e50477 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Fri, 7 Aug 2015 05:23:11 -0400 Subject: [PATCH 14/86] fix typo in udev rules file --- scripts/99-platformio-udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index c0614f2b..ac0751e4 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -# UDEV Rules for PlatformIO supproted boards, http://platformio.org/#!/boards +# UDEV Rules for PlatformIO supported boards, http://platformio.org/#!/boards # # The latest version of this file may be found at: # https://github.com/platformio/platformio/blob/develop/scripts/99-platformio-udev.rules From 9ec0d3bc8c2a6fed0359ce1cf5c28435c56060f5 Mon Sep 17 00:00:00 2001 From: WillemMali Date: Fri, 7 Aug 2015 13:14:14 +0200 Subject: [PATCH 15/86] improved error wording Fixed a grammatical mistake and made the meaning clearer by replacing "it" with "this" and by adding an example. It does increase the length of the output, but I think it's much easier to read and more informative. --- platformio/builder/tools/pioupload.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 1cc75a53..ddd82e25 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -90,7 +90,8 @@ def AutodetectUploadPort(env): else: Exit("Error: Please specify `upload_port` for environment or use " "global `--upload-port` option.\n" - "For the some development platforms it can be USB flash drive\n") + "For some development platforms this can be a USB flash drive " + "(i.e. /media//)\n") def UploadToDisk(_, target, source, env): # pylint: disable=W0613,W0621 From 2715efd9107fd132dc9b9bc90cd4c90eb0ec3ab5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 9 Aug 2015 18:08:34 +0300 Subject: [PATCH 16/86] Add support for Adafruit Gemma board --- docs/frameworks/arduino.rst | 7 +++++++ docs/platforms/atmelavr.rst | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index b0b06738..ba909a08 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -59,6 +59,13 @@ Adafruit - 32 Kb - 2.5 Kb + * - ``gemma`` + - `Adafruit Gemma `_ + - ATTINY85 + - 8 MHz + - 8 Kb + - 0.5 Kb + * - ``protrinket3`` - `Adafruit Pro Trinket 3V/12MHz (USB) `_ - ATMEGA328P diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index 0ffb8f67..7a536133 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -78,6 +78,13 @@ Adafruit - 32 Kb - 2.5 Kb + * - ``gemma`` + - `Adafruit Gemma `_ + - ATTINY85 + - 8 MHz + - 8 Kb + - 0.5 Kb + * - ``protrinket3`` - `Adafruit Pro Trinket 3V/12MHz (USB) `_ - ATMEGA328P From 5e2415cb37eb09723dd1a1fdf4cbb82023cc7714 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 9 Aug 2015 19:05:16 +0300 Subject: [PATCH 17/86] Add support for "windows_x86" development platform // Issue #263 --- HISTORY.rst | 8 +++- docs/platforms/creating_platform.rst | 3 ++ docs/platforms/index.rst | 1 + docs/platforms/windows_x86.rst | 21 ++++++++++ platformio/__init__.py | 2 +- platformio/builder/scripts/native.py | 3 +- platformio/builder/scripts/windows_x86.py | 49 +++++++++++++++++++++++ platformio/platforms/base.py | 9 +++++ platformio/platforms/windows_x86.py | 24 +++++++++++ scripts/docspregen.py | 8 ++-- 10 files changed, 121 insertions(+), 7 deletions(-) create mode 100644 docs/platforms/windows_x86.rst create mode 100644 platformio/builder/scripts/windows_x86.py create mode 100644 platformio/platforms/windows_x86.py diff --git a/HISTORY.rst b/HISTORY.rst index 7924a633..7408ff9d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,9 +4,15 @@ Release History 2.3.0 (2015-??-??) ------------------ -* Added `native `_ +* Added + `native `__, + `windows_x86 `__ development platform (`issue #263 `_) +* Added support for Adafruit Gemma board to + `atmelavr `__ + platform + (`pull #256 `_) 2.2.2 (2015-07-30) ------------------ diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 7e1199cb..3296277f 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -111,6 +111,9 @@ Packages * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ + * - ``toolchain-gccmingw32`` + - `MinGW `_ + * - ``toolchain-timsp430`` - `msp-gcc `_, `GDB `_ diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index eaf05de1..fd0f0605 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -36,6 +36,7 @@ Desktop :maxdepth: 2 native + windows_x86 Own Platform/Board ------------------ diff --git a/docs/platforms/windows_x86.rst b/docs/platforms/windows_x86.rst new file mode 100644 index 00000000..01a45063 --- /dev/null +++ b/docs/platforms/windows_x86.rst @@ -0,0 +1,21 @@ +.. _platform_windows_x86: + +Platform ``windows_x86`` +======================== +Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows or Mac OS X) you can build native application for Windows x86 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gccmingw32`` + - `MinGW `_ \ No newline at end of file diff --git a/platformio/__init__.py b/platformio/__init__.py index f5191be8..10e7fc39 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 3, "0.dev0") +VERSION = (2, 3, "0.dev1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/scripts/native.py b/platformio/builder/scripts/native.py index fec4610b..28e94fe9 100644 --- a/platformio/builder/scripts/native.py +++ b/platformio/builder/scripts/native.py @@ -5,12 +5,11 @@ Builder for native platform """ -from SCons.Script import DefaultEnvironment, AlwaysBuild, Default +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment env = DefaultEnvironment() env.Replace( - SIZEPRINTCMD="size $SOURCES" ) diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py new file mode 100644 index 00000000..78030585 --- /dev/null +++ b/platformio/builder/scripts/windows_x86.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Windows x86 +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + + +env = DefaultEnvironment() + +env.Replace( + SIZEPRINTCMD="size $SOURCES", + PROGSUFFIX=".exe" +) + +if get_systype() == "darwin_x86_64": + env.Replace( + AR="i586-mingw32-ar", + AS="i586-mingw32-as", + CC="i586-mingw32-gcc", + CXX="i586-mingw32-g++", + OBJCOPY="i586-mingw32-objcopy", + RANLIB="i586-mingw32-ranlib", + SIZETOOL="i586-mingw32-size", + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 8874e7f3..03a71134 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -90,6 +90,9 @@ PLATFORM_PACKAGES = { "tool-micronucleus": [ ("Micronucleus", "https://github.com/micronucleus/micronucleus") ], + "toolchain-gccmingw32": [ + ("MinGW", "http://www.mingw.org") + ], "tool-bossac": [ ("BOSSA CLI", "https://sourceforge.net/projects/b-o-s-s-a/") ], @@ -224,6 +227,12 @@ class BasePlatform(object): else: raise NotImplementedError() + def is_embedded(self): + for name, opts in self.get_packages().items(): + if name == "framework-mbed" or opts.get("alias") == "uploader": + return True + return False + def get_packages(self): return self.PACKAGES diff --git a/platformio/platforms/windows_x86.py b/platformio/platforms/windows_x86.py new file mode 100644 index 00000000..157b93f7 --- /dev/null +++ b/platformio/platforms/windows_x86.py @@ -0,0 +1,24 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform + + +class Windows_x86Platform(BasePlatform): + + """ + Windows x86 (32-bit) is a metafamily of graphical operating systems + developed and marketed by Microsoft. + Using host OS (Windows or Mac OS X) you can build native application + for Windows x86 platform. + + http://platformio.org/#!/platforms/windows_x86 + """ + + PACKAGES = { + + "toolchain-gccmingw32": { + "alias": "toolchain", + "default": True + } + } diff --git a/scripts/docspregen.py b/scripts/docspregen.py index becb9b57..50dd4601 100644 --- a/scripts/docspregen.py +++ b/scripts/docspregen.py @@ -66,7 +66,7 @@ def generate_boards(boards): return "\n".join(lines + [""]) -def generate_packages(packages): +def generate_packages(packages, is_embedded): if not packages: return allpackages = get_packages() @@ -92,7 +92,8 @@ Packages type_=type_, contents=", ".join(contitems))) - lines.append(""" + if is_embedded: + lines.append(""" .. warning:: **Linux Users:** Don't forget to install "udev" rules file `99-platformio-udev.rules `_ (an instruction is located in the file). @@ -101,6 +102,7 @@ Packages from board manufacturer """) + return "\n".join(lines) @@ -126,7 +128,7 @@ For more detailed information please visit `vendor site <%s>`_.""" % # # Packages # - _packages_content = generate_packages(p.get_packages()) + _packages_content = generate_packages(p.get_packages(), p.is_embedded()) if _packages_content: lines.append(_packages_content) From c9491f47e1fc98e0a6aadf9bf379f21112768332 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 9 Aug 2015 21:46:07 +0300 Subject: [PATCH 18/86] Add support for mingw-linux toolchains --- platformio/builder/scripts/windows_x86.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py index 78030585..90624433 100644 --- a/platformio/builder/scripts/windows_x86.py +++ b/platformio/builder/scripts/windows_x86.py @@ -13,20 +13,25 @@ from platformio.util import get_systype env = DefaultEnvironment() env.Replace( - SIZEPRINTCMD="size $SOURCES", + AR="$_MINGWPREFIX-ar", + AS="$_MINGWPREFIX-as", + CC="$_MINGWPREFIX-gcc", + CXX="$_MINGWPREFIX-g++", + OBJCOPY="$_MINGWPREFIX-objcopy", + RANLIB="$_MINGWPREFIX-ranlib", + SIZETOOL="$_MINGWPREFIX-size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES', PROGSUFFIX=".exe" ) if get_systype() == "darwin_x86_64": env.Replace( - AR="i586-mingw32-ar", - AS="i586-mingw32-as", - CC="i586-mingw32-gcc", - CXX="i586-mingw32-g++", - OBJCOPY="i586-mingw32-objcopy", - RANLIB="i586-mingw32-ranlib", - SIZETOOL="i586-mingw32-size", - SIZEPRINTCMD='"$SIZETOOL" $SOURCES' + _MINGWPREFIX="i586-mingw32" + ) +elif get_systype() in ("linux_x86_64", "linux_i686"): + env.Replace( + _MINGWPREFIX="i686-w64-mingw32" ) # From 56792719134918c5a2d515bbaab18980cd54c71b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 9 Aug 2015 21:46:43 +0300 Subject: [PATCH 19/86] Add "Hello World" example for desktop platforms --- examples/desktop/hello-world/README.rst | 18 ++++++++++++++++ examples/desktop/hello-world/platformio.ini | 24 +++++++++++++++++++++ examples/desktop/hello-world/src/main.c | 7 ++++++ 3 files changed, 49 insertions(+) create mode 100644 examples/desktop/hello-world/README.rst create mode 100644 examples/desktop/hello-world/platformio.ini create mode 100644 examples/desktop/hello-world/src/main.c diff --git a/examples/desktop/hello-world/README.rst b/examples/desktop/hello-world/README.rst new file mode 100644 index 00000000..27f3cb49 --- /dev/null +++ b/examples/desktop/hello-world/README.rst @@ -0,0 +1,18 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/desktop/hello-world + + # Process example project + > platformio run + + # Clean build files + > platformio run --target clean diff --git a/examples/desktop/hello-world/platformio.ini b/examples/desktop/hello-world/platformio.ini new file mode 100644 index 00000000..9d028e13 --- /dev/null +++ b/examples/desktop/hello-world/platformio.ini @@ -0,0 +1,24 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:native] +platform = native + +[env:win32] +platform = windows_x86 diff --git a/examples/desktop/hello-world/src/main.c b/examples/desktop/hello-world/src/main.c new file mode 100644 index 00000000..21049ca9 --- /dev/null +++ b/examples/desktop/hello-world/src/main.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("Hello World from PlatformIO!\n"); + return 0; +} From 2b8f7824c21bf21b528ef377b9f79dd04d617ff5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 16:16:16 +0300 Subject: [PATCH 20/86] Add support for Linux 32/64 as host OS for cross compiling to Windows x86 --- platformio/builder/scripts/windows_x86.py | 21 +++++++++++---------- platformio/platforms/windows_x86.py | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py index 90624433..7d0f2c79 100644 --- a/platformio/builder/scripts/windows_x86.py +++ b/platformio/builder/scripts/windows_x86.py @@ -2,7 +2,7 @@ # See LICENSE for details. """ - Builder for Windows x86 + Builder for Windows x86 / 32bit """ from SCons.Script import AlwaysBuild, Default, DefaultEnvironment @@ -13,13 +13,14 @@ from platformio.util import get_systype env = DefaultEnvironment() env.Replace( - AR="$_MINGWPREFIX-ar", - AS="$_MINGWPREFIX-as", - CC="$_MINGWPREFIX-gcc", - CXX="$_MINGWPREFIX-g++", - OBJCOPY="$_MINGWPREFIX-objcopy", - RANLIB="$_MINGWPREFIX-ranlib", - SIZETOOL="$_MINGWPREFIX-size", + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", SIZEPRINTCMD='"$SIZETOOL" $SOURCES', PROGSUFFIX=".exe" @@ -27,11 +28,11 @@ env.Replace( if get_systype() == "darwin_x86_64": env.Replace( - _MINGWPREFIX="i586-mingw32" + _BINPREFIX="i586-mingw32-" ) elif get_systype() in ("linux_x86_64", "linux_i686"): env.Replace( - _MINGWPREFIX="i686-w64-mingw32" + _BINPREFIX="i686-w64-mingw32-" ) # diff --git a/platformio/platforms/windows_x86.py b/platformio/platforms/windows_x86.py index 157b93f7..a3ba1878 100644 --- a/platformio/platforms/windows_x86.py +++ b/platformio/platforms/windows_x86.py @@ -9,8 +9,8 @@ class Windows_x86Platform(BasePlatform): """ Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. - Using host OS (Windows or Mac OS X) you can build native application - for Windows x86 platform. + Using host OS (Windows, Linux 32/64 or Mac OS X) you can build native + application for Windows x86 platform. http://platformio.org/#!/platforms/windows_x86 """ From 27ca9872842288f9031b31b7cfeb54f2dda4031f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 16:17:00 +0300 Subject: [PATCH 21/86] iSort passed --- platformio/builder/scripts/windows_x86.py | 1 - platformio/builder/tools/platformio.py | 1 - 2 files changed, 2 deletions(-) diff --git a/platformio/builder/scripts/windows_x86.py b/platformio/builder/scripts/windows_x86.py index 7d0f2c79..d06a9f80 100644 --- a/platformio/builder/scripts/windows_x86.py +++ b/platformio/builder/scripts/windows_x86.py @@ -9,7 +9,6 @@ from SCons.Script import AlwaysBuild, Default, DefaultEnvironment from platformio.util import get_systype - env = DefaultEnvironment() env.Replace( diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 1f1d145e..26171436 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -12,7 +12,6 @@ from SCons.Util import case_sensitive_suffixes from platformio.util import pioversion_to_intstr - SRC_BUILD_EXT = ["c", "cpp", "S", "spp", "SPP", "sx", "s", "asm", "ASM"] SRC_HEADER_EXT = ["h", "hpp"] SRC_DEFAULT_FILTER = " ".join([ From ad7be3b397098ccfd0078cb098cb28e7111d84f1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 21:39:31 +0300 Subject: [PATCH 22/86] Add new development platforms: linux_arm, linux_i686 and linux_x86_64 --- HISTORY.rst | 5 ++- docs/platforms/creating_platform.rst | 9 ++++ docs/platforms/index.rst | 3 ++ docs/platforms/linux_arm.rst | 21 +++++++++ docs/platforms/linux_i686.rst | 21 +++++++++ docs/platforms/linux_x86_64.rst | 21 +++++++++ docs/platforms/windows_x86.rst | 2 +- examples/desktop/hello-world/platformio.ini | 20 +++++++++ platformio/__init__.py | 2 +- platformio/builder/scripts/linux_arm.py | 49 +++++++++++++++++++++ platformio/builder/scripts/linux_i686.py | 49 +++++++++++++++++++++ platformio/builder/scripts/linux_x86_64.py | 49 +++++++++++++++++++++ platformio/platforms/base.py | 16 +++++-- platformio/platforms/linux_arm.py | 32 ++++++++++++++ platformio/platforms/linux_i686.py | 32 ++++++++++++++ platformio/platforms/linux_x86_64.py | 32 ++++++++++++++ 16 files changed, 357 insertions(+), 6 deletions(-) create mode 100644 docs/platforms/linux_arm.rst create mode 100644 docs/platforms/linux_i686.rst create mode 100644 docs/platforms/linux_x86_64.rst create mode 100644 platformio/builder/scripts/linux_arm.py create mode 100644 platformio/builder/scripts/linux_i686.py create mode 100644 platformio/builder/scripts/linux_x86_64.py create mode 100644 platformio/platforms/linux_arm.py create mode 100644 platformio/platforms/linux_i686.py create mode 100644 platformio/platforms/linux_x86_64.py diff --git a/HISTORY.rst b/HISTORY.rst index 7408ff9d..6623fa7b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,8 +6,11 @@ Release History * Added `native `__, + `linux_arm `__, + `linux_i686 `__, + `linux_x86_64 `__, `windows_x86 `__ - development platform + development platforms (`issue #263 `_) * Added support for Adafruit Gemma board to `atmelavr `__ diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 3296277f..2521f0a0 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -108,9 +108,18 @@ Packages * - ``toolchain-atmelavr`` - `avr-gcc `_, `GDB `_, `AVaRICE `_, `SimulAVR `_ + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ + * - ``toolchain-gccmingw32`` - `MinGW `_ diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index fd0f0605..f39029f9 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -36,6 +36,9 @@ Desktop :maxdepth: 2 native + linux_arm + linux_i686 + linux_x86_64 windows_x86 Own Platform/Board diff --git a/docs/platforms/linux_arm.rst b/docs/platforms/linux_arm.rst new file mode 100644 index 00000000..9a3b3f02 --- /dev/null +++ b/docs/platforms/linux_arm.rst @@ -0,0 +1,21 @@ +.. _platform_linux_arm: + +Platform ``linux_arm`` +====================== +Linux ARM is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X, Linux ARM) you can build native application for Linux ARM platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ \ No newline at end of file diff --git a/docs/platforms/linux_i686.rst b/docs/platforms/linux_i686.rst new file mode 100644 index 00000000..8b0e18d4 --- /dev/null +++ b/docs/platforms/linux_i686.rst @@ -0,0 +1,21 @@ +.. _platform_linux_i686: + +Platform ``linux_i686`` +======================= +Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 32-bit) you can build native application for Linux i686 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ \ No newline at end of file diff --git a/docs/platforms/linux_x86_64.rst b/docs/platforms/linux_x86_64.rst new file mode 100644 index 00000000..a19f02a4 --- /dev/null +++ b/docs/platforms/linux_x86_64.rst @@ -0,0 +1,21 @@ +.. _platform_linux_x86_64: + +Platform ``linux_x86_64`` +========================= +Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 64-bit) you can build native application for Linux x86_64 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ \ No newline at end of file diff --git a/docs/platforms/windows_x86.rst b/docs/platforms/windows_x86.rst index 01a45063..a8b72c95 100644 --- a/docs/platforms/windows_x86.rst +++ b/docs/platforms/windows_x86.rst @@ -2,7 +2,7 @@ Platform ``windows_x86`` ======================== -Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows or Mac OS X) you can build native application for Windows x86 platform. +Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows, Linux 32/64 or Mac OS X) you can build native application for Windows x86 platform. For more detailed information please visit `vendor site `_. diff --git a/examples/desktop/hello-world/platformio.ini b/examples/desktop/hello-world/platformio.ini index 9d028e13..1d508758 100644 --- a/examples/desktop/hello-world/platformio.ini +++ b/examples/desktop/hello-world/platformio.ini @@ -22,3 +22,23 @@ platform = native [env:win32] platform = windows_x86 + +# +# If host OS is Mac OS X +# + +# [env:darwin_x86_64] +# platform = native + +# [env:linux_i686] +# platform = linux_i686 + +# [env:linux_x86_64] +# platform = linux_x86_64 + +# [env:windows_x86] +# platform = windows_x86 + +# [env:linux_armv6l] +# platform = linux_arm +# build_flags = -march=armv6 diff --git a/platformio/__init__.py b/platformio/__init__.py index 10e7fc39..3f7f72eb 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 3, "0.dev1") +VERSION = (2, 3, "0.dev2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/scripts/linux_arm.py b/platformio/builder/scripts/linux_arm.py new file mode 100644 index 00000000..b8864388 --- /dev/null +++ b/platformio/builder/scripts/linux_arm.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux ARM +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="arm-linux-gnueabihf-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_i686.py b/platformio/builder/scripts/linux_i686.py new file mode 100644 index 00000000..d0b0968e --- /dev/null +++ b/platformio/builder/scripts/linux_i686.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux i686 / 32-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="i586-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_x86_64.py b/platformio/builder/scripts/linux_x86_64.py new file mode 100644 index 00000000..ecb5e775 --- /dev/null +++ b/platformio/builder/scripts/linux_x86_64.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux x64_64 / 64-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="x86_64-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 03a71134..f52669e3 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -76,6 +76,19 @@ PLATFORM_PACKAGES = { ("gcc-arm-embedded", "https://launchpad.net/gcc-arm-embedded"), ("GDB", "http://www.gnu.org/software/gdb/") ], + "toolchain-gccarmlinuxgnueabi": [ + ("GCC for Linux ARM GNU EABI", "https://gcc.gnu.org"), + ("GDB", "http://www.gnu.org/software/gdb/") + ], + "toolchain-gccmingw32": [ + ("MinGW", "http://www.mingw.org") + ], + "toolchain-gcclinux32": [ + ("GCC for Linux i686", "https://gcc.gnu.org") + ], + "toolchain-gcclinux64": [ + ("GCC for Linux x86_64", "https://gcc.gnu.org") + ], "toolchain-xtensa": [ ("xtensa-gcc", "https://github.com/jcmvbkbc/gcc-xtensa"), ("GDB", "http://www.gnu.org/software/gdb/") @@ -90,9 +103,6 @@ PLATFORM_PACKAGES = { "tool-micronucleus": [ ("Micronucleus", "https://github.com/micronucleus/micronucleus") ], - "toolchain-gccmingw32": [ - ("MinGW", "http://www.mingw.org") - ], "tool-bossac": [ ("BOSSA CLI", "https://sourceforge.net/projects/b-o-s-s-a/") ], diff --git a/platformio/platforms/linux_arm.py b/platformio/platforms/linux_arm.py new file mode 100644 index 00000000..83aa75b1 --- /dev/null +++ b/platformio/platforms/linux_arm.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_armPlatform(BasePlatform): + + """ + Linux ARM is a Unix-like and mostly POSIX-compliant computer + operating system (OS) assembled under the model of free and open-source + software development and distribution. + + Using host OS (Mac OS X, Linux ARM) you can build native application + for Linux ARM platform. + + http://platformio.org/#!/platforms/linux_arm + """ + + PACKAGES = { + + "toolchain-gccarmlinuxgnueabi": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if "linux_arm" in get_systype(): + del self.PACKAGES['toolchain-gccarmlinuxgnueabi'] + BasePlatform.__init__(self) diff --git a/platformio/platforms/linux_i686.py b/platformio/platforms/linux_i686.py new file mode 100644 index 00000000..c5928ab8 --- /dev/null +++ b/platformio/platforms/linux_i686.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_i686Platform(BasePlatform): + + """ + Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant + computer operating system (OS) assembled under the model of free and + open-source software development and distribution. + + Using host OS (Mac OS X or Linux 32-bit) you can build native + application for Linux i686 platform. + + http://platformio.org/#!/platforms/linux_i686 + """ + + PACKAGES = { + + "toolchain-gcclinux32": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if get_systype() == "linux_i686": + del self.PACKAGES['toolchain-gcclinux32'] + BasePlatform.__init__(self) diff --git a/platformio/platforms/linux_x86_64.py b/platformio/platforms/linux_x86_64.py new file mode 100644 index 00000000..a142d076 --- /dev/null +++ b/platformio/platforms/linux_x86_64.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_x86_64Platform(BasePlatform): + + """ + Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant + computer operating system (OS) assembled under the model of free and + open-source software development and distribution. + + Using host OS (Mac OS X or Linux 64-bit) you can build native + application for Linux x86_64 platform. + + http://platformio.org/#!/platforms/linux_i686 + """ + + PACKAGES = { + + "toolchain-gcclinux64": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if get_systype() == "linux_x86_64": + del self.PACKAGES['toolchain-gcclinux64'] + BasePlatform.__init__(self) From 838ba3ad4f0c4439a1d1238c560d6f1644d47c77 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 21:51:09 +0300 Subject: [PATCH 23/86] Add new article by Russell Davis --- docs/articles.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/articles.rst b/docs/articles.rst index eead4cbe..13c33aff 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -4,11 +4,12 @@ Articles about us ================= .. note:: - If you've written article about PlatformIO and would like it listed on - this page, `please edit this page `_. + If you've written article about PlatformIO and would like it listed on + this page, `please edit this page `_. Here are recent articles about PlatformIO: +* Aug 01, 2015 - **Russell Davis** - `PlatformIO on the Raspberry Pi `_ * Jul 20, 2015 - **Eli Fatsi** - `Arduino Development in Atom Editor `_ * Jun 02, 2015 - **Alejandro Guirao Rodriguez** - `Discovering PlatformIO: The RaspberryPi / Arduino combo kit is a winner option when prototyping an IoT-style project `_ * May 11, 2015 - **IT Hare** - `From Web Developer to Embedded One: Interview with Ivan Kravets, The Guy Behind PlatformIO. Part II `_ From 84fb5e59a9c4c89c41c2e4e7797a51071078eb1b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 22:17:37 +0300 Subject: [PATCH 24/86] Update hello-world example --- examples/desktop/hello-world/platformio.ini | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/desktop/hello-world/platformio.ini b/examples/desktop/hello-world/platformio.ini index 1d508758..9ab3f31f 100644 --- a/examples/desktop/hello-world/platformio.ini +++ b/examples/desktop/hello-world/platformio.ini @@ -20,9 +20,6 @@ [env:native] platform = native -[env:win32] -platform = windows_x86 - # # If host OS is Mac OS X # @@ -42,3 +39,13 @@ platform = windows_x86 # [env:linux_armv6l] # platform = linux_arm # build_flags = -march=armv6 + +# +# If host OS is Linux +# + +# [env:linux_i686] +# platform = linux_i686 + +# [env:linux_x86_64] +# platform = linux_x86_64 From 35f7d8a4cc80a0f928988eeddb20565e14326fb6 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Aug 2015 00:14:04 +0300 Subject: [PATCH 25/86] Enhance docs --- docs/envvars.rst | 72 +++++++++++--------------------------------- docs/faq.rst | 4 +-- docs/index.rst | 27 +++++++++++++++-- docs/projectconf.rst | 16 +++++----- 4 files changed, 52 insertions(+), 67 deletions(-) diff --git a/docs/envvars.rst b/docs/envvars.rst index 383322f3..8682e51d 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -18,10 +18,7 @@ General PlatformIO uses *General* environment variables for the common operations/commands. -.. _envvar_CI: - -CI -~~ +.. envvar:: CI PlatformIO handles ``CI`` variable which is setup by `Continuous Integration `_ @@ -29,33 +26,21 @@ PlatformIO handles ``CI`` variable which is setup by Currently, PlatformIO uses it to disable prompts. In other words, ``CI=true`` automatically setup -:ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false `. +:envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=false `. -.. _envvar_PLATFORMIO_HOME_DIR: - -PLATFORMIO_HOME_DIR -~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_HOME_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_home_dir`. -.. _envvar_PLATFORMIO_LIB_DIR: - -PLATFORMIO_LIB_DIR -~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_LIB_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_lib_dir`. -.. _envvar_PLATFORMIO_SRC_DIR: - -PLATFORMIO_SRC_DIR -~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_src_dir`. -.. _envvar_PLATFORMIO_ENVS_DIR: - -PLATFORMIO_ENVS_DIR -~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_ENVS_DIR Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`. @@ -63,74 +48,53 @@ Allows to override :ref:`projectconf` option :ref:`projectconf_pio_envs_dir`. Builder ------- -.. _envvar_PLATFORMIO_BUILD_FLAGS: - -PLATFORMIO_BUILD_FLAGS -~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_BUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_build_flags`. -.. _envvar_PLATFORMIO_SRC_BUILD_FLAGS: - -PLATFORMIO_SRC_BUILD_FLAGS -~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_BUILD_FLAGS Allows to set :ref:`projectconf` option :ref:`projectconf_src_build_flags`. -.. _envvar_PLATFORMIO_SRC_FILTER: - -PLATFORMIO_SRC_FILTER -~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SRC_FILTER Allows to set :ref:`projectconf` option :ref:`projectconf_src_filter`. -.. _envvar_PLATFORMIO_EXTRA_SCRIPT: - -PLATFORMIO_EXTRA_SCRIPT -~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_EXTRA_SCRIPT Allows to set :ref:`projectconf` option :ref:`projectconf_extra_script`. + Settings -------- Allows to override PlatformIO settings. You can manage them via :ref:`cmd_settings` command. - -PLATFORMIO_SETTING_AUTO_UPDATE_LIBRARIES -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_AUTO_UPDATE_LIBRARIES Allows to override setting :ref:`setting_auto_update_libraries`. -PLATFORMIO_SETTING_AUTO_UPDATE_PLATFORMS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_AUTO_UPDATE_PLATFORMS Allows to override setting :ref:`setting_auto_update_platforms`. -PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_LIBRARIES_INTERVAL Allows to override setting :ref:`setting_check_libraries_interval`. -PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_PLATFORMIO_INTERVAL Allows to override setting :ref:`setting_check_platformio_interval`. -PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_CHECK_PLATFORMS_INTERVAL Allows to override setting :ref:`setting_check_platforms_interval`. -.. _envvar_PLATFORMIO_SETTING_ENABLE_PROMPTS: - -PLATFORMIO_SETTING_ENABLE_PROMPTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_ENABLE_PROMPTS Allows to override setting :ref:`setting_enable_prompts`. -PLATFORMIO_SETTING_ENABLE_TELEMETRY -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. envvar:: PLATFORMIO_SETTING_ENABLE_TELEMETRY Allows to override setting :ref:`setting_enable_telemetry`. diff --git a/docs/faq.rst b/docs/faq.rst index 59e8d400..f103986b 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -70,10 +70,10 @@ DISABLE** all prompts. It will allow you to avoid blocking. There are a few options: - using :option:`platformio --force` option before each command -- using environment variable :ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` +- using environment variable :envvar:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` - disable global setting ``enable_prompts`` via :ref:`cmd_settings` command - masking under Continuous Integration system via environment variable - :ref:`CI=true `. + :envvar:`CI=true `. Windows: ``UnicodeDecodeError: 'ascii' codec can't decode byte`` diff --git a/docs/index.rst b/docs/index.rst index 25ef8d5c..0b300b73 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,7 +19,7 @@ libOpenCM3, etc.* `Issues `_ * `Blog `_ | `Reddit `_ | - `Facebook `_ | + `Facebook `_ | `Twitter `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* @@ -61,18 +61,39 @@ Contents -------- .. toctree:: + :caption: Getting Started :maxdepth: 2 - quickstart installation + quickstart + userguide/index + +.. toctree:: + :caption: Configuration + :maxdepth: 2 + projectconf envvars + +.. toctree:: + :caption: Instruments + :maxdepth: 2 + Platforms & Boards frameworks/index + +.. toctree:: + :caption: Integration + :maxdepth: 2 + librarymanager/index - userguide/index ci/index ide + +.. toctree:: + :caption: Miscellaneous + :maxdepth: 2 + articles FAQ history diff --git a/docs/projectconf.rst b/docs/projectconf.rst index 53656704..a3641e5c 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -42,7 +42,7 @@ A default value is User's home directory: * Windows ``%HOMEPATH%\.platformio`` This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_HOME_DIR`. +:envvar:`PLATFORMIO_HOME_DIR`. .. _projectconf_pio_lib_dir: @@ -55,7 +55,7 @@ This directory is used to store external libraries downloaded by A default value is ``%home_dir%/lib``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_LIB_DIR`. +:envvar:`PLATFORMIO_LIB_DIR`. .. note:: You can put here your own/private libraries. The source code of each @@ -73,7 +73,7 @@ command. A default value is ``%project_dir%/src``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_SRC_DIR`. +:envvar:`PLATFORMIO_SRC_DIR`. .. note:: This option is useful for people who migrate from Arduino/Energia IDEs where @@ -97,7 +97,7 @@ next build operation. A default value is ``%project_dir%/.pioenvs``. This option can be overridden by global environment variable -:ref:`envvar_PLATFORMIO_ENVS_DIR`. +:envvar:`PLATFORMIO_ENVS_DIR`. .. note:: If you have any problems with building your Project environmets which @@ -267,7 +267,7 @@ processes: ``-l``. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_BUILD_FLAGS`. +:envvar:`PLATFORMIO_BUILD_FLAGS`. Example: @@ -309,7 +309,7 @@ but will be applied only for the project source code from :ref:`projectconf_pio_src_dir` directory. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_SRC_BUILD_FLAGS`. +:envvar:`PLATFORMIO_SRC_BUILD_FLAGS`. .. _projectconf_src_filter: @@ -331,7 +331,7 @@ By default, ``src_filter`` is predefined to exclude ``.git`` and ``svn`` repository folders and exclude ``examples`` folder. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_SRC_FILTER`. +:envvar:`PLATFORMIO_SRC_FILTER`. ``lib_install`` ^^^^^^^^^^^^^^^ @@ -404,7 +404,7 @@ section of `SCons documentation `_. This option can be set by global environment variable -:ref:`envvar_PLATFORMIO_EXTRA_SCRIPT`. +:envvar:`PLATFORMIO_EXTRA_SCRIPT`. Example, specify own upload command for :ref:`platform_atmelavr`: From 260dd031798dd6b8bf05240c6f87698b0a90b84a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Fri, 14 Aug 2015 16:09:48 +0300 Subject: [PATCH 26/86] Restore external build flags --- platformio/builder/scripts/frameworks/mbed.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index 6c3bcf8d..f4c18f42 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -211,6 +211,9 @@ env.Replace( join(variant_dir, eixdata.get("LDSCRIPT_PATH")[0])) ) +# restore external build flags +env.ProcessFlags() + # Hook for K64F and K22F if board_type in ("frdm_k22f", "frdm_k64f"): env.Append( From bd03d75f14c5cb805607b116f706ac481225c04b Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 17 Aug 2015 10:37:53 +0300 Subject: [PATCH 27/86] Switch to click 5.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a38fcfee..ad3abf3d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -click==4.0 +click==5.0 bottle==0.12.8 colorama==0.3.3 pyserial==2.7 From 731467d4e93921c26cd360c52afc75420a9b0b54 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 17 Aug 2015 11:55:42 +0300 Subject: [PATCH 28/86] Add MinGW to PATH env for AppVeyor --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index a213b1f2..cd09e534 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,12 +9,18 @@ environment: PYTHON_HOME: "C:\\Python27-x64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" + init: - "ECHO %TOXENV%" - ps: "ls C:\\Python*" + install: - "git submodule update --init --recursive" - "powershell scripts\\appveyor\\install.ps1" + +before_test: + - cmd: SET PATH=%PATH%;C:\MinGW\bin + test_script: - "%PYTHON_HOME%\\Scripts\\tox --version" - "%PYTHON_HOME%\\Scripts\\pip --version" From 25baee266cda84dee113c7b19a7da7629716931f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 18 Aug 2015 16:37:44 +0300 Subject: [PATCH 29/86] Add @PlatformIO Storage stats badge --- README.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 09b2caa0..43efc692 100644 --- a/README.rst +++ b/README.rst @@ -16,12 +16,15 @@ PlatformIO .. image:: https://img.shields.io/pypi/v/platformio.svg :target: https://pypi.python.org/pypi/platformio/ :alt: Latest Version -.. image:: https://img.shields.io/pypi/dm/platformio.svg - :target: https://pypi.python.org/pypi/platformio/ - :alt: Downloads .. image:: https://img.shields.io/pypi/l/platformio.svg :target: https://pypi.python.org/pypi/platformio/ - :alt: License + :alt: License +.. image:: https://img.shields.io/pypi/dm/platformio.svg + :target: https://pypi.python.org/pypi/platformio/ + :alt: PyPi Downloads +.. image:: https://img.shields.io/sourceforge/dm/platformio-storage.svg + :target: https://sourceforge.net/projects/platformio-storage/ + :alt: Packages Downloads .. image:: https://badges.gitter.im/Join%20Chat.svg :alt: Join the chat at https://gitter.im/platformio/platformio :target: https://gitter.im/platformio/platformio From 3393d8145209984311c56f9cf41b0867762aa95a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 19 Aug 2015 23:11:42 +0300 Subject: [PATCH 30/86] Hint "save as..." for download get-platformio.py script --- docs/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation.rst b/docs/installation.rst index 20e447de..59670659 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -65,7 +65,7 @@ To install or upgrade *PlatformIO* paste that at a *Terminal* prompt Installer Script (Mac / Linux / Windows) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To install or upgrade *PlatformIO*, download +To install or upgrade *PlatformIO*, download (save as...) `get-platformio.py `_ script. Then run the following (**you MIGHT need** to run ``sudo`` first, just for installation): From 1b41ffba609d45fe55fa24341cf183691762c52c Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Thu, 20 Aug 2015 14:52:03 +0300 Subject: [PATCH 31/86] Fix home path environment variable in Eclipse project on Windows // Resolve #270 --- platformio/ide/projectgenerator.py | 3 ++- platformio/ide/tpls/eclipse/.cproject.tpl | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 1720e467..668becfb 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -115,5 +115,6 @@ class ProjectGenerator(object): if build_data and "defines" in build_data else []), "srcfiles": self.get_srcfiles(), "user_home_dir": abspath(expanduser("~")), - "project_dir": self.project_dir + "project_dir": self.project_dir, + "systype": util.get_systype() }) diff --git a/platformio/ide/tpls/eclipse/.cproject.tpl b/platformio/ide/tpls/eclipse/.cproject.tpl index c6f6e077..2d608394 100644 --- a/platformio/ide/tpls/eclipse/.cproject.tpl +++ b/platformio/ide/tpls/eclipse/.cproject.tpl @@ -25,7 +25,11 @@