diff --git a/HISTORY.rst b/HISTORY.rst index 9bbcf11f..db7910d7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,29 @@ Release History =============== +1.5.0 (2015-05-15) +------------------ + +* Added support of `Framework mbed `_ + for Teensy 3.1 + (`issue #183 `_) +* Added GDB as alternative uploader to `ststm32 `__ platform + (`issue #175 `_) +* Added `examples `__ + with preconfigured IDE projects + (`issue #154 `_) +* Fixed firmware uploading under Linux OS for Arduino Leonardo board + (`issue #178 `_) +* Fixed invalid "mbed" firmware for Nucleo F411RE + (`issue #185 `_) +* Fixed parsing of includes for PlatformIO Library Dependency Finder + (`issue #189 `_) +* Fixed handling symbolic links within source code directory + (`issue #190 `_) +* Fixed cancelling any previous definition of name, either built in or provided + with a ``-D`` option + (`issue #191 `_) + 1.4.0 (2015-04-11) ------------------ diff --git a/README.rst b/README.rst index ac5ade89..78813f08 100644 --- a/README.rst +++ b/README.rst @@ -6,9 +6,9 @@ PlatformIO :alt: Travis.CI Build Status .. image:: https://ci.appveyor.com/api/projects/status/ee26e58de798rctd/branch/develop?svg=true :target: https://ci.appveyor.com/project/ivankravets/platformio - :alt: AppVeyor.CI Build Status -.. image:: https://gemnasium.com/ivankravets/platformio.png - :target: https://gemnasium.com/ivankravets/platformio + :alt: AppVeyor.CI Build Status +.. image:: https://gemnasium.com/platformio/platformio.png + :target: https://gemnasium.com/platformio/platformio :alt: Dependency Status .. image:: https://pypip.in/version/platformio/badge.png?style=flat :target: https://pypi.python.org/pypi/platformio/ @@ -19,6 +19,9 @@ PlatformIO .. image:: https://pypip.in/license/platformio/badge.png?style=flat :target: https://pypi.python.org/pypi/platformio/ :alt: License +.. image:: https://badges.gitter.im/Join%20Chat.svg + :alt: Join the chat at https://gitter.im/platformio/platformio + :target: https://gitter.im/platformio/platformio `Website + Library Search `_ | `Documentation `_ | @@ -27,8 +30,8 @@ PlatformIO `Reddit `_ | `Twitter `_ -*Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32, -TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* +*Atmel AVR & SAM, Espressif, Freescale Kinetis, Nordic nRF51, NXP LPC, +ST STM32, TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* .. image:: https://raw.githubusercontent.com/platformio/platformio/develop/docs/_static/platformio-logo.png :target: http://platformio.org @@ -127,6 +130,7 @@ It has support for the most popular embedded platforms: * `Atmel AVR `_ * `Atmel SAM `_ +* `Espressif `_ * `Freescale Kinetis `_ * `Nordic nRF51 `_ * `NXP LPC. `_ diff --git a/docs/_static/ide-platformio-qtcreator-1.png b/docs/_static/ide-platformio-qtcreator-1.png new file mode 100644 index 00000000..1972daf8 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-1.png differ diff --git a/docs/_static/ide-platformio-qtcreator-2.png b/docs/_static/ide-platformio-qtcreator-2.png new file mode 100644 index 00000000..759b02ee Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-2.png differ diff --git a/docs/_static/ide-platformio-qtcreator-3.png b/docs/_static/ide-platformio-qtcreator-3.png new file mode 100644 index 00000000..9eba936b Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-3.png differ diff --git a/docs/_static/ide-platformio-qtcreator-4.png b/docs/_static/ide-platformio-qtcreator-4.png new file mode 100644 index 00000000..a3b044e1 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-4.png differ diff --git a/docs/_static/ide-platformio-qtcreator-5.png b/docs/_static/ide-platformio-qtcreator-5.png new file mode 100644 index 00000000..5e5cbea1 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-5.png differ diff --git a/docs/_static/ide-platformio-qtcreator-6.png b/docs/_static/ide-platformio-qtcreator-6.png new file mode 100644 index 00000000..c24c5526 Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-6.png differ diff --git a/docs/_static/ide-platformio-qtcreator-7.png b/docs/_static/ide-platformio-qtcreator-7.png new file mode 100644 index 00000000..cdaf1f6f Binary files /dev/null and b/docs/_static/ide-platformio-qtcreator-7.png differ diff --git a/docs/articles.rst b/docs/articles.rst index de800f62..07f04723 100644 --- a/docs/articles.rst +++ b/docs/articles.rst @@ -9,8 +9,9 @@ Articles about us Here are recent articles about PlatformIO: +* April 17, 2015 - **Michael Ball** - `PlatformIO - A Cross-Platform Code Builder and Missing Library Manager `_ * March 23, 2015 - **Atmel** - `Cross-board and cross-vendor embedded development with PlatformIO `_ * March 22, 2015 - **Mark VandeWettering** - `Discovered a new tool for embedded development: PlatformIO `_ * October 7, 2014 - **Ivan Kravets** - `Integration of PlatformIO library manager to Arduino and Energia IDEs `_ * June 20, 2014 - **Ivan Kravets** - `Building and debugging Atmel AVR (Arduino-based) project using Eclipse IDE+PlatformIO `_ -* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World `_ \ No newline at end of file +* June 17, 2014 - **Ivan Kravets** - `How was PlatformIO born or why I love Python World `_ diff --git a/docs/faq.rst b/docs/faq.rst index 7801504c..b86e0790 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -86,8 +86,8 @@ Serial does not work with panStampAVR board Answered in `issue #144 `_. -An error ``pkg_resources.DistributionNotFound`` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +PlatformIO: command not found || An error ``pkg_resources.DistributionNotFound`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Please upgrade *SetupTools* package: diff --git a/docs/ide.rst b/docs/ide.rst index ba74ee60..48053b78 100644 --- a/docs/ide.rst +++ b/docs/ide.rst @@ -9,6 +9,7 @@ IDE Integration ide/arduino ide/eclipse ide/energia + ide/qtcreator ide/sublimetext ide/vim ide/visualstudio diff --git a/docs/ide/qtcreator.rst b/docs/ide/qtcreator.rst new file mode 100644 index 00000000..19705b5a --- /dev/null +++ b/docs/ide/qtcreator.rst @@ -0,0 +1,113 @@ +.. _ide_qtcreator: + +Qt Creator +========== + +The `Qt Creator `_ is an open source cross-platform integrated development environment. The editor includes such features as syntax highlighting for various languages, project manager, integrated version control systems, rapid code navigation tools and code autocompletion. + +This software can be used with: + +* all availalbe :ref:`platforms` +* all availalbe :ref:`frameworks` + +Refer to the `Sublime Text Documentation `_ +page for more detailed information. + +.. contents:: + +Integration +----------- + +Setup New Project +^^^^^^^^^^^^^^^^^ + +First of all, let's create new project from Qt Creator Start Page: ``New Project`` or using ``Menu: File → New File or Project``, then select project with ``Empty Qt Project`` type (``Other Project → Empty Qt Project``), fill ``Name``, ``Create in``. + +.. image:: ../_static/ide-platformio-qtcreator-1.png + +On the next steps select any available kit and click Finish button. + +.. image:: ../_static/ide-platformio-qtcreator-2.png + +Secondly, we need to configure project with PlatformIO source code builder (click on Projects label on left menu or ``Ctrl+5`` shortcut): + +.. image:: ../_static/ide-platformio-qtcreator-3.png + +Thirdly, we need to add directories with header files using project file. Please fill this file with the next contents: + +.. code-block:: none + + win32 { + HOMEDIR += $$(USERPROFILE) + } + else { + HOMEDIR += $$(PWD) + } + + INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino" + INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include" + + win32:INCLUDEPATH ~= s,/,\\,g + +.. image:: ../_static/ide-platformio-qtcreator-4.png + +First program in Qt Creator +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Simple "Blink" project will consist from two files: + +1. Main "C" source file named ``main.c`` must be located in the ``src`` directory. +Let's create new text file named ``main.c`` using ``Menu: New File or Project → General → Text File``: + +.. image:: ../_static/ide-platformio-qtcreator-5.png + +Copy the source code which is described below to file ``main.c``. + +.. code-block:: c + + #include "Arduino.h" + #define WLED 13 // Most Arduino boards already have an LED attached to pin 13 on the board itself + + void setup() + { + pinMode(WLED, OUTPUT); // set pin as output + } + + void loop() + { + digitalWrite(WLED, HIGH); // set the LED on + delay(1000); // wait for a second + digitalWrite(WLED, LOW); // set the LED off + delay(1000); // wait for a second + } + +2. Project Configuration File named ``platformio.ini`` must be located in the project root directory. + +.. image:: ../_static/ide-platformio-qtcreator-6.png + +Copy the source code which is described below to it. + +.. code-block:: none + + # + # 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. + + [env:arduino_uno] + platform = atmelavr + framework = arduino + board = uno + + +Conclusion +---------- + +Taking everything into account, we can build project with shortcut ``Ctrl+Shift+B`` or using ``Menu: Build → Build All``: + +.. image:: ../_static/ide-platformio-qtcreator-7.png diff --git a/examples/ide/qtcreator/platformio.ini b/examples/ide/qtcreator/platformio.ini new file mode 100644 index 00000000..b79bfb2d --- /dev/null +++ b/examples/ide/qtcreator/platformio.ini @@ -0,0 +1,23 @@ +# +# 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:arduino_uno] +platform = atmelavr +framework = arduino +board = uno \ No newline at end of file diff --git a/examples/ide/qtcreator/platformio.pro b/examples/ide/qtcreator/platformio.pro new file mode 100644 index 00000000..22188cd8 --- /dev/null +++ b/examples/ide/qtcreator/platformio.pro @@ -0,0 +1,19 @@ +win32 { + HOMEDIR += $$(USERPROFILE) +} +else { + HOMEDIR += $$(PWD) +} + +INCLUDEPATH += "$$HOMEDIR/.platformio/packages/framework-arduinoavr/cores/arduino" +INCLUDEPATH += "$$HOMEDIR/.platformio/packages/toolchain-atmelavr/avr/include" + +win32:INCLUDEPATH ~= s,/,\\,g + +# DEFINES += __AVR_ATmega328__ + +OTHER_FILES += \ + platformio.ini + +SOURCES += \ + src/main.c diff --git a/examples/ide/qtcreator/src/main.c b/examples/ide/qtcreator/src/main.c new file mode 100644 index 00000000..34714182 --- /dev/null +++ b/examples/ide/qtcreator/src/main.c @@ -0,0 +1,25 @@ +#include "Arduino.h" +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. +*/ + +int led = 1; // blink 'digital' pin 1 - AKA the built in red LED + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); + +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); + delay(1000); + digitalWrite(led, LOW); + delay(1000); +} + diff --git a/examples/ide/sublime-text/platformio.ini b/examples/ide/sublime-text/platformio.ini new file mode 100644 index 00000000..785c3eda --- /dev/null +++ b/examples/ide/sublime-text/platformio.ini @@ -0,0 +1,23 @@ +# +# 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:flora8] +platform = atmelavr +framework = arduino +board = flora8 diff --git a/examples/ide/sublime-text/platformio.sublime-project b/examples/ide/sublime-text/platformio.sublime-project new file mode 100644 index 00000000..e8bd688b --- /dev/null +++ b/examples/ide/sublime-text/platformio.sublime-project @@ -0,0 +1,43 @@ +{ + "build_systems": + [ + { + "cmd": + [ + "platformio", + "run" + ], + "name": "PlatformIO", + "variants": + [ + { + "cmd": + [ + "platformio", + "run", + "-t", + "clean" + ], + "name": "Clean" + }, + { + "cmd": + [ + "platformio", + "run", + "-t", + "upload" + ], + "name": "Upload" + } + ], + "working_dir": "${project_path:${folder}}" + } + ], + "folders": + [ + { + "path": "." + } + ] +} diff --git a/examples/ide/sublime-text/src/Blink.pde b/examples/ide/sublime-text/src/Blink.pde new file mode 100644 index 00000000..a4282d6b --- /dev/null +++ b/examples/ide/sublime-text/src/Blink.pde @@ -0,0 +1,24 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. +*/ + +int led = 1; // blink 'digital' pin 1 - AKA the built in red LED + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); + +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); + delay(1000); + digitalWrite(led, LOW); + delay(1000); +} + diff --git a/examples/ide/visual-studio/blink.vcxproj b/examples/ide/visual-studio/blink.vcxproj new file mode 100644 index 00000000..1bef37cb --- /dev/null +++ b/examples/ide/visual-studio/blink.vcxproj @@ -0,0 +1,62 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0FA9C3A8-452B-41EF-A418-9102B170F49F} + MakeFileProj + + + + Makefile + true + v120 + + + Makefile + false + v120 + + + + + + + + + + + + + platformio run + platformio run -t clean + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) + + + platformio run + platformio run -t clean + WIN32;NDEBUG;$(NMakePreprocessorDefinitions) + $(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\toolchain-atmelavr\avr\include;$(HOMEDRIVE)$(HOMEPATH)\.platformio\packages\framework-arduinoavr\cores\arduino;$(NMakeIncludeSearchPath) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/ide/visual-studio/blink.vcxproj.filters b/examples/ide/visual-studio/blink.vcxproj.filters new file mode 100644 index 00000000..87bc92f6 --- /dev/null +++ b/examples/ide/visual-studio/blink.vcxproj.filters @@ -0,0 +1,29 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {cad450ef-1a84-42d4-a5b5-a1736b8833d3} + + + + + + + + + Source Files\src + + + \ No newline at end of file diff --git a/examples/ide/visual-studio/platformio.ini b/examples/ide/visual-studio/platformio.ini new file mode 100644 index 00000000..b79bfb2d --- /dev/null +++ b/examples/ide/visual-studio/platformio.ini @@ -0,0 +1,23 @@ +# +# 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:arduino_uno] +platform = atmelavr +framework = arduino +board = uno \ No newline at end of file diff --git a/examples/ide/visual-studio/src/blink.pde b/examples/ide/visual-studio/src/blink.pde new file mode 100644 index 00000000..a4282d6b --- /dev/null +++ b/examples/ide/visual-studio/src/blink.pde @@ -0,0 +1,24 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. +*/ + +int led = 1; // blink 'digital' pin 1 - AKA the built in red LED + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); + +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); + delay(1000); + digitalWrite(led, LOW); + delay(1000); +} + diff --git a/examples/mbed/mbed-blink/platformio.ini b/examples/mbed/mbed-blink/platformio.ini index f1f25ccb..b6a88e91 100644 --- a/examples/mbed/mbed-blink/platformio.ini +++ b/examples/mbed/mbed-blink/platformio.ini @@ -41,3 +41,9 @@ board = frdm_kl25z platform = ststm32 framework = mbed board = nucleo_f401re + +# Teensy Platform +[env:teensy31] +platform = teensy +framework = mbed +board = teensy31 diff --git a/platformio/__init__.py b/platformio/__init__.py index 76c10d5a..4c17b089 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,12 +1,12 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (1, 4, 0) +VERSION = (1, 5, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" __description__ = ("A cross-platform code builder and the missing library " - "manager (Atmel AVR & SAM, Freescale Kinetis, " + "manager (Atmel AVR & SAM, Espressif, Freescale Kinetis, " "Nordic nRF51, NXP LPC, ST STM32, TI MSP430 & Tiva, " "Teensy, Arduino, mbed, libOpenCM3, etc.)") __url__ = "http://platformio.org" diff --git a/platformio/boards/teensy.json b/platformio/boards/teensy.json index c0e39961..a7eca4ac 100644 --- a/platformio/boards/teensy.json +++ b/platformio/boards/teensy.json @@ -62,7 +62,7 @@ "mcu": "mk20dx256", "cpu": "cortex-m4" }, - "frameworks": ["arduino"], + "frameworks": ["arduino", "mbed"], "name": "Teensy 3.1", "platform": "teensy", "upload": { diff --git a/platformio/builder/scripts/frameworks/mbed.py b/platformio/builder/scripts/frameworks/mbed.py index 191e04d1..763b85c3 100644 --- a/platformio/builder/scripts/frameworks/mbed.py +++ b/platformio/builder/scripts/frameworks/mbed.py @@ -53,7 +53,8 @@ MBED_VARIANTS = { "frdm_k64f": "K64F", "frdm_kl05z": "KL05Z", "frdm_k20d50m": "K20D50M", - "frdm_k22f": "K22F" + "frdm_k22f": "K22F", + "teensy31": "TEENSY3_1" } MBED_LIBS_MAP = { @@ -177,6 +178,20 @@ def get_build_flags(data): return flags +def _mbed_whole_archive_hook(flags): + if (not isinstance(flags, list) or + env.get("BOARD_OPTIONS", {}).get("platform") != "ststm32"): + return flags + + for pos, flag in enumerate(flags[:]): + if isinstance(flag, basestring): + continue + flags.insert(pos, "-Wl,-whole-archive") + flags.insert(pos + 2, "-Wl,-no-whole-archive") + + return flags + + board_type = env.subst("$BOARD") variant = MBED_VARIANTS[ board_type] if board_type in MBED_VARIANTS else board_type.upper() @@ -187,6 +202,8 @@ build_flags = get_build_flags(eixdata) variant_dir = join("$PLATFORMFW_DIR", "variant", variant) env.Replace( + _mbed_whole_archive_hook=_mbed_whole_archive_hook, + _LIBFLAGS="${_mbed_whole_archive_hook(%s)}" % env.get("_LIBFLAGS")[2:-1], CPPFLAGS=build_flags.get("CPPFLAGS", []), CFLAGS=build_flags.get("CFLAGS", []), CXXFLAGS=build_flags.get("CXXFLAGS", []), diff --git a/platformio/builder/scripts/ststm32.py b/platformio/builder/scripts/ststm32.py index 7b4d80e3..0855457d 100644 --- a/platformio/builder/scripts/ststm32.py +++ b/platformio/builder/scripts/ststm32.py @@ -6,25 +6,46 @@ """ import platform -from os.path import join +from os.path import isfile, join from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, - DefaultEnvironment, SConscript) + DefaultEnvironment, Exit, SConscript) env = DefaultEnvironment() SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) -env.Replace( - UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"), - UPLOADERFLAGS=[ - "write", # write in flash - "$SOURCES", # firmware path to flash - "0x08000000" # flash start adress - ], +if env['UPLOAD_PROTOCOL'] == "gdb": + if not isfile(join(env.subst("$PROJECT_DIR"), "upload.gdb")): + Exit( + "You are using GDB as firmware uploader. " + "Please specify upload commands in upload.gdb " + "file in project directory!" + ) + env.Replace( + UPLOADER=join( + "$PIOPACKAGES_DIR", "toolchain-gccarmnoneeabi", + "bin", "arm-none-eabi-gdb" + ), + UPLOADERFLAGS=[ + join("$BUILD_DIR", "firmware.elf"), + "-batch", + "-x", join("$PROJECT_DIR", "upload.gdb") + ], - UPLOADCMD="$UPLOADER $UPLOADERFLAGS" -) + UPLOADCMD="$UPLOADER $UPLOADERFLAGS" + ) +else: + env.Replace( + UPLOADER=join("$PIOPACKAGES_DIR", "tool-stlink", "st-flash"), + UPLOADERFLAGS=[ + "write", # write in flash + "$SOURCES", # firmware path to flash + "0x08000000" # flash start adress + ], + + UPLOADCMD="$UPLOADER $UPLOADERFLAGS" + ) env.Append( diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index ba657713..fc4f4f91 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -40,6 +40,7 @@ if isfile(env.subst(join( UPLOADERFLAGS=[ "-mmcu=$BOARD_MCU", "-w", # wait for device to apear + "-s", # soft reboot if device not online "-v" # verbose output ], UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES' diff --git a/platformio/builder/tools/pioupload.py b/platformio/builder/tools/pioupload.py index 84e72f01..4dd2f3d1 100644 --- a/platformio/builder/tools/pioupload.py +++ b/platformio/builder/tools/pioupload.py @@ -2,6 +2,7 @@ # See LICENSE for details. from os.path import join +from platform import system from shutil import copyfile from time import sleep @@ -23,6 +24,12 @@ def FlushSerialBuffer(env, port): def TouchSerialPort(env, port, baudrate): + if system() == "Linux": + try: + s = Serial(env.subst(port)) + s.close() + except: # pylint: disable=W0702 + pass s = Serial(port=env.subst(port), baudrate=baudrate) s.setDTR(False) s.close() diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 8402e6e3..a3566291 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -15,18 +15,13 @@ from platformio.util import pioversion_to_intstr def BuildFirmware(env): # fix ASM handling under non-casitive OS - if not case_sensitive_suffixes('.s', '.S'): + if not case_sensitive_suffixes(".s", ".S"): env.Replace( AS="$CC", ASCOM="$ASPPCOM" ) - if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}): - env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}")) - - if "BUILD_FLAGS" in env: - env.MergeFlags(env['BUILD_FLAGS']) - + env.ProcessFlags() env.BuildFramework() firmenv = env.Clone() @@ -69,6 +64,22 @@ def BuildFirmware(env): ) +def ProcessFlags(env): + if "extra_flags" in env.get("BOARD_OPTIONS", {}).get("build", {}): + env.MergeFlags(env.subst("${BOARD_OPTIONS['build']['extra_flags']}")) + + if "BUILD_FLAGS" in env: + env.MergeFlags(env['BUILD_FLAGS']) + + # Cancel any previous definition of name, either built in or + # provided with a -D option // Issue #191 + undefines = [f for f in env.get("CCFLAGS", []) if f.startswith("-U")] + if undefines: + for undef in undefines: + env['CCFLAGS'].remove(undef) + env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines)) + + def GlobCXXFiles(env, path): files = [] for suff in ["*.c", "*.cpp", "*.S"]: @@ -84,7 +95,7 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True, ignore_pattern = (".git", ".svn") variants = [] src_dir = env.subst(src_dir) - for root, _, _ in walk(src_dir): + for root, _, _ in walk(src_dir, followlinks=True): _src_dir = root _var_dir = variant_dir + root.replace(src_dir, "") if any([s in _var_dir.lower() for s in ignore_pattern]): @@ -213,22 +224,17 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914 return result def _process_src_dir(state, src_dir): - for root, _, _ in walk(src_dir): + for root, _, _ in walk(src_dir, followlinks=True): for node in (env.GlobCXXFiles(root) + env.Glob(join(root, "*.h"))): state = _parse_includes(state, node) return state def _parse_includes(state, node): - if node.path in state['paths']: - return state - else: - state['paths'].add(node.path) - skip_includes = ("arduino.h", "energia.h") matches = INCLUDES_RE.findall(node.get_text_contents()) for (inc_type, inc_name) in matches: - base_dir = dirname(node.path) + base_dir = dirname(node.get_abspath()) if inc_name.lower() in skip_includes: continue if join(base_dir, inc_name) in state['paths']: @@ -378,6 +384,7 @@ def exists(_): def generate(env): env.AddMethod(BuildFirmware) + env.AddMethod(ProcessFlags) env.AddMethod(GlobCXXFiles) env.AddMethod(VariantDirRecursive) env.AddMethod(BuildFramework) diff --git a/platformio/commands/search.py b/platformio/commands/search.py index d3b7d69a..4d9e1cc6 100644 --- a/platformio/commands/search.py +++ b/platformio/commands/search.py @@ -40,7 +40,7 @@ def cli(query, json_output): for item in data: click.secho(item['type'], fg="cyan", nl=False) click.echo(" (available packages: %s)" % ", ".join( - p.get_packages().keys())) + item.get("packages").keys())) click.secho("-" * len(item['type']), fg="cyan") click.echo(item['description']) click.echo() diff --git a/requirements.txt b/requirements.txt index 6a5ccae6..ef3dfdda 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -click==3.3 +click==4.0 colorama==0.3.3 pyserial==2.7 -requests==2.6.0 +requests==2.7.0 scons==2.3.0 diff --git a/setup.py b/setup.py index f0c26298..9a01f68c 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Compilers" ], - keywords=("builder library manager atmel avr sam freescale kinetis nordic " - "nrf51 nxp lpc st stm32 ti msp430 tiva teensy arduino mbed " - "libopencm3") + keywords=("builder library manager atmel avr sam espressif esp freescale " + "kinetis nordic nrf51 nxp lpc st stm32 ti msp430 tiva teensy " + "arduino mbed libopencm3") ) diff --git a/tox.ini b/tox.ini index 3bc8d18e..cafecaca 100644 --- a/tox.ini +++ b/tox.ini @@ -21,7 +21,14 @@ deps = commands = sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html sphinx-build -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex - /bin/bash -c "if [[ $CI != 'true' ]]; then sphinx-build -W -b linkcheck docs docs/_build/html; fi" + +[testenv:docslinkcheck] +basepython = python2.7 +deps = + sphinx + sphinx_rtd_theme +commands = + sphinx-build -W -b linkcheck docs docs/_build/html [testenv:lint] basepython = python2.7