From 98f5f73a41b89be107922e1626af6c0294bc2a86 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 29 Jun 2016 13:17:06 +0300 Subject: [PATCH 01/36] Auto-remove project cache when PlatformIO is upgraded --- HISTORY.rst | 5 +++++ platformio/__init__.py | 2 +- platformio/commands/run.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index fe6d261e..eb34ef63 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,11 @@ Release Notes PlatformIO 2.0 -------------- +2.11.1 (2016-??-??) +~~~~~~~~~~~~~~~~~~~ + +* Auto-remove project cache when PlatformIO is upgraded + 2.11.0 (2016-06-28) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index 7931da16..6d594c01 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, 0) +VERSION = (2, 11, "1.dev0") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 0834edf0..023d0a34 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -21,7 +21,7 @@ from time import time import click -from platformio import app, exception, telemetry, util +from platformio import __version__, app, exception, telemetry, util from platformio.commands.lib import lib_install as cmd_lib_install from platformio.libmanager import LibraryManager from platformio.platforms.base import PlatformFactory @@ -243,7 +243,7 @@ def _clean_pioenvs_dir(pioenvs_dir): def calculate_project_hash(): - structure = [] + structure = [__version__] for d in (util.get_projectsrc_dir(), util.get_projectlib_dir()): if not isdir(d): continue From 241ad8174fd767dd17fb86a3e8b86cd121685095 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 4 Jul 2016 13:40:43 +0300 Subject: [PATCH 02/36] Fix missed --boot flag for sam3x uploader // Issue # 710 --- platformio/builder/scripts/atmelsam.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py index 8fe0a0c7..39440cb0 100644 --- a/platformio/builder/scripts/atmelsam.py +++ b/platformio/builder/scripts/atmelsam.py @@ -103,10 +103,6 @@ if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): LINKFLAGS=[ "-Wl,--entry=Reset_Handler", "-Wl,--start-group" - ], - - UPLOADERFLAGS=[ - "--boot", ] ) @@ -174,6 +170,9 @@ elif upload_protocol == "sam-ba": UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' ) + if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): + env.Append(UPLOADERFLAGS=["--boot"]) + # # Target: Build executable and linkable firmware # From 4dd90d549350dc6a6c59114a447878fa1bf48451 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 4 Jul 2016 18:01:49 +0300 Subject: [PATCH 03/36] Update project template for Qt Creator // Issue #711 --- platformio/ide/tpls/qtcreator/platformio.pro.tpl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platformio/ide/tpls/qtcreator/platformio.pro.tpl b/platformio/ide/tpls/qtcreator/platformio.pro.tpl index b33b91cf..21155e67 100644 --- a/platformio/ide/tpls/qtcreator/platformio.pro.tpl +++ b/platformio/ide/tpls/qtcreator/platformio.pro.tpl @@ -20,7 +20,6 @@ DEFINES += "{{define}}" OTHER_FILES += \ platformio.ini -SOURCES += \ - % for file in src_files: - {{file}} - % end +% for file in src_files: +SOURCES += {{file}} +% end From 2c7c74743ddab85336f1afcdd4c0eb56154b8170 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 4 Jul 2016 19:28:02 +0300 Subject: [PATCH 04/36] Initial support for Arduino M0/Tian boards // Issue #472 --- platformio/boards/arduino.json | 66 ++++++++++++++++++++++++++ platformio/builder/scripts/atmelsam.py | 36 +++++++++++++- 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index 6baf0751..29f22147 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -986,5 +986,71 @@ }, "url": "http://www.arduino.org/products/boards/arduino-m0-pro", "vendor": "Arduino" + }, + "mzeroUSB": { + "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": [ + ["0x2A03", "0x004D"], + ["0x2A03", "0x804D"], + ["0x2A03", "0x004F"], + ["0x2A03", "0x804F"] + ] + }, + "frameworks": ["arduino"], + "name": "Arduino M0 Pro (Native USB Port)", + "platform": "atmelsam", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 32768, + "maximum_size": 262144, + "protocol": "stk500v2", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "section_start": "0x4000" + }, + "url": "http://www.arduino.org/products/boards/arduino-m0-pro", + "vendor": "Arduino" + }, + "tian": { + "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 Tian", + "variant": "arduino_zero", + "ldscript": "samd21g18a_bootloader_org.ld", + "hwids": [ + ["0x10C4", "0xEA70"], + ["0x2A03", "0x8052"] + ] + }, + "frameworks": ["arduino"], + "name": "Arduino Tian", + "platform": "atmelsam", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 32768, + "maximum_size": 262144, + "protocol": "stk500v2", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "section_start": "0x4000" + }, + "url": "http://www.arduino.org/products/boards/arduino-tian", + "vendor": "Arduino" } } diff --git a/platformio/builder/scripts/atmelsam.py b/platformio/builder/scripts/atmelsam.py index 39440cb0..26009472 100644 --- a/platformio/builder/scripts/atmelsam.py +++ b/platformio/builder/scripts/atmelsam.py @@ -18,7 +18,7 @@ from os.path import basename, join -from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, +from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, DefaultEnvironment, SConscript) from platformio.util import get_serialports @@ -173,6 +173,38 @@ elif upload_protocol == "sam-ba": if "sam3x8e" in BOARD_OPTIONS.get("build", {}).get("mcu", ""): env.Append(UPLOADERFLAGS=["--boot"]) +elif upload_protocol == "stk500v2": + env.Append( + BUILDERS=dict( + ElfToHex=Builder( + action=" ".join([ + "$OBJCOPY", + "-O", + "ihex", + "-R", + ".eeprom", + "$SOURCES", + "$TARGET"]), + suffix=".hex" + ) + ) + ) + + env.Replace( + UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"), + UPLOADERFLAGS=[ + "-C", '"%s"' % join("$PIOPACKAGES_DIR", + "tool-avrdude", "avrdude.conf"), + "-v", + "-p", "atmega2560", # Arduino M0/Tian upload hook + "-c", "$UPLOAD_PROTOCOL", + "-P", '"$UPLOAD_PORT"', + "-b", "$UPLOAD_SPEED" + ], + + UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i' + ) + # # Target: Build executable and linkable firmware # @@ -185,6 +217,8 @@ target_elf = env.BuildProgram() if "uploadlazy" in COMMAND_LINE_TARGETS: target_firm = join("$BUILD_DIR", "firmware.bin") +elif upload_protocol == "stk500v2": + target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf) else: target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf) From e8290054c2a0b46fc749373c14093188957d784d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 4 Jul 2016 20:35:29 +0300 Subject: [PATCH 05/36] * Fix missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) // Resolve #710 --- HISTORY.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index eb34ef63..ba641d5a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -8,6 +8,9 @@ PlatformIO 2.0 ~~~~~~~~~~~~~~~~~~~ * Auto-remove project cache when PlatformIO is upgraded +* Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E + Cortex-M3 MCU based boards (Arduino Due, etc) + (`issue #710 `_) 2.11.0 (2016-06-28) ~~~~~~~~~~~~~~~~~~~ From 935f7cd5c371131cddaacabb30526aef7e09c194 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 4 Jul 2016 20:36:02 +0300 Subject: [PATCH 06/36] Fix missing trailing ``\`` for the source files list when generate project for Qt Creator IDE // Resolve #711 --- HISTORY.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index ba641d5a..3a197787 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,6 +11,9 @@ PlatformIO 2.0 * Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) (`issue #710 `_) +* Fixed missing trailing ``\`` for the source files list when generate project + for Qt Creator IDE + (`issue #711 `_) 2.11.0 (2016-06-28) ~~~~~~~~~~~~~~~~~~~ From e8acc9ca390f1a77c72cbff4cb544c209da3f749 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 4 Jul 2016 23:30:34 +0300 Subject: [PATCH 07/36] Improve project generator for CLion IDE --- HISTORY.rst | 1 + docs/ide/clion.rst | 23 ++++---------------- platformio/ide/projectgenerator.py | 13 +---------- platformio/ide/tpls/clion/CMakeLists.txt.tpl | 17 ++------------- 4 files changed, 8 insertions(+), 46 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 3a197787..9d2e66e9 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ PlatformIO 2.0 2.11.1 (2016-??-??) ~~~~~~~~~~~~~~~~~~~ +* Improved project generator for `CLion IDE `__ * Auto-remove project cache when PlatformIO is upgraded * Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) diff --git a/docs/ide/clion.rst b/docs/ide/clion.rst index 4ad92d8f..89ad7cfa 100644 --- a/docs/ide/clion.rst +++ b/docs/ide/clion.rst @@ -43,10 +43,11 @@ command and generate project via :option:`platformio init --ide` command: Then: -1. Import this project via ``Menu: File > Import Project`` +1. Place source files (``*.c, *.cpp, *.h, *.ino, etc.``) to ``src`` directory +2. Import this project via ``Menu: File > Import Project`` and specify root directory where is located :ref:`projectconf` -2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) -3. Build project (*DO NOT RUN*): ``Menu: Run > Build``. +3. Open source file from ``src`` directory +4. Build project (*DO NOT RUN*): ``Menu: Run > Build``. There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on the screenshot below): @@ -63,22 +64,6 @@ the screenshot below): after generating process wont be reflected in IDE. To fix it you need to reinitialize project using :ref:`cmd_init` (repeat it). -.. warning:: - PlatformIO generates empty project by default and **code auto-completion - will not work!** To enable auto-completion please choose one of: - - * Add source files ``*.c, *.cpp, etc`` to ``src`` directory and re-initialize - project with command above - * Manually correct ``add_executable`` command in ``CMakeLists.txt`` file - (will be created in project directory after initialization). - - ``*.ino`` file isn't acceptable for ``add_executable`` command. You should - convert it manually to ``*.cpp``. See `project example `_. - - More info `CLion issue #CPP-3977 `_. - Active discussion is located in - `PlatformIO issue #132 `_. - Articles / Manuals ------------------ diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index b4be53a3..aa78b691 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -132,22 +132,11 @@ class ProjectGenerator(object): return bottle.template(content, **self._tplvars) def _gather_tplvars(self): - src_files = self.get_src_files() - - if (not any([f.endswith((".c", ".cpp")) for f in src_files]) and - self.ide == "clion"): - click.secho( - "Warning! Can not find main source file (*.c, *.cpp). So, " - "code auto-completion is disabled. Please add source files " - "to `src` directory and re-initialize project or edit " - "`CMakeLists.txt` file manually (`add_executable` command).", - fg="yellow") - self._tplvars.update(self.get_project_env()) self._tplvars.update(self.get_project_build_data()) self._tplvars.update({ "project_name": self.get_project_name(), - "src_files": src_files, + "src_files": self.get_src_files(), "user_home_dir": abspath(expanduser("~")), "project_dir": self.project_dir, "systype": util.get_systype(), diff --git a/platformio/ide/tpls/clion/CMakeLists.txt.tpl b/platformio/ide/tpls/clion/CMakeLists.txt.tpl index 25a7b79e..9b56290c 100644 --- a/platformio/ide/tpls/clion/CMakeLists.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeLists.txt.tpl @@ -43,18 +43,5 @@ add_custom_target( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -% if src_files and any([f.endswith((".c", ".cpp")) for f in src_files]): -add_executable({{project_name}} -% for f in src_files: -% if f.endswith((".c", ".cpp")): - {{f.replace("\\", "/")}} -% end -% end -) -% else: -# -# To enable code auto-completion, please specify path -# to main source file (*.c, *.cpp) and uncomment line below -# -# add_executable({{project_name}} src/main_change_me.cpp) -% end +aux_source_directory(src SRC_LIST) +add_executable(${PROJECT_NAME} ${SRC_LIST}) From 52f1502051859b2e9493a5311d31794fe3f28d84 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 4 Jul 2016 23:42:19 +0300 Subject: [PATCH 08/36] Split source files to HEADERS and SOURCES when generate project for Qt Creator IDE // Resolve #713 --- HISTORY.rst | 5 ++++- platformio/ide/projectgenerator.py | 1 - platformio/ide/tpls/qtcreator/platformio.pro.tpl | 7 +++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9d2e66e9..89f4c83a 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -13,8 +13,11 @@ PlatformIO 2.0 Cortex-M3 MCU based boards (Arduino Due, etc) (`issue #710 `_) * Fixed missing trailing ``\`` for the source files list when generate project - for Qt Creator IDE + for `Qt Creator IDE `__ (`issue #711 `_) +* Split source files to ``HEADERS`` and ``SOURCES`` when generate project + for `Qt Creator IDE `__ + (`issue #713 `_) 2.11.0 (2016-06-28) ~~~~~~~~~~~~~~~~~~~ diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index aa78b691..3347ae8d 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -20,7 +20,6 @@ from os.path import (abspath, basename, expanduser, isdir, join, normpath, relpath) import bottle -import click # pylint: disable=wrong-import-order from platformio import app, exception, util diff --git a/platformio/ide/tpls/qtcreator/platformio.pro.tpl b/platformio/ide/tpls/qtcreator/platformio.pro.tpl index 21155e67..2ae9d49d 100644 --- a/platformio/ide/tpls/qtcreator/platformio.pro.tpl +++ b/platformio/ide/tpls/qtcreator/platformio.pro.tpl @@ -17,9 +17,12 @@ INCLUDEPATH += "{{include}}" DEFINES += "{{define}}" % end -OTHER_FILES += \ - platformio.ini +OTHER_FILES += platformio.ini % for file in src_files: +% if file.endswith((".h", ".hpp")): +HEADERS += {{file}} +% else: SOURCES += {{file}} % end +% end From ac9c3f88f9a99d72b09de8e5bacacd151f4e8eb0 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 00:11:48 +0300 Subject: [PATCH 09/36] Automatically install dependent upload tools // Issue #472 --- docs/frameworks/arduino.rst | 77 ++++++++++++++++++++++++++ docs/platforms/atmelavr.rst | 10 ---- docs/platforms/atmelsam.rst | 88 ++++++++++++++++++++++++++++-- docs/platforms/embedded_boards.rst | 77 ++++++++++++++++++++++++++ docs/platforms/espressif.rst | 28 ++++++++++ platformio/platforms/atmelavr.py | 8 +-- platformio/platforms/atmelsam.py | 24 +++++++- 7 files changed, 290 insertions(+), 22 deletions(-) diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index db5b6d92..0e5b8b80 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -92,6 +92,13 @@ Adafruit - Flash - RAM + * - ``adafruit_feather_m0_usb`` + - `Adafruit Feather M0 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``bluefruitmicro`` - `Adafruit Bluefruit Micro `_ - ATMEGA32U4 @@ -377,6 +384,27 @@ Arduino - 32 Kb - 2 Kb + * - ``mkr1000USB`` + - `Arduino MKR1000 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeroUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeropro`` + - `Arduino M0 Pro (Programming Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``nanoatmega168`` - `Arduino Nano ATmega168 `_ - ATMEGA168 @@ -433,6 +461,13 @@ Arduino - 32 Kb - 2.5 Kb + * - ``tian`` + - `Arduino Tian `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``uno`` - `Arduino Uno `_ - ATMEGA328P @@ -802,6 +837,13 @@ Espressif - 4096 Kb - 80 Kb + * - ``esp8285`` + - `Generic ESP8285 Module `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + * - ``esp_wroom_02`` - `ESP-WROOM-02 `_ - ESP8266 @@ -809,6 +851,27 @@ Espressif - 4096 Kb - 50 Kb + * - ``phoenix_v1`` + - `Phoenix 1.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``phoenix_v2`` + - `Phoenix 2.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``wifinfo`` + - `WifInfo `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + Fubarino ~~~~~~~~ @@ -1563,6 +1626,20 @@ SparkFun - 32 Kb - 2 Kb + * - ``sparkfun_samd21_dev_usb`` + - `SparkFun SAMD21 Dev Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``sparkfun_samd21_mini_usb`` + - `SparkFun SAMD21 Mini Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``thing`` - `SparkFun ESP8266 Thing `_ - ESP8266 diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index fb181900..f5ba50c1 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -43,16 +43,6 @@ Packages * - ``tool-micronucleus`` - `Micronucleus `_ -.. warning:: - **Linux Users:** Don't forget to install "udev" rules file - `99-platformio-udev.rules `_ (an instruction is located in the file). - - - **Windows Users:** Please check that you have correctly installed USB - driver from board manufacturer - - - Frameworks ---------- .. list-table:: diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index 3ff2a173..a90b15b6 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -28,23 +28,26 @@ Packages * - Name - Contents + * - ``framework-mbed`` + - `mbed Framework `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ * - ``framework-arduinosam`` - `Arduino Wiring-based Framework (SAM Core, 1.6) `_ + * - ``ldscripts`` + - `Linker Scripts `_ + * - ``framework-simba`` - `Simba Framework `_ * - ``tool-openocd`` - `OpenOCD `_ - * - ``framework-mbed`` - - `mbed Framework `_ - - * - ``ldscripts`` - - `Linker Scripts `_ + * - ``tool-avrdude`` + - `AVRDUDE `_ * - ``tool-bossac`` - `BOSSA CLI `_ @@ -85,6 +88,26 @@ Boards * For more detailed ``board`` information please scroll tables below by horizontal. +Adafruit +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``adafruit_feather_m0_usb`` + - `Adafruit Feather M0 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + Arduino ~~~~~~~ @@ -112,6 +135,34 @@ Arduino - 512 Kb - 32 Kb + * - ``mkr1000USB`` + - `Arduino MKR1000 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeroUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeropro`` + - `Arduino M0 Pro (Programming Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``tian`` + - `Arduino Tian `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``zero`` - `Arduino Zero (Programming Port) `_ - SAMD21G18A @@ -206,3 +257,30 @@ SainSmart - 84 MHz - 512 Kb - 32 Kb + +SparkFun +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``sparkfun_samd21_dev_usb`` + - `SparkFun SAMD21 Dev Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``sparkfun_samd21_mini_usb`` + - `SparkFun SAMD21 Mini Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb diff --git a/docs/platforms/embedded_boards.rst b/docs/platforms/embedded_boards.rst index bd52ca0c..2b8cc1c4 100644 --- a/docs/platforms/embedded_boards.rst +++ b/docs/platforms/embedded_boards.rst @@ -78,6 +78,13 @@ Adafruit - Flash - RAM + * - ``adafruit_feather_m0_usb`` + - `Adafruit Feather M0 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``bluefruitmicro`` - `Adafruit Bluefruit Micro `_ - ATMEGA32U4 @@ -363,6 +370,27 @@ Arduino - 32 Kb - 2 Kb + * - ``mkr1000USB`` + - `Arduino MKR1000 `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeroUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``mzeropro`` + - `Arduino M0 Pro (Programming Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``nanoatmega168`` - `Arduino Nano ATmega168 `_ - ATMEGA168 @@ -419,6 +447,13 @@ Arduino - 32 Kb - 2.5 Kb + * - ``tian`` + - `Arduino Tian `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``uno`` - `Arduino Uno `_ - ATMEGA328P @@ -957,6 +992,13 @@ Espressif - 4096 Kb - 80 Kb + * - ``esp8285`` + - `Generic ESP8285 Module `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + * - ``esp_wroom_02`` - `ESP-WROOM-02 `_ - ESP8266 @@ -964,6 +1006,27 @@ Espressif - 4096 Kb - 50 Kb + * - ``phoenix_v1`` + - `Phoenix 1.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``phoenix_v2`` + - `Phoenix 2.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``wifinfo`` + - `WifInfo `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + Freescale ~~~~~~~~~ @@ -2322,6 +2385,20 @@ SparkFun - 32 Kb - 2 Kb + * - ``sparkfun_samd21_dev_usb`` + - `SparkFun SAMD21 Dev Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + + * - ``sparkfun_samd21_mini_usb`` + - `SparkFun SAMD21 Mini Breakout `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``thing`` - `SparkFun ESP8266 Thing `_ - ESP8266 diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst index f8333846..56ffbc43 100644 --- a/docs/platforms/espressif.rst +++ b/docs/platforms/espressif.rst @@ -210,6 +210,13 @@ Espressif - 4096 Kb - 80 Kb + * - ``esp8285`` + - `Generic ESP8285 Module `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + * - ``esp_wroom_02`` - `ESP-WROOM-02 `_ - ESP8266 @@ -217,6 +224,27 @@ Espressif - 4096 Kb - 50 Kb + * - ``phoenix_v1`` + - `Phoenix 1.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``phoenix_v2`` + - `Phoenix 2.0 `_ + - ESP8266 + - 80 MHz + - 1024 Kb + - 80 Kb + + * - ``wifinfo`` + - `WifInfo `_ + - ESP8266 + - 80 MHz + - 448 Kb + - 80 Kb + NodeMCU ~~~~~~~ diff --git a/platformio/platforms/atmelavr.py b/platformio/platforms/atmelavr.py index 62fef55d..4469b652 100644 --- a/platformio/platforms/atmelavr.py +++ b/platformio/platforms/atmelavr.py @@ -36,11 +36,9 @@ class AtmelavrPlatform(BasePlatform): }, "tool-avrdude": { - "alias": "uploader" }, "tool-micronucleus": { - "alias": "uploader" }, "framework-arduinoavr": { @@ -58,10 +56,10 @@ class AtmelavrPlatform(BasePlatform): def configure_default_packages(self, envoptions, targets): if envoptions.get("board"): board = get_boards(envoptions.get("board")) - disable_tool = "tool-micronucleus" if "digispark" in board['build']['core']: - disable_tool = "tool-avrdude" - del self.PACKAGES[disable_tool]['alias'] + self.PACKAGES['tool-micronucleus']['alias'] = "uploader" + else: + self.PACKAGES['tool-avrdude']['alias'] = "uploader" return BasePlatform.configure_default_packages( self, envoptions, targets) diff --git a/platformio/platforms/atmelsam.py b/platformio/platforms/atmelsam.py index 0e8d7da2..e12f02ba 100644 --- a/platformio/platforms/atmelsam.py +++ b/platformio/platforms/atmelsam.py @@ -13,6 +13,7 @@ # limitations under the License. from platformio.platforms.base import BasePlatform +from platformio.util import get_boards class AtmelsamPlatform(BasePlatform): @@ -49,13 +50,32 @@ class AtmelsamPlatform(BasePlatform): }, "tool-bossac": { - "alias": "uploader" }, "tool-openocd": { - "alias": "uploader" + }, + + "tool-avrdude": { } } def get_name(self): return "Atmel SAM" + + def configure_default_packages(self, envoptions, targets): + if envoptions.get("board"): + board = get_boards(envoptions.get("board")) + upload_protocol = board.get("upload", {}).get("protocol", None) + upload_tool = None + if upload_protocol == "openocd": + upload_tool = "tool-openocd" + elif upload_protocol == "sam-ba": + upload_tool = "tool-bossac" + elif upload_protocol == "stk500v2": + upload_tool = "tool-avrdude" + + if upload_tool: + self.PACKAGES[upload_tool]['alias'] = "uploader" + + return BasePlatform.configure_default_packages( + self, envoptions, targets) From 63ae732e72a1b37f71e0b6d9933ef57214db064c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 00:14:00 +0300 Subject: [PATCH 10/36] Push 2.11.1.dev1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index 6d594c01..1891ceb7 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, "1.dev0") +VERSION = (2, 11, "1.dev1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From 9160e61ac79ce7b75b1496cf5dbdcd68ad015cee Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 12:34:37 +0300 Subject: [PATCH 11/36] Documented uploading of EEPROM data --- HISTORY.rst | 2 ++ docs/platforms/atmelavr_extra.rst | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 89f4c83a..83892644 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 2.0 2.11.1 (2016-??-??) ~~~~~~~~~~~~~~~~~~~ +* Documented `uploading of EEPROM data `__ + (from EEMEM directive) * Improved project generator for `CLion IDE `__ * Auto-remove project cache when PlatformIO is upgraded * Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E diff --git a/docs/platforms/atmelavr_extra.rst b/docs/platforms/atmelavr_extra.rst index 8ef5a20f..754de6e0 100644 --- a/docs/platforms/atmelavr_extra.rst +++ b/docs/platforms/atmelavr_extra.rst @@ -95,6 +95,13 @@ Configuration for the programmers: upload_port = SERIAL_PORT_HERE upload_speed = 19200 +Upload EEPROM data +------------------ + +To upload EEPROM data (from EEMEM directive) you need to use ``uploadeep`` +target instead ``upload`` for :option:`platformio run --target` command. +For example, ``platformio run -t uploadeep``. + Articles -------- From 5cd3f9d84dfed77fc0f67baacee138dbd7507102 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 13:18:31 +0300 Subject: [PATCH 12/36] Keep user changes for ".gitignore" file when re-generate/update project data --- HISTORY.rst | 1 + platformio/ide/projectgenerator.py | 40 ++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 83892644..b381be6b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,6 +11,7 @@ PlatformIO 2.0 (from EEMEM directive) * Improved project generator for `CLion IDE `__ * Auto-remove project cache when PlatformIO is upgraded +* Keep user changes for ``.gitignore`` file when re-generate/update project data * Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) (`issue #710 `_) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 3347ae8d..53f776bd 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -16,8 +16,8 @@ import json import os import re import sys -from os.path import (abspath, basename, expanduser, isdir, join, normpath, - relpath) +from os.path import (abspath, basename, expanduser, isdir, isfile, join, + normpath, relpath) import bottle @@ -113,16 +113,18 @@ class ProjectGenerator(object): return tpls def generate(self): - for _relpath, _path in self.get_tpls(): - tpl_dir = self.project_dir - if _relpath: - tpl_dir = join(self.project_dir, _relpath) - if not isdir(tpl_dir): - os.makedirs(tpl_dir) + for tpl_relpath, tpl_path in self.get_tpls(): + dst_dir = self.project_dir + if tpl_relpath: + dst_dir = join(self.project_dir, tpl_relpath) + if not isdir(dst_dir): + os.makedirs(dst_dir) - file_name = basename(_path)[:-4] - with open(join(tpl_dir, file_name), "w") as f: - f.write(self._render_tpl(_path).encode("utf8")) + file_name = basename(tpl_path)[:-4] + self._merge_contents( + join(dst_dir, file_name), + self._render_tpl(tpl_path).encode("utf8") + ) def _render_tpl(self, tpl_path): content = "" @@ -130,6 +132,22 @@ class ProjectGenerator(object): content = f.read() return bottle.template(content, **self._tplvars) + def _merge_contents(self, dst_path, contents): + file_name = basename(dst_path) + + # merge .gitignore + if file_name == ".gitignore" and isfile(dst_path): + contents = [l.strip() for l in contents.split("\n") if l.strip()] + with open(dst_path) as f: + for line in f.readlines(): + line = line.strip() + if line and line not in contents: + contents.append(line) + contents = "\n".join(contents) + + with open(dst_path, "w") as f: + f.write(contents) + def _gather_tplvars(self): self._tplvars.update(self.get_project_env()) self._tplvars.update(self.get_project_build_data()) From db204941ed5adb8ad30ba28165477aa5fa2264ce Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 13:28:22 +0300 Subject: [PATCH 13/36] Fix PyLint warning --- platformio/ide/projectgenerator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 53f776bd..102f7878 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -132,7 +132,8 @@ class ProjectGenerator(object): content = f.read() return bottle.template(content, **self._tplvars) - def _merge_contents(self, dst_path, contents): + @staticmethod + def _merge_contents(dst_path, contents): file_name = basename(dst_path) # merge .gitignore From 9ba96d3673aa5d59422b3bea798a779f799a8e6f Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Tue, 5 Jul 2016 17:06:14 +0300 Subject: [PATCH 14/36] Update microchippic32 platform and boards --- platformio/boards/microchippic32.json | 27 +++++++++++++++++-- .../builder/scripts/frameworks/arduino.py | 5 +++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/platformio/boards/microchippic32.json b/platformio/boards/microchippic32.json index 83af9110..7090d97c 100644 --- a/platformio/boards/microchippic32.json +++ b/platformio/boards/microchippic32.json @@ -236,7 +236,7 @@ "f_cpu": "80000000L", "ldscript": "chipKIT-application-32MX440F512.ld", "mcu": "32MX440F512H", - "variant": "Default_64" + "variant": "PONTECH_UAV100" }, "frameworks": ["arduino"], "name": "PONTECH UAV100", @@ -510,7 +510,7 @@ "core": "pic32", "extra_flags": "-D_BOARD_OPENSCOPE_", "f_cpu": "200000000L", - "ldscript": "MZ-application-32MZ2048ECX.ld", + "ldscript": "OpenScope.ld", "mcu": "32MZ2048EFG124", "variant": "OpenScope" }, @@ -549,5 +549,28 @@ }, "url": "http://shop.openbci.com/", "vendor": "OpenBCI" + }, + + "lenny": { + "build": { + "core": "pic32", + "extra_flags": "-D_BOARD_LENNY_ -D_USE_USB_FOR_SERIAL_", + "f_cpu": "40000000L", + "ldscript": "chipKIT-application-32MX270F256.ld", + "mcu": "32MX270F256D", + "variant": "Lenny" + }, + "frameworks": ["arduino"], + "name": "chipKIT Lenny", + "platform": "microchippic32", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 122880, + "protocol": "stk500v2", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "http://chipkit.net/tag/lenny/", + "vendor": "chipKIT" } } diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 21be9b6a..1e3874b3 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -115,7 +115,10 @@ elif env.get("PLATFORM") == "microchippic32": "$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}" ) - ] + ], + + CPPDEFINES=["ARDUINO_ARCH_PIC32"] + ) elif "intel" in env.get("PLATFORM"): From ae81ec043d6026fa5e4090afca54cedccf3d0f6d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 5 Jul 2016 17:40:00 +0300 Subject: [PATCH 15/36] Update history --- HISTORY.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index b381be6b..8cad7732 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 2.0 2.11.1 (2016-??-??) ~~~~~~~~~~~~~~~~~~~ +* Added support for Microchip chipKIT Lenny board +* Updated Microchip PIC32 Arduino framework to v1.2.1 * Documented `uploading of EEPROM data `__ (from EEMEM directive) * Improved project generator for `CLion IDE `__ From 8fe8318c7740e2b4e9c45fff2ff23b9f26d6f77f Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Wed, 6 Jul 2016 11:02:36 +0300 Subject: [PATCH 16/36] Add Arduino M0 as a separate board --- platformio/boards/arduino.json | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index 29f22147..e5ac7c25 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -987,14 +987,14 @@ "url": "http://www.arduino.org/products/boards/arduino-m0-pro", "vendor": "Arduino" }, - "mzeroUSB": { + "mzeroproUSB": { "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", + "usb_product": "Arduino M0 Pro", "variant": "arduino_zero", "ldscript": "samd21g18a_bootloader_org.ld", "hwids": [ @@ -1021,6 +1021,40 @@ "url": "http://www.arduino.org/products/boards/arduino-m0-pro", "vendor": "Arduino" }, + "mzeroUSB": { + "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", + "variant": "arduino_zero", + "ldscript": "samd21g18a_bootloader_org.ld", + "hwids": [ + ["0x2A03", "0x004D"], + ["0x2A03", "0x804D"], + ["0x2A03", "0x004E"], + ["0x2A03", "0x804E"] + ] + }, + "frameworks": ["arduino"], + "name": "Arduino M0", + "platform": "atmelsam", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 32768, + "maximum_size": 262144, + "protocol": "stk500v2", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true, + "section_start": "0x4000" + }, + "url": "http://www.arduino.org/products/boards/arduino-m0", + "vendor": "Arduino" + }, "tian": { "build": { "core": "arduino_zero", From 7f47a2fd25159c611c88e3f4d8617c35cf3a911d Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 6 Jul 2016 13:27:36 +0300 Subject: [PATCH 17/36] Update boards list --- docs/frameworks/arduino.rst | 29 ++++++++++++++++++++++++++++- docs/platforms/atmelsam.rst | 9 ++++++++- docs/platforms/embedded_boards.rst | 29 ++++++++++++++++++++++++++++- docs/platforms/microchippic32.rst | 20 ++++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-) diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 0e5b8b80..e0d9c67f 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -392,7 +392,7 @@ Arduino - 32 Kb * - ``mzeroUSB`` - - `Arduino M0 Pro (Native USB Port) `_ + - `Arduino M0 `_ - SAMD21G18A - 48 MHz - 256 Kb @@ -405,6 +405,13 @@ Arduino - 256 Kb - 32 Kb + * - ``mzeroproUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``nanoatmega168`` - `Arduino Nano ATmega168 `_ - ATMEGA168 @@ -1857,6 +1864,26 @@ Wicked Device - 128 Kb - 16 Kb +chipKIT +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``lenny`` + - `chipKIT Lenny `_ + - 32MX270F256D + - 40 MHz + - 128 Kb + - 32 Kb + element14 ~~~~~~~~~ diff --git a/docs/platforms/atmelsam.rst b/docs/platforms/atmelsam.rst index a90b15b6..12cbc41a 100644 --- a/docs/platforms/atmelsam.rst +++ b/docs/platforms/atmelsam.rst @@ -143,7 +143,7 @@ Arduino - 32 Kb * - ``mzeroUSB`` - - `Arduino M0 Pro (Native USB Port) `_ + - `Arduino M0 `_ - SAMD21G18A - 48 MHz - 256 Kb @@ -156,6 +156,13 @@ Arduino - 256 Kb - 32 Kb + * - ``mzeroproUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``tian`` - `Arduino Tian `_ - SAMD21G18A diff --git a/docs/platforms/embedded_boards.rst b/docs/platforms/embedded_boards.rst index 2b8cc1c4..f5a6a0d6 100644 --- a/docs/platforms/embedded_boards.rst +++ b/docs/platforms/embedded_boards.rst @@ -378,7 +378,7 @@ Arduino - 32 Kb * - ``mzeroUSB`` - - `Arduino M0 Pro (Native USB Port) `_ + - `Arduino M0 `_ - SAMD21G18A - 48 MHz - 256 Kb @@ -391,6 +391,13 @@ Arduino - 256 Kb - 32 Kb + * - ``mzeroproUSB`` + - `Arduino M0 Pro (Native USB Port) `_ + - SAMD21G18A + - 48 MHz + - 256 Kb + - 32 Kb + * - ``nanoatmega168`` - `Arduino Nano ATmega168 `_ - ATMEGA168 @@ -2740,6 +2747,26 @@ Wicked Device - 128 Kb - 16 Kb +chipKIT +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``lenny`` + - `chipKIT Lenny `_ + - 32MX270F256D + - 40 MHz + - 128 Kb + - 32 Kb + element14 ~~~~~~~~~ diff --git a/docs/platforms/microchippic32.rst b/docs/platforms/microchippic32.rst index 7f38d2bb..51c92e8e 100644 --- a/docs/platforms/microchippic32.rst +++ b/docs/platforms/microchippic32.rst @@ -332,6 +332,26 @@ UBW32 - 512 Kb - 128 Kb +chipKIT +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``lenny`` + - `chipKIT Lenny `_ + - 32MX270F256D + - 40 MHz + - 128 Kb + - 32 Kb + element14 ~~~~~~~~~ From fd924f29f3ac9ca783ca3d8cb0d798cfd4d25cd8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 6 Jul 2016 15:28:39 +0300 Subject: [PATCH 18/36] Update examples --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index ed668f6e..6c0a7e44 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit ed668f6e31d2f99736b10cac209bd59318aa6ecb +Subproject commit 6c0a7e4458056fa04657a14422aeae277560341d From f767feeef9cd93f9a30d1611d74e7a3c99d86708 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Thu, 7 Jul 2016 00:26:33 +0300 Subject: [PATCH 19/36] Add new articles --- docs/articles.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/articles.rst b/docs/articles.rst index 3dbe604c..3ceb7fce 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -23,6 +23,9 @@ Here are recent articles about PlatformIO: 2016 ^^^^ +* Jul 5, 2016 - **Ivan Kravets, Ph.D.** - `Explore the new development instruments for Arduino with PlatformIO ecosystem `_ +* Jul 5, 2016 - **Belinda** - `Monte Bianco Arduino Developer Summit `_ +* Jul 1, 2016 - **Tam Hanna** - `Mikrocontroller-Gipfel in den Alpen: Arduino Developer Summit, Tag eins (Microcontroller peaks in the Alps: Arduino Developer Summit, Day One, German) `_ * Jun 14, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 2/3: Firmware Continuous Test & Build `_ * Jun 13, 2016 - **Daniel Eichhorn** - `New Weather Station Demo on Github `_ * Jun 12, 2016 - **Glyn Hudson** - `OpenEnergyMonitor Part 1/3: PlatformIO open-source embedded development ecosystem `_ From e33e950712eac0f1314a9f90d689c2786a5e8cbc Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 9 Jul 2016 14:38:49 +0300 Subject: [PATCH 20/36] Add example dynamic `build_flags` --- docs/projectconf.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/projectconf.rst b/docs/projectconf.rst index f7dbc86c..f340833b 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -351,6 +351,10 @@ Example: [env:specific_ld_script] build_flags = -Wl,-T/path/to/ld_script.ld + [env:exec_command] + # get VCS revision "on-the-fly" + build_flags = !echo "-DPIO_SRC_REV="$(git rev-parse HEAD) + For more detailed information about available flags/options go to: From a73a710364a7f16ee1b96d1d4111a431c77ff0b8 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 9 Jul 2016 15:16:42 +0300 Subject: [PATCH 21/36] Iterating the dictionary directly instead of calling .keys() --- platformio/builder/scripts/frameworks/mbed.py | 2 +- platformio/builder/tools/platformio.py | 2 +- platformio/commands/lib.py | 2 +- platformio/maintenance.py | 4 ++-- platformio/telemetry.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index 3c7dc2e0..16503122 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -86,7 +86,7 @@ MBED_LIBS_MAP = { def get_mbedlib_includes(): result = [] - for lib in MBED_LIBS_MAP.keys(): + for lib in MBED_LIBS_MAP: includes = [] lib_dir = join(env.subst("$PLATFORMFW_DIR"), "libs", lib) for _, _, files in walk(lib_dir): diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index e1b599c8..c9758fa1 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -154,7 +154,7 @@ def ProcessUnFlags(env, flags): all_flags.extend(items) all_flags = set(all_flags) - for key in parsed_flags.keys(): + for key in parsed_flags: cur_flags = set(env.get(key, [])) for item in cur_flags & all_flags: while item in env[key]: diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index f2bd73e5..bbf8bb09 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -153,7 +153,7 @@ def lib_install(ctx, libid, version): def lib_install_dependency(ctx, data): assert isinstance(data, dict) query = [] - for key in data.keys(): + for key in data: if key in ("authors", "frameworks", "platforms", "keywords"): values = data[key] if not isinstance(values, list): diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 34395604..d2e944eb 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -101,7 +101,7 @@ class Upgrader(object): prev_platforms = [] # remove platform's folder (obsolete package structure) - for name in PlatformFactory.get_platforms().keys(): + for name in PlatformFactory.get_platforms(): pdir = join(get_home_dir(), name) if not isdir(pdir): continue @@ -234,7 +234,7 @@ def check_internal_updates(ctx, what): outdated_items = [] if what == "platforms": - for platform in PlatformFactory.get_platforms(installed=True).keys(): + for platform in PlatformFactory.get_platforms(installed=True): p = PlatformFactory.newPlatform(platform) if p.is_outdated(): outdated_items.append(platform) diff --git a/platformio/telemetry.py b/platformio/telemetry.py index 48ca79ab..f8fea43c 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -326,7 +326,7 @@ def backup_reports(items): for params in items: # skip static options - for key in params.keys(): + for key in params: if key in ("v", "tid", "cid", "cd1", "cd2", "sr", "an"): del params[key] From f12c721f448db3d22e7204d55f8324db44189506 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 9 Jul 2016 15:26:38 +0300 Subject: [PATCH 22/36] Iterating the dictionary directly instead of calling .keys() --- platformio/platforms/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 8486967d..5566f37b 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -330,7 +330,7 @@ class BasePlatform(object): def get_installed_packages(self): pm = PackageManager() - return [n for n in self.get_packages().keys() if pm.is_installed(n)] + return [n for n in self.get_packages() if pm.is_installed(n)] def install(self, with_packages=None, without_packages=None, skip_default_packages=False): @@ -380,7 +380,7 @@ class BasePlatform(object): deppkgs = deppkgs.union(set(p.get_packages().keys())) pm = PackageManager() - for name in self.get_packages().keys(): + for name in self.get_packages(): if not pm.is_installed(name) or name in deppkgs: continue pm.uninstall(name) From a0d9173b4f3f961cb0d1634bd346ee881eab7474 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 9 Jul 2016 18:44:45 +0300 Subject: [PATCH 23/36] Add "Rebuild C/C++ Project Index" target to CLion and Eclipse IDEs --- HISTORY.rst | 1 + docs/ide/clion.rst | 18 +++-- docs/ide/eclipse.rst | 19 ++++-- platformio/__init__.py | 2 +- platformio/builder/tools/piomisc.py | 10 ++- platformio/commands/init.py | 25 +++++-- platformio/ide/projectgenerator.py | 7 +- .../ide/tpls/clion/.idea/workspace.xml.tpl | 65 ++++++------------- platformio/ide/tpls/clion/CMakeLists.txt.tpl | 11 ++-- .../ide/tpls/clion/CMakeListsPrivate.txt.tpl | 13 +++- platformio/ide/tpls/eclipse/.cproject.tpl | 8 +++ platformio/telemetry.py | 2 +- 12 files changed, 107 insertions(+), 74 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 8cad7732..c9629b4d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -11,6 +11,7 @@ PlatformIO 2.0 * Updated Microchip PIC32 Arduino framework to v1.2.1 * Documented `uploading of EEPROM data `__ (from EEMEM directive) +* Added ``Rebuild C/C++ Project Index`` target to CLion and Eclipse IDEs * Improved project generator for `CLion IDE `__ * Auto-remove project cache when PlatformIO is upgraded * Keep user changes for ``.gitignore`` file when re-generate/update project data diff --git a/docs/ide/clion.rst b/docs/ide/clion.rst index 89ad7cfa..bbd6584a 100644 --- a/docs/ide/clion.rst +++ b/docs/ide/clion.rst @@ -53,16 +53,20 @@ There are 6 predefined targets for building (*NOT FOR RUNNING*, see marks on the screenshot below): * ``PLATFORMIO_BUILD`` - Build project without auto-uploading -* ``PLATFORMIO_UPLOAD`` - Build and upload (if no errors). -* ``PLATFORMIO_CLEAN`` - Clean compiled objects. -* ``PLATFORMIO_PROGRAM`` - Build and upload using external programmer (if no errors), see :ref:`atmelavr_upload_via_programmer`. -* ``PLATFORMIO_UPLOADFS`` - Upload files to file system SPIFFS, see :ref:`platform_espressif_uploadfs`. -* ``PLATFORMIO_UPDATE`` - Update installed platforms and libraries via :ref:`cmd_update`. +* ``PLATFORMIO_UPLOAD`` - Build and upload (if no errors) +* ``PLATFORMIO_CLEAN`` - Clean compiled objects +* ``PLATFORMIO_PROGRAM`` - Build and upload using external programmer + (if no errors), see :ref:`atmelavr_upload_via_programmer` +* ``PLATFORMIO_UPLOADFS`` - Upload files to file system SPIFFS, + see :ref:`platform_espressif_uploadfs` +* ``PLATFORMIO_UPDATE`` - Update installed platforms and libraries via :ref:`cmd_update` +* ``PLATFORMIO_REBUILD_PROJECT_INDEX`` - Rebuild C/C++ Index for the Project. + Allows to fix code completion and code linting issues. .. warning:: The libraries which are added, installed or used in the project - after generating process wont be reflected in IDE. To fix it you - need to reinitialize project using :ref:`cmd_init` (repeat it). + after generating process wont be reflected in IDE. To fix it please run + ``PLATFORMIO_REBUILD_PROJECT_INDEX`` target. Articles / Manuals ------------------ diff --git a/docs/ide/eclipse.rst b/docs/ide/eclipse.rst index 230de1f9..2ef869f8 100644 --- a/docs/ide/eclipse.rst +++ b/docs/ide/eclipse.rst @@ -51,7 +51,7 @@ Then: ``Menu: File > Import... > General > Existing Projects into Workspace > Next`` and specify root directory where is located :ref:`projectconf` 2. Open source file from ``src`` directory (``*.c, *.cpp, *.ino, etc.``) -3. Build project using ``Menu: Project > Build Project`` or preconfigured +3. Build project using ``Menu: Project > Build Project`` or pre-configured Make Targets (see screenshot below): + ``PlatformIO: Build`` - Build project without auto-uploading @@ -59,17 +59,24 @@ Then: + ``PlatformIO: Upload`` - Build and upload (if no errors) + ``PlatformIO: Upload using Programmer`` see :ref:`atmelavr_upload_via_programmer` + ``PlatformIO: Upload SPIFFS image`` see :ref:`platform_espressif_uploadfs` - + ``PlatformIO: Update platforms and libraries`` - Update installed platforms and libraries via :ref:`cmd_update`. + + ``PlatformIO: Update platforms and libraries`` - Update installed + platforms and libraries via :ref:`cmd_update` + + ``PlatformIO: Rebuild C/C++ Project Index`` - Rebuild C/C++ Index for the Project. + Allows to fix code completion and code linting issues. If you have some problems with unresolved includes, defines, etc., then -* Restart Eclipse IDE -* Rebuild index using ``Menu: Project > C/C++ Index > Rebuild``. +1. Rebuild PlatformIO Project Index: + ``PlatformIO: Rebuild C/C++ Project Index`` target +2. Rebuild Eclipse Project Index: ``Menu: Project > C/C++ Index > Rebuild`` +3. Refresh Project, right click on the project ``Project > Refresh`` (F5) or + restart Eclipse IDE. .. warning:: The libraries which are added, installed or used in the project - after generating process wont be reflected in IDE. To fix it you - need to reinitialize project using :ref:`cmd_init` (repeat it). + after generating process wont be reflected in IDE. To fix it please run + ``PlatformIO: Rebuild C/C++ Project Index`` target and right click on the + project and ``Project > Refresh`` (F5). Live Integration ---------------- diff --git a/platformio/__init__.py b/platformio/__init__.py index 1891ceb7..adf76f97 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, "1.dev1") +VERSION = (2, 11, "1.dev2") __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 a848ea0e..29ab41a2 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -202,7 +202,9 @@ def DumpIDEData(env): def get_defines(env_): defines = [] # global symbols - for item in env.Flatten(env_.get("CPPDEFINES", [])): + for item in env_.get("CPPDEFINES", []): + if isinstance(item, list) or isinstance(item, tuple): + item = "=".join(item) defines.append(env_.subst(item).replace('\\"', '"')) # special symbol for Atmel AVR MCU @@ -224,13 +226,17 @@ def DumpIDEData(env): "includes": get_includes(env_), "cc_flags": env_.subst(LINTCCOM), "cxx_flags": env_.subst(LINTCXXCOM), + "cc_path": where_is_program( + env_.subst("$CC"), env_.subst("${ENV['PATH']}")), "cxx_path": where_is_program( env_.subst("$CXX"), env_.subst("${ENV['PATH']}")) } # https://github.com/platformio/platformio-atom-ide/issues/34 _new_defines = [] - for item in env.Flatten(env_.get("CPPDEFINES", [])): + for item in env_.get("CPPDEFINES", []): + if isinstance(item, list) or isinstance(item, tuple): + item = "=".join(item) item = item.replace('\\"', '"') if " " in item: _new_defines.append(item.replace(" ", "\\\\ ")) diff --git a/platformio/commands/init.py b/platformio/commands/init.py index d9b48288..550e839c 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -23,11 +23,10 @@ from platformio.commands.platforms import \ platforms_install as cli_platforms_install from platformio.ide.projectgenerator import ProjectGenerator from platformio.platforms.base import PlatformFactory -from platformio.util import get_boards, get_source_dir def validate_boards(ctx, param, value): # pylint: disable=W0613 - unknown_boards = set(value) - set(get_boards().keys()) + unknown_boards = set(value) - set(util.get_boards().keys()) try: assert not unknown_boards return value @@ -84,6 +83,10 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 ) if ide: + if not board: + board = get_first_board(project_dir) + if board: + board = [board] if not board: raise exception.BoardNotDefined() if len(board) > 1: @@ -95,8 +98,7 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 " '%s'." % (board[0], ", ".join(board)), fg="yellow" ) - pg = ProjectGenerator( - project_dir, ide, board[0]) + pg = ProjectGenerator(project_dir, ide, board[0]) pg.generate() click.secho( @@ -112,10 +114,21 @@ def cli(ctx, project_dir, board, ide, # pylint: disable=R0913 ) +def get_first_board(project_dir): + with util.cd(project_dir): + config = util.get_project_config() + for section in config.sections(): + if not section.startswith("env:"): + continue + elif config.has_option(section, "board"): + return config.get(section, "board") + return None + + def init_base_project(project_dir): platformio_ini = join(project_dir, "platformio.ini") if not isfile(platformio_ini): - copyfile(join(get_source_dir(), "projectconftpl.ini"), + copyfile(join(util.get_source_dir(), "projectconftpl.ini"), platformio_ini) lib_dir = join(project_dir, "lib") @@ -260,7 +273,7 @@ def init_cvs_ignore(project_dir): def fill_project_envs( # pylint: disable=too-many-arguments,too-many-locals ctx, platformio_ini, board_types, enable_auto_uploading, env_prefix, force_download): - builtin_boards = get_boards() + builtin_boards = util.get_boards() content = [] used_boards = [] used_platforms = [] diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 102f7878..4c8c210f 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -32,6 +32,9 @@ class ProjectGenerator(object): self.board = board self._tplvars = {} + with util.cd(self.project_dir): + self.project_src_dir = util.get_projectsrc_dir() + self._gather_tplvars() @staticmethod @@ -94,7 +97,8 @@ class ProjectGenerator(object): def get_src_files(self): result = [] with util.cd(self.project_dir): - for root, _, files in os.walk(util.get_projectsrc_dir()): + for root, _, files in os.walk(self.project_src_dir): + print root, files for f in files: result.append(relpath(join(root, f))) return result @@ -157,6 +161,7 @@ class ProjectGenerator(object): "src_files": self.get_src_files(), "user_home_dir": abspath(expanduser("~")), "project_dir": self.project_dir, + "project_src_dir": self.project_src_dir, "systype": util.get_systype(), "platformio_path": self._fix_os_path( util.where_is_program("platformio")), diff --git a/platformio/ide/tpls/clion/.idea/workspace.xml.tpl b/platformio/ide/tpls/clion/.idea/workspace.xml.tpl index 582177fb..59426c43 100644 --- a/platformio/ide/tpls/clion/.idea/workspace.xml.tpl +++ b/platformio/ide/tpls/clion/.idea/workspace.xml.tpl @@ -10,6 +10,7 @@ + @@ -39,28 +40,14 @@ - - - - - - - - - + + % for file in src_files: - - - - - - - - - + + - % end + % end @@ -113,6 +100,8 @@ + + @@ -120,13 +109,13 @@ @@ -201,7 +190,11 @@ - + + + + + @@ -209,6 +202,7 @@ + @@ -225,27 +219,10 @@ - + - - - - - - - - - - - - - - - - - - + @@ -280,4 +257,4 @@ - \ No newline at end of file + diff --git a/platformio/ide/tpls/clion/CMakeLists.txt.tpl b/platformio/ide/tpls/clion/CMakeLists.txt.tpl index 9b56290c..a31664d0 100644 --- a/platformio/ide/tpls/clion/CMakeLists.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeLists.txt.tpl @@ -3,10 +3,6 @@ project({{project_name}}) include(CMakeListsPrivate.txt) -% for define in defines: -add_definitions(-D{{!define}}) -% end - add_custom_target( PLATFORMIO_BUILD ALL COMMAND ${PLATFORMIO_CMD} -f -c clion run @@ -43,5 +39,10 @@ add_custom_target( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -aux_source_directory(src SRC_LIST) +add_custom_target( + PLATFORMIO_REBUILD_PROJECT_INDEX ALL + COMMAND ${PLATFORMIO_CMD} -f -c clion init --ide clion + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) + add_executable(${PROJECT_NAME} ${SRC_LIST}) diff --git a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl index ef859843..40414aa8 100644 --- a/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl +++ b/platformio/ide/tpls/clion/CMakeListsPrivate.txt.tpl @@ -1,6 +1,15 @@ set(ENV{PATH} "{{env_path}}") set(PLATFORMIO_CMD "{{platformio_path}}") +SET(CMAKE_C_COMPILER "{{cc_path}}") +SET(CMAKE_CXX_COMPILER "{{cxx_path}}") +SET(CMAKE_CXX_FLAGS_DISTRIBUTION "{{cxx_flags}}") +SET(CMAKE_C_FLAGS_DISTRIBUTION "{{cc_flags}}") + +% for define in defines: +add_definitions(-D{{!define}}) +% end + % for include in includes: % if include.startswith(user_home_dir): % if "windows" in systype: @@ -11,4 +20,6 @@ include_directories("$ENV{HOME}{{include.replace(user_home_dir, '').replace("\\" % else: include_directories("{{include.replace("\\", "/")}}") % end -% end \ No newline at end of file +% end + +aux_source_directory({{project_src_dir}} SRC_LIST) diff --git a/platformio/ide/tpls/eclipse/.cproject.tpl b/platformio/ide/tpls/eclipse/.cproject.tpl index b21e2aa5..fb03c356 100644 --- a/platformio/ide/tpls/eclipse/.cproject.tpl +++ b/platformio/ide/tpls/eclipse/.cproject.tpl @@ -166,6 +166,14 @@ true false + + platformio + -f -c eclipse + init --ide eclipse + true + true + false + diff --git a/platformio/telemetry.py b/platformio/telemetry.py index f8fea43c..48ca79ab 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -326,7 +326,7 @@ def backup_reports(items): for params in items: # skip static options - for key in params: + for key in params.keys(): if key in ("v", "tid", "cid", "cd1", "cd2", "sr", "an"): del params[key] From 005665144771f7a69b9ddb70d4234769e6cde6be Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 9 Jul 2016 18:49:35 +0300 Subject: [PATCH 24/36] Remove debug info --- platformio/ide/projectgenerator.py | 1 - 1 file changed, 1 deletion(-) diff --git a/platformio/ide/projectgenerator.py b/platformio/ide/projectgenerator.py index 4c8c210f..4c0a4365 100644 --- a/platformio/ide/projectgenerator.py +++ b/platformio/ide/projectgenerator.py @@ -98,7 +98,6 @@ class ProjectGenerator(object): result = [] with util.cd(self.project_dir): for root, _, files in os.walk(self.project_src_dir): - print root, files for f in files: result.append(relpath(join(root, f))) return result From 581fd356cd77dbb56b2510e7bf2f926e80e5ba11 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 10 Jul 2016 19:15:55 +0300 Subject: [PATCH 25/36] Add contributing guidelines --- CONTRIBUTING.md | 21 +++++++++++++++++++++ README.rst | 17 +---------------- 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..e46d388c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +Contributing +------------ + +To get started, sign the Contributor License Agreement. + +1. Fork the repository on GitHub. +2. Make a branch off of ``develop`` +3. Run ``pip install tox`` +4. Go to the root of project where is located ``tox.ini`` and run ``tox -e develop`` +5. Activate current development environment: + + * Windows: ``.tox\develop\Scripts\activate`` + * Bash/ZSH: ``source .tox/develop/bin/activate`` + * Fish: ``source .tox/bin/activate.fish`` + +6. Make changes to code, documentation, etc. +7. Lint source code ``tox -e lint`` +8. Run the tests ``tox -e py27`` +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. diff --git a/README.rst b/README.rst index 391214f2..44ad2e5b 100644 --- a/README.rst +++ b/README.rst @@ -185,22 +185,7 @@ For further details, please refer to `What is PlatformIO? `_. Licence ------- From 3984f80baee847d63a825a4ad893f22847844045 Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 11 Jul 2016 19:12:10 +0300 Subject: [PATCH 26/36] Improve support for SAMD21 based boards --- platformio/boards/arduino.json | 36 +++++++++---------- .../builder/scripts/frameworks/arduino.py | 12 +++++-- platformio/builder/tools/pioupload.py | 15 ++++---- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/platformio/boards/arduino.json b/platformio/boards/arduino.json index e5ac7c25..45c2ffef 100644 --- a/platformio/boards/arduino.json +++ b/platformio/boards/arduino.json @@ -958,17 +958,17 @@ }, "mzeropro": { "build": { - "core": "arduino_zero", + "core": "arduino_zero_org", "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", + "variant": "arduino_zero_org", "ldscript": "samd21g18a_bootloader_org.ld", "hwids": [ - ["0x03EB", "0x2111"], - ["0x2A03", "0x804F"] + ["0x2A03", "0x804F"], + ["0x03EB", "0x2111"] ] }, "frameworks": ["arduino"], @@ -989,19 +989,17 @@ }, "mzeroproUSB": { "build": { - "core": "arduino_zero", + "core": "arduino_zero_org", "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", + "variant": "arduino_zero_org", "ldscript": "samd21g18a_bootloader_org.ld", "hwids": [ - ["0x2A03", "0x004D"], - ["0x2A03", "0x804D"], - ["0x2A03", "0x004F"], - ["0x2A03", "0x804F"] + ["0x2A03", "0x804F"], + ["0x2A03", "0x004F"] ] }, "frameworks": ["arduino"], @@ -1023,19 +1021,17 @@ }, "mzeroUSB": { "build": { - "core": "arduino_zero", + "core": "arduino_zero_org", "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", "f_cpu": "48000000L", "mcu": "samd21g18a", "cpu": "cortex-m0plus", "usb_product": "Arduino M0", - "variant": "arduino_zero", + "variant": "arduino_zero_org", "ldscript": "samd21g18a_bootloader_org.ld", "hwids": [ - ["0x2A03", "0x004D"], - ["0x2A03", "0x804D"], - ["0x2A03", "0x004E"], - ["0x2A03", "0x804E"] + ["0x2A03", "0x804E"], + ["0x2A03", "0x004E"] ] }, "frameworks": ["arduino"], @@ -1057,17 +1053,17 @@ }, "tian": { "build": { - "core": "arduino_zero", + "core": "arduino_zero_org", "extra_flags": "-DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -D__SAMD21G18A__", "f_cpu": "48000000L", "mcu": "samd21g18a", "cpu": "cortex-m0plus", "usb_product": "Arduino Tian", - "variant": "arduino_zero", + "variant": "arduino_zero_org", "ldscript": "samd21g18a_bootloader_org.ld", "hwids": [ - ["0x10C4", "0xEA70"], - ["0x2A03", "0x8052"] + ["0x2A03", "0x8052"], + ["0x10C4", "0xEA70"] ] }, "frameworks": ["arduino"], diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 1e3874b3..2eedbfda 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -216,11 +216,19 @@ env.Append( if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam": env.VariantDirWrap( join("$BUILD_DIR", "FrameworkCMSISInc"), - join("$PLATFORMFW_DIR", "system", "CMSIS", "CMSIS", "Include") + join( + "$PLATFORMFW_DIR", "system", + "CMSIS%s" % ("_ORG" if "_org" in BOARD_CORELIBDIRNAME else ""), + "CMSIS", "Include" + ) ) env.VariantDirWrap( join("$BUILD_DIR", "FrameworkDeviceInc"), - join("$PLATFORMFW_DIR", "system", "CMSIS", "Device", "ATMEL") + join( + "$PLATFORMFW_DIR", "system", + "CMSIS%s" % ("_ORG" if "_org" in BOARD_CORELIBDIRNAME else ""), + "Device", "ATMEL" + ) ) env.VariantDirWrap( join("$BUILD_DIR", "FrameworkLibSam"), diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 37cd4826..bc81941a 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -39,15 +39,12 @@ def FlushSerialBuffer(env, port): def TouchSerialPort(env, port, baudrate): port = env.subst(port) print "Forcing reset using %dbps open/close on port %s" % (baudrate, port) - if system() != "Windows": - try: - s = Serial(port) - s.close() - except: # pylint: disable=W0702 - pass - s = Serial(port=port, baudrate=baudrate) - s.setDTR(False) - s.close() + try: + s = Serial(port=port, baudrate=baudrate) + s.setDTR(False) + s.close() + except: # pylint: disable=W0702 + pass sleep(0.4) From 03b0b61aa187f8b66e7bbb46ebbc0d5594b4168a Mon Sep 17 00:00:00 2001 From: Valeriy Koval Date: Mon, 11 Jul 2016 19:26:07 +0300 Subject: [PATCH 27/36] Improve CMSIS selection for SAMD21 boards --- platformio/builder/scripts/frameworks/arduino.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 2eedbfda..16164d8d 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -218,7 +218,8 @@ if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam": join("$BUILD_DIR", "FrameworkCMSISInc"), join( "$PLATFORMFW_DIR", "system", - "CMSIS%s" % ("_ORG" if "_org" in BOARD_CORELIBDIRNAME else ""), + "CMSIS%s" % ( + "_ORG" if BOARD_CORELIBDIRNAME.endswith("_org") else ""), "CMSIS", "Include" ) ) @@ -226,7 +227,8 @@ if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam": join("$BUILD_DIR", "FrameworkDeviceInc"), join( "$PLATFORMFW_DIR", "system", - "CMSIS%s" % ("_ORG" if "_org" in BOARD_CORELIBDIRNAME else ""), + "CMSIS%s" % ( + "_ORG" if BOARD_CORELIBDIRNAME.endswith("_org") else ""), "Device", "ATMEL" ) ) From 2fdc57055ba46c38411f5b70f50d69c06c028fb7 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 19:34:36 +0300 Subject: [PATCH 28/36] Add more info about `.pioenvs` directory --- docs/projectconf.rst | 6 +++++- platformio/util.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/projectconf.rst b/docs/projectconf.rst index f340833b..f6835544 100644 --- a/docs/projectconf.rst +++ b/docs/projectconf.rst @@ -97,7 +97,11 @@ This option can be overridden by global environment variable ``envs_dir`` ^^^^^^^^^^^^ -This is a cache directory. *PlatformIO Build System* uses this folder for project +.. warning:: + **PLEASE DO NOT EDIT FILES IN THIS FOLDER**. PlatformIO will overwrite + your changes on the next build. **THIS IS A CACHE DIRECTORY**. + +*PlatformIO Build System* uses this folder for project environments to store compiled object files, static libraries, firmwares and other cached information. It allows PlatformIO to build source code extremely fast! diff --git a/platformio/util.py b/platformio/util.py index 864e0ea8..34850ff7 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -81,6 +81,7 @@ class cd(object): class memoized(object): + ''' Decorator. Caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned @@ -212,10 +213,18 @@ def get_projectlib_dir(): def get_pioenvs_dir(): - return _get_projconf_option_dir( + path = _get_projconf_option_dir( "envs_dir", join(get_project_dir(), ".pioenvs") ) + dontmod_path = join(path, "do-not-modify-files-here.url") + if not isfile(dontmod_path): + with open(dontmod_path, "w") as fp: + fp.write(""" +[InternetShortcut] +URL=http://docs.platformio.org/en/latest/projectconf.html#envs-dir +""") + return path def get_projectdata_dir(): From f4cebfdbae86d82dc752aefb3e88fa5482cb4177 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 19:44:36 +0300 Subject: [PATCH 29/36] Fix issue when `pioenvs` folder doesn't exist --- platformio/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platformio/util.py b/platformio/util.py index 34850ff7..727c9957 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -217,6 +217,8 @@ def get_pioenvs_dir(): "envs_dir", join(get_project_dir(), ".pioenvs") ) + if not isdir(path): + os.makedirs(path) dontmod_path = join(path, "do-not-modify-files-here.url") if not isfile(dontmod_path): with open(dontmod_path, "w") as fp: From 8fd553fbfce4cabd6395ed5c33581affd5121d44 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 19:52:47 +0300 Subject: [PATCH 30/36] Add Arduino M0 Pro and Tian to the examples // Issue #472 --- examples | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples b/examples index 6c0a7e44..a657ca42 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 6c0a7e4458056fa04657a14422aeae277560341d +Subproject commit a657ca4225f55af7239b89486350c9f02bb3ee93 From d246ef9a2e11d5c21e73417bdf17f93fac88ae33 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 21:04:40 +0300 Subject: [PATCH 31/36] Bump to 2.11.1b1 --- platformio/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/__init__.py b/platformio/__init__.py index adf76f97..3c27dd05 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, "1.dev2") +VERSION = (2, 11, "1b1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" From b165c3f543533094d65544f3bc59d4f4642abc83 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 22:40:37 +0300 Subject: [PATCH 32/36] Ignore "[platformio]" section from custom project configuration CI --- HISTORY.rst | 3 +++ platformio/__init__.py | 2 +- platformio/commands/ci.py | 17 ++++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c9629b4d..1e644f1d 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,9 @@ PlatformIO 2.0 * Improved project generator for `CLion IDE `__ * Auto-remove project cache when PlatformIO is upgraded * Keep user changes for ``.gitignore`` file when re-generate/update project data +* Ignore ``[platformio]`` section from custom project configuration file when + `platformio ci --project-conf `__ + command is used * Fixed missed ``--boot`` flag for the firmware uploader for ATSAM3X8E Cortex-M3 MCU based boards (Arduino Due, etc) (`issue #710 `_) diff --git a/platformio/__init__.py b/platformio/__init__.py index 3c27dd05..1bf8e37c 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, "1b1") +VERSION = (2, 11, "1b2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/ci.py b/platformio/commands/ci.py index 602ef67d..bb503e40 100644 --- a/platformio/commands/ci.py +++ b/platformio/commands/ci.py @@ -27,6 +27,12 @@ from platformio.commands.run import cli as cmd_run from platformio.exception import CIBuildEnvsEmpty from platformio.util import get_boards +# pylint: disable=wrong-import-order +try: + from configparser import ConfigParser +except ImportError: + from ConfigParser import ConfigParser + def validate_path(ctx, param, value): # pylint: disable=W0613 invalid_path = None @@ -91,7 +97,7 @@ def cli(ctx, src, lib, exclude, board, # pylint: disable=R0913 _copy_contents(join(build_dir, dir_name), contents) if project_conf and isfile(project_conf): - copyfile(project_conf, join(build_dir, "platformio.ini")) + _copy_project_conf(build_dir, project_conf) elif not board: raise CIBuildEnvsEmpty() @@ -157,3 +163,12 @@ def _exclude_contents(dst_dir, patterns): rmtree(path) elif isfile(path): remove(path) + + +def _copy_project_conf(build_dir, project_conf): + cp = ConfigParser() + cp.read(project_conf) + if cp.has_section("platformio"): + cp.remove_section("platformio") + with open(join(build_dir, "platformio.ini"), "w") as fp: + cp.write(fp) From b447e0aeab98eb98efa4cc46000dbde92a195fa5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 11 Jul 2016 23:08:08 +0300 Subject: [PATCH 33/36] Update history --- HISTORY.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 1e644f1d..7c1dfa35 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,8 @@ PlatformIO 2.0 2.11.1 (2016-??-??) ~~~~~~~~~~~~~~~~~~~ +* Added support for Arduino M0, M0 Pro and Tian boards + (`issue #472 `_) * Added support for Microchip chipKIT Lenny board * Updated Microchip PIC32 Arduino framework to v1.2.1 * Documented `uploading of EEPROM data `__ From 6cbd28683688a9f3885db7fb86bb0a8d10a2c1d9 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 12 Jul 2016 19:26:33 +0300 Subject: [PATCH 34/36] Add "udev" rules for OpenOCD CMSIS-DAP adapters // Resolve #718 --- HISTORY.rst | 2 ++ scripts/99-platformio-udev.rules | 3 +++ 2 files changed, 5 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 7c1dfa35..95da8ced 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,6 +15,8 @@ PlatformIO 2.0 (from EEMEM directive) * Added ``Rebuild C/C++ Project Index`` target to CLion and Eclipse IDEs * Improved project generator for `CLion IDE `__ +* Added ``udev`` rules for OpenOCD CMSIS-DAP adapters + (`issue #718 `_) * Auto-remove project cache when PlatformIO is upgraded * Keep user changes for ``.gitignore`` file when re-generate/update project data * Ignore ``[platformio]`` section from custom project configuration file when diff --git a/scripts/99-platformio-udev.rules b/scripts/99-platformio-udev.rules index a3c846b7..340e723b 100644 --- a/scripts/99-platformio-udev.rules +++ b/scripts/99-platformio-udev.rules @@ -76,3 +76,6 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="1cbe", ATTRS{idProduct}=="00fd", MODE="0666 #TI MSP430 Launchpad SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="f432", MODE="0666" + +# CMSIS-DAP compatible adapters +ATTRS{product}=="*CMSIS-DAP*", MODE="664", GROUP="plugdev" From 77a4d3f773c7cd498ae69186553d2323bc3505eb Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 12 Jul 2016 19:29:49 +0300 Subject: [PATCH 35/36] Typo fix --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 44ad2e5b..a3854318 100644 --- a/README.rst +++ b/README.rst @@ -187,10 +187,10 @@ Contributing See `contributing guidelines `_. -Licence +License ------- Copyright 2014-2016 Ivan Kravets -The PlatformIO is licensed under the permissive Apache 2.0 licence, +The PlatformIO is licensed under the permissive Apache 2.0 license, so you can use it in both commercial and personal projects with confidence. From 2dd01247e1f00b60a57987c8f2ba37996e4be23c Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Tue, 12 Jul 2016 19:34:14 +0300 Subject: [PATCH 36/36] Version bump to 2.11.1 (issues #472, #629, #710, #711, #712, #713, #718) --- HISTORY.rst | 2 +- platformio/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 95da8ced..2663748b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,7 +4,7 @@ Release Notes PlatformIO 2.0 -------------- -2.11.1 (2016-??-??) +2.11.1 (2016-07-12) ~~~~~~~~~~~~~~~~~~~ * Added support for Arduino M0, M0 Pro and Tian boards diff --git a/platformio/__init__.py b/platformio/__init__.py index 1bf8e37c..2063af7b 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 11, "1b2") +VERSION = (2, 11, 1) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio"