diff --git a/.isort.cfg b/.isort.cfg index c905e9ca..72280366 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,3 +1,3 @@ [settings] line_length=79 -known_third_party=click,requests,serial,SCons +known_third_party=click,requests,serial,SCons,pytest diff --git a/HISTORY.rst b/HISTORY.rst index aa9550ef..9bbcf11f 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,31 @@ Release History =============== +1.4.0 (2015-04-11) +------------------ + +* Added `espressif `_ + development platform with ESP01 board +* Integrated PlatformIO with AppVeyor Windows based Continuous Integration system + (`issue #149 `_) +* Added support for Teensy LC board to + `teensy `__ + platform +* Added support for new Arduino based boards by *SparkFun, BQ, LightUp, + LowPowerLab, Quirkbot, RedBearLab, TinyCircuits, WickedDevice* to + `atmelavr `__ + platform +* Upgraded `Arduino Framework `__ to + 1.6.3 version (`issue #156 `_) +* Upgraded `Energia Framework `__ to + 0101E0015 version (`issue #146 `_) +* Upgraded `Arduino Framework with Teensy Core `_ to + 1.22 version (`issue #162 `_, + `issue #170 `_) +* Fixed exceptions with PlatformIO auto-updates when Internet connection isn't + active + + 1.3.0 (2015-03-27) ------------------ diff --git a/README.rst b/README.rst index 516606ed..ac5ade89 100644 --- a/README.rst +++ b/README.rst @@ -2,8 +2,11 @@ PlatformIO ========== .. image:: https://travis-ci.org/platformio/platformio.svg?branch=develop - :target: https://travis-ci.org/profile/platformio - :alt: Build Status + :target: https://travis-ci.org/platformio/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: Dependency Status @@ -21,6 +24,7 @@ PlatformIO `Documentation `_ | `Project Examples `_ | `Blog `_ | +`Reddit `_ | `Twitter `_ *Atmel AVR & SAM, Freescale Kinetis, Nordic nRF51, NXP LPC, ST STM32, @@ -41,11 +45,13 @@ and the missing library manager. * `User Guide `_ * `IDE Integration `_ * `Articles about us `_ +* `FAQ `_ * `Release History `_ You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* -has pre-built different development platforms including: compiler, debugger, -uploader (for embedded boards) and many other useful tools. +has pre-built different development platforms and pre-configured settings for +the most popular embedded boards. For further details, please +refer to `What is PlatformIO? `_ Use whenever. *Run everywhere.* ------------------------------- diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..a213b1f2 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +build: off +environment: + global: + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\appveyor\\run_with_compiler.cmd" + matrix: + - TOXENV: "py27" + TOXPYTHON: "C:\\Python27-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27-x64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" +init: + - "ECHO %TOXENV%" + - ps: "ls C:\\Python*" +install: + - "git submodule update --init --recursive" + - "powershell scripts\\appveyor\\install.ps1" +test_script: + - "%PYTHON_HOME%\\Scripts\\tox --version" + - "%PYTHON_HOME%\\Scripts\\pip --version" + - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" diff --git a/docs/faq.rst b/docs/faq.rst new file mode 100644 index 00000000..7801504c --- /dev/null +++ b/docs/faq.rst @@ -0,0 +1,101 @@ +.. _faq: + +Frequently Asked Questions +========================== + +.. contents:: + +General +------- + +.. _faq_what_is_platformio: + +What is PlatformIO? +~~~~~~~~~~~~~~~~~~~ + +`PlatformIO `_ is a cross-platform code builder +and the missing library manager. + +PlatformIO is independent from the platform, in which it is running. In fact, +the only requirement is Python, which exists pretty much everywhere. What this +means is that PlatformIO projects can be easily moved from one computer to +another, as well as that PlatformIO allows for the easy sharing of projects +between team members, regardless of operating system they prefer to work with. +Beyond that, PlatformIO can be run not only on commonly used desktops/laptops +but also on the servers without X Window System. While PlatformIO itself is a +console application, it can be used in combination with one's favorite +:ref:`ide` or text editor such as :ref:`ide_arduino`, :ref:`ide_eclipse`, +:ref:`ide_visualstudio`, :ref:`ide_vim`, :ref:`ide_sublimetext`, etc. + +Alright, so PlatformIO can run on different operating systems. But more +importantly, from development perspective at least, is a list of supported +boards and MCUs. To keep things short: PlatformIO supports over 100 +:ref:`Embedded Boards ` and all major +:ref:`Development Platforms `. + +PlatformIO allows users to: + +* Decide which operation system they want to run development process on. + You can even use one OS at home and another at work. +* Choose which editor to use for writing the code. It can be pretty simple + editor or powerful favorite :ref:`ide`. +* Focus on the code development, significantly simplifying support for the + :ref:`platforms` and MCUs. + + +How does it work? +~~~~~~~~~~~~~~~~~ + +Without going too deep into PlatformIO implementation details, work cycle of +the project developed using PlatformIO is as follows: + +* Users choose board(s) interested in :ref:`projectconf` +* Based on this list of boards, PlatformIO downloads required toolchains and + installs them automatically. +* Users develop code and PlatformIO makes sure that it is compiled, prepared + and uploaded to all the boards of interest. + +.. _faq_troubleshooting: + +Troubleshooting +--------------- + +.. _faq_troubleshooting_pioblocksprompt: + +PlatformIO blocks command execution using user prompt +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are going to run *PlatformIO* from **subprocess**, you **MUST +DISABLE** all prompts. It will allow you to avoid blocking. +There are a few options: + +- using environment variable :ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` +- disable global setting ``enable_prompts`` via :ref:`cmd_settings` command +- masking under Continuous Integration system via environment variable + :ref:`CI=true `. + + +Windows: ``UnicodeDecodeError: 'ascii' codec can't decode byte`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Answered in `issue #143 `_. + +Serial does not work with panStampAVR board +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Answered in `issue #144 `_. + + +An error ``pkg_resources.DistributionNotFound`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Please upgrade *SetupTools* package: + +.. code-block:: bash + + $ [sudo] pip uninstall setuptools + $ [sudo] pip install setuptools + + # Then re-install PlatformIO + $ [sudo] pip uninstall platformio + $ [sudo] pip install platformio diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index 1b4610b6..5804f7f7 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -22,6 +22,9 @@ Platforms * - :ref:`platform_atmelsam` - Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. + * - :ref:`platform_espressif` + - Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications. + * - :ref:`platform_teensy` - Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard "Mini-B" USB cable and a PC or Macintosh with a USB port. @@ -328,6 +331,26 @@ Arduino - 32 Kb - 2.5 Kb +BQ +~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``zumbt328`` + - `BQ ZUM BT-328 board `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + BitWizard ~~~~~~~~~ @@ -430,6 +453,73 @@ Engduino - 32 Kb - 2.5 Kb +Espressif +~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``esp01`` + - `Espressif ESP8266 board `_ + - ESP8266 + - 80 MHz + - 512 Kb + - 32 Kb + +LightUp +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``lightup`` + - `LightUp `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + +LowPowerLab +~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``moteino`` + - `LowPowerLab Moteino `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + + * - ``moteinomega`` + - `LowPowerLab MoteinoMEGA `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb + Microduino ~~~~~~~~~~ @@ -533,6 +623,60 @@ PanStamp - 32 Kb - 4 Kb +Quirkbot +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``quirkbot`` + - `Quirkbot `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + +RedBearLab +~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``blend`` + - `RedBearLab Blend `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``blendmicro16`` + - `RedBearLab Blend Micro 3.3V/16MHz (overclock) `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``blendmicro8`` + - `RedBearLab Blend Micro 3.3V/8MHz `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + RepRap ~~~~~~ @@ -634,6 +778,13 @@ SparkFun - Flash - RAM + * - ``sparkfun_digitalsandbox`` + - `SparkFun Digital Sandbox `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + * - ``sparkfun_fiov3`` - `SparkFun Fio V3 3.3V/8MHz `_ - ATMEGA32U4 @@ -690,6 +841,13 @@ SparkFun - 32 Kb - 2 Kb + * - ``uview`` + - `SparkFun MicroView `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + Teensy ~~~~~~ @@ -730,3 +888,64 @@ Teensy - 72 MHz - 256 Kb - 64 Kb + + * - ``teensylc`` + - `Teensy LC `_ + - MKL26Z64 + - 48 MHz + - 64 Kb + - 8 Kb + +TinyCircuits +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``tinyduino`` + - `TinyCircuits TinyDuino Processor Board `_ + - ATMEGA328P + - 8 MHz + - 32 Kb + - 2 Kb + + * - ``tinylily`` + - `TinyCircuits TinyLily Mini Processor `_ + - ATMEGA328P + - 8 MHz + - 32 Kb + - 2 Kb + +WickedDevice +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``wildfirev2`` + - `WickedDevice WildFire v2 [stk500] `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb + + * - ``wildfirev3`` + - `WickedDevice WildFire v3 [optiboot] `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb diff --git a/docs/ide/visualstudio.rst b/docs/ide/visualstudio.rst index 385f91da..c5fc28d3 100644 --- a/docs/ide/visualstudio.rst +++ b/docs/ide/visualstudio.rst @@ -3,7 +3,7 @@ Visual Studio ============= -The `Microsoft Visual Studio `_ is an integrated development environment (IDE) from Microsoft. Visual Studio includes a code editor supporting IntelliSense (the code completion component) as well as code refactoring. +The `Microsoft Visual Studio (Free) `_ is an integrated development environment (IDE) from Microsoft. Visual Studio includes a code editor supporting IntelliSense (the code completion component) as well as code refactoring. This software can be used with: diff --git a/docs/index.rst b/docs/index.rst index 2f46d604..692057d7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,17 +14,13 @@ TI MSP430 & Tiva, Teensy, Arduino, mbed, libOpenCM3, etc.* * `Source Code `_ | `Issues `_ * `Blog `_ | + `Reddit `_ | `Twitter `_ -You have no need to install any *IDE* or compile any tool chains. *PlatformIO* -has pre-built different development platforms including: compiler, debugger, -uploader (for embedded) and many other useful tools. - -**PlatformIO** allows developer to compile the same code with different -platforms using only one command :ref:`cmd_run`. This happens due to -:ref:`projectconf` where you can setup different environments with specific -options: platform type, firmware uploading settings, pre-built framework -and many more. +You have **no need** to install any *IDE* or compile any tool chains. *PlatformIO* +has pre-built different development platforms and pre-configured settings for +the most popular embedded boards. For further details, please +refer to :ref:`faq_what_is_platformio` Embedded Development. *Easier Than Ever.* ----------------------------------------- @@ -69,4 +65,5 @@ Contents userguide/index ide articles + FAQ history diff --git a/docs/installation.rst b/docs/installation.rst index 75e566a5..619253e7 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -30,19 +30,23 @@ application: application. .. warning:: - If you are going to run *PlatformIO* from **subprocess**, you **MUST - DISABLE** all prompts. It will allow you to avoid blocking. - There are a few options: + If you are going to run *PlatformIO* from **subprocess**, you + :ref:`MUST DISABLE ` all prompts. + It will allow you to avoid blocking. - - using environment variable :ref:`PLATFORMIO_SETTING_ENABLE_PROMPTS=No ` - - disable global setting ``enable_prompts`` via :ref:`cmd_settings` command - - masking under Continuous Integration system via environment variable - :ref:`CI=true `. -Please *choose one of* the following: +Troubleshooting +--------------- + +For further details, frequently questions, please refer to :ref:`faq`. + +Installation Methods +-------------------- + +Please *choose one of* the following installation methods: Super-Quick (Mac / Linux) -------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~ To install or upgrade *PlatformIO* paste that at a *Terminal* prompt (**you might need** to run ``sudo`` first): @@ -53,7 +57,7 @@ To install or upgrade *PlatformIO* paste that at a *Terminal* prompt Installer Script (Mac / Linux / Windows) ----------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To install or upgrade *PlatformIO*, download `get-platformio.py `_ @@ -70,16 +74,8 @@ On *Windows OS* it may look like: C:\Python27\python.exe get-platformio.py -.. warning:: - If you have an error ``pkg_resources.DistributionNotFound`` please - upgrade *SetupTools* package: ``$ [sudo] pip uninstall setuptools`` - and ``$ [sudo] pip install setuptools``. - Then re-install *PlatformIO*: ``$ [sudo] pip uninstall platformio`` - and ``$ [sudo] pip install platformio``. - - Full Guide ----------- +~~~~~~~~~~ 1. Check a ``python`` version (only 2.6-2.7 is supported): @@ -121,7 +117,7 @@ For upgrading the ``platformio`` to new version please use this command: Development Version -------------------- +~~~~~~~~~~~~~~~~~~~ .. warning:: We don't recommend to use ``develop`` version in production. diff --git a/docs/librarymanager/config.rst b/docs/librarymanager/config.rst index fe6e573f..1d0d64d2 100644 --- a/docs/librarymanager/config.rst +++ b/docs/librarymanager/config.rst @@ -167,6 +167,16 @@ A version of the current library source code. |PIOAPICR| will use the *CVS*-revision from the latest commit. +.. _libjson_url: + +``url`` +------- + +*Optional* | Type: ``String`` | Max. Length: 255 + +Home page of library (if is different from :ref:`libjson_repository` url). + + .. _libjson_include: ``include`` diff --git a/docs/platforms/atmelavr.rst b/docs/platforms/atmelavr.rst index fbbf6cc0..5cc1c84e 100644 --- a/docs/platforms/atmelavr.rst +++ b/docs/platforms/atmelavr.rst @@ -333,6 +333,26 @@ Arduino - 32 Kb - 2.5 Kb +BQ +~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``zumbt328`` + - `BQ ZUM BT-328 board `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + BitWizard ~~~~~~~~~ @@ -428,6 +448,53 @@ Engduino - 32 Kb - 2.5 Kb +LightUp +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``lightup`` + - `LightUp `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + +LowPowerLab +~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``moteino`` + - `LowPowerLab Moteino `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + + * - ``moteinomega`` + - `LowPowerLab MoteinoMEGA `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb + Microduino ~~~~~~~~~~ @@ -524,6 +591,60 @@ PanStamp - 32 Kb - 2 Kb +Quirkbot +~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``quirkbot`` + - `Quirkbot `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + +RedBearLab +~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``blend`` + - `RedBearLab Blend `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``blendmicro16`` + - `RedBearLab Blend Micro 3.3V/16MHz (overclock) `_ + - ATMEGA32U4 + - 16 MHz + - 32 Kb + - 2.5 Kb + + * - ``blendmicro8`` + - `RedBearLab Blend Micro 3.3V/8MHz `_ + - ATMEGA32U4 + - 8 MHz + - 32 Kb + - 2.5 Kb + RepRap ~~~~~~ @@ -598,6 +719,13 @@ SparkFun - Flash - RAM + * - ``sparkfun_digitalsandbox`` + - `SparkFun Digital Sandbox `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + * - ``sparkfun_fiov3`` - `SparkFun Fio V3 3.3V/8MHz `_ - ATMEGA32U4 @@ -653,3 +781,64 @@ SparkFun - 16 MHz - 32 Kb - 2 Kb + + * - ``uview`` + - `SparkFun MicroView `_ + - ATMEGA328P + - 16 MHz + - 32 Kb + - 2 Kb + +TinyCircuits +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``tinyduino`` + - `TinyCircuits TinyDuino Processor Board `_ + - ATMEGA328P + - 8 MHz + - 32 Kb + - 2 Kb + + * - ``tinylily`` + - `TinyCircuits TinyLily Mini Processor `_ + - ATMEGA328P + - 8 MHz + - 32 Kb + - 2 Kb + +WickedDevice +~~~~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``wildfirev2`` + - `WickedDevice WildFire v2 [stk500] `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb + + * - ``wildfirev3`` + - `WickedDevice WildFire v3 [optiboot] `_ + - ATMEGA1284P + - 16 MHz + - 128 Kb + - 16 Kb diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 42555ffd..811a4038 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -45,6 +45,9 @@ Packages * - ``framework-arduinoavr`` - `Arduino Wiring-based Framework (AVR Core, 1.6) `_ + * - ``framework-arduinoespressif`` + - `Arduino Wiring-based Framework (ESP8266 Core) `_ + * - ``framework-arduinomsp430`` - `Arduino Wiring-based Framework (MSP430 Core) `_ @@ -75,12 +78,18 @@ Packages * - ``ldscripts`` - `Linker Scripts `_ + * - ``sdk-esp8266`` + - `ESP8266 SDK `_ + * - ``tool-avrdude`` - `AVRDUDE `_ * - ``tool-bossac`` - `BOSSA CLI `_ + * - ``tool-esptool`` + - `esptool-ck `_ + * - ``tool-lm4flash`` - `Flash Programmer `_ @@ -105,6 +114,9 @@ Packages * - ``toolchain-timsp430`` - `msp-gcc `_, `GDB `_ + * - ``toolchain-xtensa`` + - `xtensa-gcc `_, `GDB `_ + .. _platform_creating_manifest_file: Manifest File diff --git a/docs/platforms/espressif.rst b/docs/platforms/espressif.rst new file mode 100644 index 00000000..2e159da3 --- /dev/null +++ b/docs/platforms/espressif.rst @@ -0,0 +1,79 @@ +.. _platform_espressif: + +Platform ``espressif`` +====================== +Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``ldscripts`` + - `Linker Scripts `_ + + * - ``sdk-esp8266`` + - `ESP8266 SDK `_ + + * - ``tool-esptool`` + - `esptool-ck `_ + + * - ``framework-arduinoespressif`` + - `Arduino Wiring-based Framework (ESP8266 Core) `_ + + * - ``toolchain-xtensa`` + - `xtensa-gcc `_, `GDB `_ + +.. warning:: + **Linux Users:** Don't forget to install "udev" rules file + `99-platformio-udev.rules `_ (an instruction is located in the file). + + + +Frameworks +---------- +.. list-table:: + :header-rows: 1 + + * - Name + - Description + + * - :ref:`framework_arduino` + - Arduino Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences. + +Boards +------ + +.. note:: + * You can list pre-configured boards by :ref:`cmd_boards` command or + `PlatformIO Boards Explorer `_ + * For more detailed ``board`` information please scroll tables below by + horizontal. + +Espressif +~~~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``esp01`` + - `Espressif ESP8266 board `_ + - ESP8266 + - 80 MHz + - 512 Kb + - 32 Kb diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index 220c3a67..00ec1e6e 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -16,6 +16,7 @@ MCU, upload protocol or etc. Please use ``board`` option. atmelavr atmelsam + espressif freescalekinetis nordicnrf51 nxplpc diff --git a/docs/platforms/teensy.rst b/docs/platforms/teensy.rst index 88b2fc05..11d25e24 100644 --- a/docs/platforms/teensy.rst +++ b/docs/platforms/teensy.rst @@ -98,3 +98,10 @@ Teensy - 72 MHz - 256 Kb - 64 Kb + + * - ``teensylc`` + - `Teensy LC `_ + - MKL26Z64 + - 48 MHz + - 64 Kb + - 8 Kb diff --git a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library index a9e5bc47..b346ad0d 160000 --- a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library +++ b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-GFX-Library @@ -1 +1 @@ -Subproject commit a9e5bc470736ffe9c9ef11d778bc4dcd47169d42 +Subproject commit b346ad0df569c3b5d27c7e64656a3e1408fb8aa8 diff --git a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library index 23d30dc4..065c2999 160000 --- a/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library +++ b/examples/atmelavr-and-arduino/arduino-external-libs/lib/Adafruit-PCD8544-Nokia-5110-LCD-library @@ -1 +1 @@ -Subproject commit 23d30dc48029a543918e5ecdff7c505558c313e3 +Subproject commit 065c29997b151429f33f0802b8efcb97ec6b7519 diff --git a/examples/espressif/esp8266-native/README.rst b/examples/espressif/esp8266-native/README.rst new file mode 100644 index 00000000..2704e158 --- /dev/null +++ b/examples/espressif/esp8266-native/README.rst @@ -0,0 +1,21 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/espressif/esp8266-native + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/espressif/esp8266-native/platformio.ini b/examples/espressif/esp8266-native/platformio.ini new file mode 100644 index 00000000..304bd86f --- /dev/null +++ b/examples/espressif/esp8266-native/platformio.ini @@ -0,0 +1,22 @@ +# +# 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:esp01_8266] +platform = espressif +board = esp01 diff --git a/examples/espressif/esp8266-native/src/user_config.h b/examples/espressif/esp8266-native/src/user_config.h new file mode 100644 index 00000000..35e838d5 --- /dev/null +++ b/examples/espressif/esp8266-native/src/user_config.h @@ -0,0 +1,5 @@ +#ifndef __USER_CONFIG_H__ +#define __USER_CONFIG_H__ + +#endif + diff --git a/examples/espressif/esp8266-native/src/user_main.c b/examples/espressif/esp8266-native/src/user_main.c new file mode 100644 index 00000000..b6f4d027 --- /dev/null +++ b/examples/espressif/esp8266-native/src/user_main.c @@ -0,0 +1,33 @@ +/****************************************************************************** + * Copyright 2013-2014 Espressif Systems (Wuxi) + * + * FileName: user_main.c + * + * Description: entry file of user application + * + * Modification history: + * 2014/1/1, v1.0 create this file. +*******************************************************************************/ +#include "ets_sys.h" +#include "osapi.h" + +#include "user_interface.h" +#include "smartconfig.h" + +void ICACHE_FLASH_ATTR +smartconfig_done(void *data) +{ + struct station_config *sta_conf = data; + + wifi_station_set_config(sta_conf); + wifi_station_disconnect(); + wifi_station_connect(); +} + +void user_init(void) +{ + os_printf("SDK version:%s\n", system_get_sdk_version()); + + wifi_set_opmode(STATION_MODE); + smartconfig_start(SC_TYPE_AIRKISS, smartconfig_done); +} diff --git a/examples/espressif/esp8266-webserver/README.rst b/examples/espressif/esp8266-webserver/README.rst new file mode 100644 index 00000000..cf185df7 --- /dev/null +++ b/examples/espressif/esp8266-webserver/README.rst @@ -0,0 +1,21 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/espressif/esp8266-webserver + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/espressif/esp8266-webserver/platformio.ini b/examples/espressif/esp8266-webserver/platformio.ini new file mode 100644 index 00000000..e79ce81c --- /dev/null +++ b/examples/espressif/esp8266-webserver/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:esp01_8266] +platform = espressif +framework = arduino +board = esp01 diff --git a/examples/espressif/esp8266-webserver/src/HelloServer.ino b/examples/espressif/esp8266-webserver/src/HelloServer.ino new file mode 100644 index 00000000..55cdf043 --- /dev/null +++ b/examples/espressif/esp8266-webserver/src/HelloServer.ino @@ -0,0 +1,54 @@ +#include +#include +#include + +const char* ssid = "*****"; +const char* password = "*****"; + + +ESP8266WebServer server(80); + +const int led = 13; + +void handle_root() { + digitalWrite(led, 1); + server.send(200, "text/plain", "hello from esp8266!"); + delay(100); + digitalWrite(led, 0); +} + +void setup(void) +{ + Serial.begin(115200); + pinMode(led, OUTPUT); + digitalWrite(led, 0); + + // Connect to WiFi network + WiFi.begin(ssid, password); + Serial.println(""); + + // Wait for connection + while (WiFi.status() != WL_CONNECTED) { + delay(500); + Serial.print("."); + } + Serial.println(""); + Serial.print("Connected to "); + Serial.println(ssid); + Serial.print("IP address: "); + Serial.println(WiFi.localIP()); + + server.on("/", handle_root); + + server.on("/inline", [](){ + server.send(200, "text/plain", "this works as well"); + }); + + server.begin(); + Serial.println("HTTP server started"); +} + +void loop(void) +{ + server.handleClient(); +} diff --git a/examples/espressif/esp8266-wifiscan/README.rst b/examples/espressif/esp8266-wifiscan/README.rst new file mode 100644 index 00000000..44f46cf9 --- /dev/null +++ b/examples/espressif/esp8266-wifiscan/README.rst @@ -0,0 +1,21 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/espressif/esp8266-wifiscan + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/espressif/esp8266-wifiscan/platformio.ini b/examples/espressif/esp8266-wifiscan/platformio.ini new file mode 100644 index 00000000..e79ce81c --- /dev/null +++ b/examples/espressif/esp8266-wifiscan/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:esp01_8266] +platform = espressif +framework = arduino +board = esp01 diff --git a/examples/espressif/esp8266-wifiscan/src/WiFiScan.ino b/examples/espressif/esp8266-wifiscan/src/WiFiScan.ino new file mode 100644 index 00000000..3e6ff736 --- /dev/null +++ b/examples/espressif/esp8266-wifiscan/src/WiFiScan.ino @@ -0,0 +1,48 @@ +/* + * This sketch demonstrates how to scan WiFi networks. + * The API is almost the same as with the WiFi Shield library, + * the most obvious difference being the different file you need to include: + */ +#include "ESP8266WiFi.h" + +void setup() { + Serial.begin(115200); + + // Set WiFi to station mode and disconnect from an AP if it was previously connected + WiFi.mode(WIFI_STA); + WiFi.disconnect(); + delay(100); + + Serial.println("Setup done"); +} + +void loop() { + Serial.println("scan start"); + + // WiFi.scanNetworks will return the number of networks found + int n = WiFi.scanNetworks(); + Serial.println("scan done"); + if (n == 0) + Serial.println("no networks found"); + else + { + Serial.print(n); + Serial.println(" networks found"); + for (int i = 0; i < n; ++i) + { + // Print SSID and RSSI for each network found + Serial.print(i + 1); + Serial.print(": "); + Serial.print(WiFi.SSID(i)); + Serial.print(" ("); + Serial.print(WiFi.RSSI(i)); + Serial.print(")"); + Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*"); + delay(10); + } + } + Serial.println(""); + + // Wait a bit before scanning again + delay(5000); +} diff --git a/examples/teensy/teensy-internal-libs/platformio.ini b/examples/teensy/teensy-internal-libs/platformio.ini index ced3cf02..18ce5b16 100644 --- a/examples/teensy/teensy-internal-libs/platformio.ini +++ b/examples/teensy/teensy-internal-libs/platformio.ini @@ -40,3 +40,9 @@ platform = teensy framework = arduino board = teensy31 build_flags = -DTEENSY31 + +[env:teensylc] +platform = teensy +framework = arduino +board = teensylc +build_flags = -DTEENSYLC diff --git a/platformio/__init__.py b/platformio/__init__.py index d8d3b7ba..76c10d5a 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (1, 3, 0) +VERSION = (1, 4, 0) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/boards/espressif.json b/platformio/boards/espressif.json new file mode 100644 index 00000000..6c2b226c --- /dev/null +++ b/platformio/boards/espressif.json @@ -0,0 +1,24 @@ +{ + "esp01": { + "build": { + "core": "esp8266", + "extra_flags": "-DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266", + "f_cpu": "80000000L", + "ldscript": "esp8266.ld", + "mcu": "esp8266", + "variant": "esp01" + }, + "frameworks": ["arduino"], + "name": "Espressif ESP8266 board", + "platform": "espressif", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 524288, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "https://nurdspace.nl/ESP8266", + "vendor": "Espressif" + } +} \ No newline at end of file diff --git a/platformio/boards/misc.json b/platformio/boards/misc.json index 495fa4ef..b9f7dba6 100644 --- a/platformio/boards/misc.json +++ b/platformio/boards/misc.json @@ -226,5 +226,300 @@ }, "url": "https://code.google.com/p/sanguino/", "vendor": "Sanguino" + }, + + "tinyduino": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", + "f_cpu": "8000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "TinyCircuits TinyDuino Processor Board", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 30720, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 57600 + }, + "url": "https://tiny-circuits.com/tinyduino-processor-board.html", + "vendor": "TinyCircuits" + }, + + "wildfirev3": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR", + "f_cpu": "16000000L", + "mcu": "atmega1284p", + "variant": "wildfirev3" + }, + "frameworks": ["arduino"], + "name": "WickedDevice WildFire v3 [optiboot]", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 130048, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "http://shop.wickeddevice.com/resources/wildfire/", + "vendor": "WickedDevice" + }, + + "wildfirev2": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR", + "f_cpu": "16000000L", + "mcu": "atmega1284p", + "variant": "wildfirev2" + }, + "frameworks": ["arduino"], + "name": "WickedDevice WildFire v2 [stk500]", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 122878, + "protocol": "wiring", + "require_upload_port" : true, + "speed": 38400 + }, + "url": "http://shop.wickeddevice.com/resources/wildfire/#arduinoidesetup", + "vendor": "WickedDevice" + }, + + "blend": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x8036", + "usb_product": "RedBearLab Blend", + "variant": "leonardo", + "vid": "0x2341" + }, + "frameworks": ["arduino"], + "name": "RedBearLab Blend", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + }, + "url": "http://redbearlab.com/blend/", + "vendor": "RedBearLab" + }, + + "blendmicro8": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x2404", + "usb_product": "RedBearLab Blend", + "variant": "micro", + "vid": "0x03EB" + }, + "frameworks": ["arduino"], + "name": "RedBearLab Blend Micro 3.3V/8MHz", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + }, + "url": "http://redbearlab.com/blendmicro/", + "vendor": "RedBearLab" + }, + + "blendmicro16": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR", + "f_cpu": "16000000L", + "mcu": "atmega32u4", + "pid": "0x2404", + "usb_product": "RedBearLab Blend", + "variant": "micro", + "vid": "0x03EB" + }, + "frameworks": ["arduino"], + "name": "RedBearLab Blend Micro 3.3V/16MHz (overclock)", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + }, + "url": "http://redbearlab.com/blendmicro/", + "vendor": "RedBearLab" + }, + + "tinylily": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_LILYPAD", + "f_cpu": "8000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "TinyCircuits TinyLily Mini Processor", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 30720, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 57600 + }, + "url": "https://tiny-circuits.com/tiny-lily-mini-processor.html", + "vendor": "TinyCircuits" + }, + + "lightup": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_LEONARDO", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "pid": "0x6096", + "usb_product": "LightUp", + "variant": "leonardo", + "vid": "0x1d50" + }, + "frameworks": ["arduino"], + "name": "LightUp", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + }, + "url": "https://www.lightup.io/", + "vendor": "LightUp" + }, + + "moteino": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MOTEINO", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "LowPowerLab Moteino", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 31744, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "https://lowpowerlab.com/shop/moteino-r4", + "vendor": "LowPowerLab" + }, + + "moteinomega": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DAVR_MOTEINOMEGA", + "f_cpu": "16000000L", + "mcu": "atmega1284p", + "variant": "moteinoMega" + }, + "frameworks": ["arduino"], + "name": "LowPowerLab MoteinoMEGA", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 16384, + "maximum_size": 130048, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "http://lowpowerlab.com/blog/2014/08/09/moteinomega-available-now/", + "vendor": "LowPowerLab" + }, + + "zumbt328": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_BT", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "eightanaloginputs" + }, + "frameworks": ["arduino"], + "name": "BQ ZUM BT-328 board", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2048, + "maximum_size": 28672, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 19200 + }, + "url": "http://www.bq.com/gb/products/zum.html", + "vendor": "BQ" + }, + + "quirkbot": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DQUIRKBOT", + "f_cpu": "8000000L", + "mcu": "atmega32u4", + "variant" : "quirkbot", + "vid": "0xf055", + "pid": "0xf055", + "usb_product": "Quirkbot" + }, + "frameworks": ["arduino"], + "name": "Quirkbot", + "platform": "atmelavr", + "upload": { + "disable_flushing": true, + "maximum_ram_size": 2560, + "maximum_size": 28672, + "protocol": "avr109", + "require_upload_port" : true, + "speed": 57600, + "use_1200bps_touch": true, + "wait_for_upload_port": true + }, + "url": "http://quirkbot.com", + "vendor": "Quirkbot" } } diff --git a/platformio/boards/sparkfun.json b/platformio/boards/sparkfun.json index 88240040..79285509 100644 --- a/platformio/boards/sparkfun.json +++ b/platformio/boards/sparkfun.json @@ -187,5 +187,48 @@ }, "url": "https://www.sparkfun.com/products/10743", "vendor": "SparkFun" + }, + "sparkfun_digitalsandbox": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "SparkFun Digital Sandbox", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "https://www.sparkfun.com/products/12651", + "vendor": "SparkFun" + }, + + "uview": { + "build": { + "core": "arduino", + "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO", + "f_cpu": "16000000L", + "mcu": "atmega328p", + "variant": "standard" + }, + "frameworks": ["arduino"], + "name": "SparkFun MicroView", + "platform": "atmelavr", + "upload": { + "maximum_ram_size": 2048, + "maximum_size": 32256, + "protocol": "arduino", + "require_upload_port" : true, + "speed": 115200 + }, + "url": "https://www.sparkfun.com/products/12923", + "vendor": "SparkFun" } } \ No newline at end of file diff --git a/platformio/boards/teensy.json b/platformio/boards/teensy.json index bb3b4a88..c0e39961 100644 --- a/platformio/boards/teensy.json +++ b/platformio/boards/teensy.json @@ -71,5 +71,25 @@ }, "url": "https://www.pjrc.com/store/teensy31.html", "vendor": "Teensy" + }, + + "teensylc": { + "build": { + "core": "teensy3", + "extra_flags": "-D__MKL26Z64__", + "f_cpu": "48000000L", + "ldscript": "mkl26z64.ld", + "mcu": "mkl26z64", + "cpu": "cortex-m0plus" + }, + "frameworks": ["arduino"], + "name": "Teensy LC", + "platform": "teensy", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 63488 + }, + "url": "http://www.pjrc.com/teensy/teensyLC.html", + "vendor": "Teensy" } } diff --git a/platformio/builder/scripts/basearm.py b/platformio/builder/scripts/basearm.py index 9ae00990..bae7db23 100644 --- a/platformio/builder/scripts/basearm.py +++ b/platformio/builder/scripts/basearm.py @@ -45,9 +45,10 @@ env.Replace( LINKFLAGS=[ "-Os", - "-Wl,--gc-sections", + "-Wl,--gc-sections,--relax", "-mthumb", - "-mcpu=${BOARD_OPTIONS['build']['cpu']}" + "-mcpu=${BOARD_OPTIONS['build']['cpu']}", + "--specs=nano.specs" ], LIBS=["c", "gcc", "m"], @@ -55,21 +56,6 @@ env.Replace( SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES' ) -if env.get("BOARD_OPTIONS", {}).get("build", {}).get( - "cpu", "")[-2:] == "m4" and env.get("BOARD") != "frdm_k20d50m": - env.Append( - CPPFLAGS=[ - "-mfloat-abi=hard", - "-mfpu=fpv4-sp-d16", - "-fsingle-precision-constant" - ], - LINKFLAGS=[ - "-mfloat-abi=hard", - "-mfpu=fpv4-sp-d16", - "-fsingle-precision-constant" - ] - ) - env.Append( BUILDERS=dict( ElfToBin=Builder( diff --git a/platformio/builder/scripts/baseavr.py b/platformio/builder/scripts/baseavr.py index 8a0384f1..3ac52b00 100644 --- a/platformio/builder/scripts/baseavr.py +++ b/platformio/builder/scripts/baseavr.py @@ -44,7 +44,7 @@ env.Replace( LINKFLAGS=[ "-Os", "-mmcu=$BOARD_MCU", - "-Wl,--gc-sections" + "-Wl,--gc-sections,--relax" ], LIBS=["m"], diff --git a/platformio/builder/scripts/espressif.py b/platformio/builder/scripts/espressif.py new file mode 100644 index 00000000..289f9955 --- /dev/null +++ b/platformio/builder/scripts/espressif.py @@ -0,0 +1,160 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Espressif MCUs +""" + +from os.path import join + +from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default, + DefaultEnvironment) + + +def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621 + env.AutodetectUploadPort() + + +env = DefaultEnvironment() + +env.Replace( + AR="xtensa-lx106-elf-ar", + AS="xtensa-lx106-elf-as", + CC="xtensa-lx106-elf-gcc", + CXX="xtensa-lx106-elf-g++", + OBJCOPY="xtensa-lx106-elf-objcopy", + RANLIB="xtensa-lx106-elf-ranlib", + SIZETOOL="xtensa-lx106-elf-size", + + ARFLAGS=["rcs"], + + ASPPFLAGS=["-x", "assembler-with-cpp"], + + CFLAGS=[ + "-std=c99", + "-Wpointer-arith", + "-Wno-implicit-function-declaration", + "-Wl,-EL", + "-fno-inline-functions", + "-nostdlib" + ], + + CPPFLAGS=[ + "-Os", # optimize for size + "-mlongcalls", + "-mtext-section-literals", + "-MMD" # output dependancy info + ], + + CXXFLAGS=[ + "-fno-rtti", + "-fno-exceptions", + "-std=c++11" + ], + + CPPDEFINES=[ + "F_CPU=$BOARD_F_CPU", + "__ets__", + "ICACHE_FLASH" + ], + + LINKFLAGS=[ + "-nostdlib", + "-Wl,--no-check-sections", + "-u", "call_user_start", + "-Wl,-static" + ], + + SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES', + + UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"), + UPLOADERFLAGS=[ + "-vv", + "-cd", "none", + "-cb", "$UPLOAD_SPEED", + "-cp", "$UPLOAD_PORT", + "-ca", "0x00000", + "-cf", "${SOURCES[0]}", + "-ca", "0x40000", + "-cf", "${SOURCES[1]}" + ], + UPLOADCMD='$UPLOADER $UPLOADERFLAGS' +) + +env.Append( + BUILDERS=dict( + ElfToBin=Builder( + action=" ".join([ + "$UPLOADER", + "-eo", "$SOURCES", + "-bo", "${TARGETS[0]}", + "-bs", ".text", + "-bs", ".data", + "-bs", ".rodata", + "-bc", "-ec", + "-eo", "$SOURCES", + "-es", ".irom0.text", "${TARGETS[1]}", + "-ec", "-v" + ]), + suffix=".bin" + ) + ) +) + +# +# Configure SDK +# + +if "FRAMEWORK" not in env: + env.Append( + CPPPATH=[ + join("$PIOPACKAGES_DIR", "sdk-esp8266", "include"), + "$PROJECTSRC_DIR" + ], + LIBPATH=[join("$PIOPACKAGES_DIR", "sdk-esp8266", "lib")] + ) + env.Replace( + LDSCRIPT_PATH=join( + "$PIOPACKAGES_DIR", "sdk-esp8266", "ld", "eagle.app.v6.ld"), + LIBS=["c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "main", + "json", "upgrade", "smartconfig", "at", "ssl"] + ) + +# +# Target: Build executable and linkable firmware +# + +target_elf = env.BuildFirmware() + +# +# Target: Build the .hex +# + +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_firm = join("$BUILD_DIR", "firmware.bin") +else: + target_firm = env.ElfToBin( + [join("$BUILD_DIR", "firmware_00000"), + join("$BUILD_DIR", "firmware_40000")], target_elf) + + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Upload firmware +# + +upload = env.Alias(["upload", "uploadlazy"], target_firm, + [BeforeUpload, "$UPLOADCMD"]) +AlwaysBuild(upload) + +# +# Target: Define targets +# + +Default([target_firm, target_size]) diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index 1fa6d456..efded5f3 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -42,6 +42,13 @@ elif env.get("PLATFORM") == "timsp430": "$PIOPACKAGES_DIR", "framework-arduinomsp430" ) +elif env.get("PLATFORM") == "espressif": + env.Prepend( + CPPPATH=[join("$PLATFORMFW_DIR", "sdk", "include")], + LIBPATH=[join("$PLATFORMFW_DIR", "sdk", "lib")], + LIBS=["hal", "phy", "net80211", "lwip", + "wpa", "main", "pp", "c", "gcc"] + ) env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR) @@ -195,14 +202,12 @@ libs.append(envsafe.BuildLibrary( )) if env.subst("${PLATFORMFW_DIR}")[-3:] == "sam": - env.Append( LIBPATH=[ join("$PLATFORMFW_DIR", "variants", "${BOARD_OPTIONS['build']['variant']}") ] ) - envsafe.Append( CFLAGS=[ "-std=gnu99" diff --git a/platformio/builder/scripts/teensy.py b/platformio/builder/scripts/teensy.py index 140fa8fd..ba657713 100644 --- a/platformio/builder/scripts/teensy.py +++ b/platformio/builder/scripts/teensy.py @@ -16,6 +16,9 @@ if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy": SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py"))) elif env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy3": SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) + env.Append( + LINKFLAGS=["-Wl,--defsym=__rtc_localtime=$UNIX_TIME"] + ) env.Append( CPPDEFINES=[ diff --git a/platformio/builder/tools/platformio.py b/platformio/builder/tools/platformio.py index 9913c91a..8402e6e3 100644 --- a/platformio/builder/tools/platformio.py +++ b/platformio/builder/tools/platformio.py @@ -63,7 +63,7 @@ def BuildFirmware(env): return firmenv.Program( join("$BUILD_DIR", "firmware"), [firmenv.GlobCXXFiles(vdir) for vdir in vdirs], - LIBS=env.get("LIBS", []) + deplibs, + LIBS=list(env.get("LIBS", []) + deplibs)[::-1], LIBPATH=env.get("LIBPATH", []) + ["$BUILD_DIR"], PROGSUFFIX=".elf" ) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index 4a8da390..87d673d4 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -10,12 +10,11 @@ from time import time import click -from platformio import __version__, app, telemetry +from platformio import __version__, app, exception, telemetry from platformio.commands.install import cli as cmd_install from platformio.commands.lib import lib_update as cmd_libraries_update from platformio.commands.update import cli as cli_update from platformio.commands.upgrade import get_latest_version -from platformio.exception import GetLatestVersionError, UpgraderFailed from platformio.libmanager import LibraryManager from platformio.platforms.base import PlatformFactory from platformio.util import get_home_dir, get_lib_dir @@ -24,9 +23,14 @@ from platformio.util import get_home_dir, get_lib_dir def on_platformio_start(ctx): telemetry.on_command(ctx) after_upgrade(ctx) - check_platformio_upgrade() - check_internal_updates(ctx, "platforms") - check_internal_updates(ctx, "libraries") + + try: + check_platformio_upgrade() + check_internal_updates(ctx, "platforms") + check_internal_updates(ctx, "libraries") + except (exception.GetLatestVersionError, exception.APIRequestError): + click.secho("Failed to check for PlatformIO upgrades. " + "Please check your Internet connection.", fg="red") def on_platformio_end(ctx, result): # pylint: disable=W0613 @@ -135,7 +139,7 @@ def after_upgrade(ctx): telemetry.on_event(category="Auto", action="Upgrade", label="%s > %s" % (last_version, __version__)) else: - raise UpgraderFailed() + raise exception.UpgraderFailed() click.echo("") @@ -148,12 +152,7 @@ def check_platformio_upgrade(): last_check['platformio_upgrade'] = int(time()) app.set_state_item("last_check", last_check) - try: - latest_version = get_latest_version() - except GetLatestVersionError: - click.secho("Failed to check for PlatformIO upgrades", fg="red") - return - + latest_version = get_latest_version() if (latest_version == __version__ or Upgrader.version_to_int(latest_version) < Upgrader.version_to_int(__version__)): diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 72f7c77d..42398753 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -30,6 +30,10 @@ PLATFORM_PACKAGES = { ("Arduino Wiring-based Framework (MSP430 Core)", "http://arduino.cc/en/Reference/HomePage") ], + "framework-arduinoespressif": [ + ("Arduino Wiring-based Framework (ESP8266 Core)", + "https://github.com/esp8266/Arduino") + ], "framework-energiamsp430": [ ("Energia Wiring-based Framework (MSP430 Core)", "http://energia.nu/reference/") @@ -55,6 +59,9 @@ PLATFORM_PACKAGES = { "framework-mbed": [ ("mbed Framework", "http://mbed.org") ], + "sdk-esp8266": [ + ("ESP8266 SDK", "http://bbs.espressif.com") + ], "ldscripts": [ ("Linker Scripts", "https://sourceware.org/binutils/docs/ld/Scripts.html") @@ -69,6 +76,10 @@ PLATFORM_PACKAGES = { ("gcc-arm-embedded", "https://launchpad.net/gcc-arm-embedded"), ("GDB", "http://www.gnu.org/software/gdb/") ], + "toolchain-xtensa": [ + ("xtensa-gcc", "https://github.com/jcmvbkbc/gcc-xtensa"), + ("GDB", "http://www.gnu.org/software/gdb/") + ], "toolchain-timsp430": [ ("msp-gcc", "http://sourceforge.net/projects/mspgcc/"), ("GDB", "http://www.gnu.org/software/gdb/") @@ -93,6 +104,9 @@ PLATFORM_PACKAGES = { ], "tool-mspdebug": [ ("MSPDebug", "http://mspdebug.sourceforge.net/") + ], + "tool-esptool": [ + ("esptool-ck", "https://github.com/igrr/esptool-ck") ] } diff --git a/platformio/platforms/espressif.py b/platformio/platforms/espressif.py new file mode 100644 index 00000000..4336aeb3 --- /dev/null +++ b/platformio/platforms/espressif.py @@ -0,0 +1,43 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform + + +class EspressifPlatform(BasePlatform): + + """ + Espressif Systems is a privately held fabless semiconductor company. + They provide wireless communications and Wi-Fi chips which are widely + used in mobile devices and the Internet of Things applications. + + https://espressif.com/ + """ + + PACKAGES = { + + "toolchain-xtensa": { + "alias": "toolchain", + "default": True + }, + + "ldscripts": { + "default": True + }, + + "tool-esptool": { + "alias": "uploader", + "default": True + }, + + "sdk-esp8266": { + "default": True + }, + + "framework-arduinoespressif": { + "default": True + } + } + + def get_name(self): + return "Espressif" diff --git a/scripts/appveyor/install.ps1 b/scripts/appveyor/install.ps1 new file mode 100644 index 00000000..3fb6cf28 --- /dev/null +++ b/scripts/appveyor/install.ps1 @@ -0,0 +1,87 @@ +# https://packaging.python.org/en/latest/appveyor.html +# Sample script to install Python and pip under Windows +# Authors: Olivier Grisel and Kyle Kastner +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ + +$BASE_URL = "https://www.python.org/ftp/python/" +$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" +$GET_PIP_PATH = "C:\get-pip.py" + + +function DownloadPython ($python_version, $platform_suffix) { + $webclient = New-Object System.Net.WebClient + $filename = "python-" + $python_version + $platform_suffix + ".msi" + $url = $BASE_URL + $python_version + "/" + $filename + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 5 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 3 + for($i=0; $i -lt $retry_attempts; $i++){ + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + Write-Host "File saved at" $filepath + return $filepath +} + + +function InstallPython ($python_version, $architecture, $python_home) { + Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "32") { + $platform_suffix = "" + } else { + $platform_suffix = ".amd64" + } + $filepath = DownloadPython $python_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $args = "/qn /i $filepath TARGETDIR=$python_home" + Write-Host "msiexec.exe" $args + Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru + Write-Host "Python $python_version ($architecture) installation complete" + return $true +} + + +function InstallPip ($python_home) { + $pip_path = $python_home + "/Scripts/pip.exe" + $python_path = $python_home + "/python.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $webclient = New-Object System.Net.WebClient + $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) + Write-Host "Executing:" $python_path $GET_PIP_PATH + Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru + } else { + Write-Host "pip already installed." + } +} + +function InstallPackage ($python_home, $pkg) { + $pip_path = $python_home + "/Scripts/pip.exe" + & $pip_path install $pkg +} + +function main () { + InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME + InstallPip $env:PYTHON_HOME + InstallPackage $env:PYTHON_HOME setuptools + InstallPackage $env:PYTHON_HOME tox +} + +main \ No newline at end of file diff --git a/scripts/appveyor/run_with_compiler.cmd b/scripts/appveyor/run_with_compiler.cmd new file mode 100644 index 00000000..7a75d18c --- /dev/null +++ b/scripts/appveyor/run_with_compiler.cmd @@ -0,0 +1,48 @@ +:: https://packaging.python.org/en/latest/appveyor.html +:: To build extensions for 64 bit Python 3, we need to configure environment +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) +:: +:: To build extensions for 64 bit Python 2, we need to configure environment +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) +:: +:: 32 bit builds do not require specific environment configurations. +:: +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the +:: cmd interpreter, at least for (SDK v7.0) +:: +:: More details at: +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows +:: http://stackoverflow.com/a/13751649/163740 +:: +:: Author: Olivier Grisel +:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +@ECHO OFF + +SET COMMAND_TO_RUN=%* +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows + +SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" +IF %MAJOR_PYTHON_VERSION% == "2" ( + SET WINDOWS_SDK_VERSION="v7.0" +) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( + SET WINDOWS_SDK_VERSION="v7.1" +) ELSE ( + ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" + EXIT 1 +) + +IF "%PYTHON_ARCH%"=="64" ( + ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) ELSE ( + ECHO Using default MSVC build environment for 32 bit architecture + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index 2677ccfc..9ababba2 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -1,6 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. +from glob import glob from os import listdir, walk from os.path import dirname, getsize, isdir, isfile, join, normpath from shutil import rmtree @@ -39,12 +40,11 @@ def test_run(platformio_setup, pioproject_dir): pioenvs_dir = join(pioproject_dir, ".pioenvs") for item in listdir(pioenvs_dir): assert isfile(join(pioenvs_dir, item, "firmware.elf")) - # check .hex or .bin file - bin_file = join(pioenvs_dir, item, "firmware.bin") - hex_file = join(pioenvs_dir, item, "firmware.hex") - if not isfile(bin_file): - if not isfile(hex_file): - pytest.fail("Missed firmware file") - assert getsize(hex_file) > 0 - else: - assert getsize(bin_file) > 0 + # check .hex or .bin files + firmwares = [] + for ext in ("bin", "hex"): + firmwares += glob(join(pioenvs_dir, item, "firmware*.%s" % ext)) + if not firmwares: + pytest.fail("Missed firmware file") + for firmware in firmwares: + assert getsize(firmware) > 0