Merge branch 'release/v0.1.0'

This commit is contained in:
Ivan Kravets
2016-11-18 17:11:29 +02:00
41 changed files with 2037 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
*.pyc
+24
View File
@@ -0,0 +1,24 @@
language: python
python:
- "2.7"
env:
- PLATFORMIO_PROJECT_DIR=examples/arduino-blink
- PLATFORMIO_PROJECT_DIR=examples/arduino-wifiscan
- PLATFORMIO_PROJECT_DIR=examples/espidf-http-request
install:
- pip install -U https://github.com/platformio/platformio/archive/develop.zip
- platformio platform install file://.
script:
- platformio run -d $PLATFORMIO_PROJECT_DIR
notifications:
email: false
slack:
rooms:
secure: EkXAtWoUQtgtFeiOobnNZmaUgPw7evpo60Tam5jQiKbVK02bCbBODELTSFsGfIj05oAzNm4s1xBTRD3x9bsvPqvfThHwIHZ2M2BlrT06iINsfFXoXM5yCuBAIi8FF61UKmiZn+Pm+IK6OeUFmzXoP5BcpS2LRB0eSoCj0nsF5cj/H+oA6BnCn/5AXhbSQSiHxOPfq/0khQb5dalmf3B9NHq08MEiOLJR5J9zPglKMfE2HR8PS98irN0x1t9+aReMfUJSZrxfqwvWKz/Sb38/2H37A4GOXpsnRDagZXkfw/MSckSxRFtW8p/0LUBQqeaxdC5Z9qIuyDCAeHPm8d0AIArR7Ylz6BjlNVJVdCTAZaNTp7PUV4n1cN7gZPq8NhWnuGG3wdWiYlJEyHmmRjr9adDYTshCl3gf2GOjB5YJIjoNrixkoJwHM2gJLvwuOw7mgo0hLbqW84XSgV6KeSU12AYk9d2nz3AhWVsb4DiKrN+EqnhBVnCygAxYGlNxfZOPG0FIYai2DUsl6PXd3OBmxeNEWG+x7BivG+maaQEyC4SeFaNFIBR1L4F+C0fHW1VxiCvJCb6vB7fOk7fU5UDhpYnrRmSuyAVYR86aZ+3VnZjbjpGac6hfN7Qxg5WeC5Yd6eR2lrNag9lG5zASylZ1nsdlOZloPs8ilGe43mDpAkg=
on_failure: always
on_success: change
+174
View File
@@ -0,0 +1,174 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
+20 -2
View File
@@ -1,2 +1,20 @@
# platform-espressif32
Espressif 32: development platform for PlatformIO
# Espressif 32: development platform for [PlatformIO](http://platformio.org)
[![Build Status](https://travis-ci.org/platformio/platform-espressif32.svg?branch=develop)](https://travis-ci.org/platformio/platform-espressif32)
[![Build status](https://ci.appveyor.com/api/projects/status/nl087sumhneumse3/branch/develop?svg=true)](https://ci.appveyor.com/project/ivankravets/platform-espressif32/branch/develop)
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.
* [Home](http://platformio.org/platforms/espressif32) (home page in PlatformIO Platform Registry)
* [Documentation](http://docs.platformio.org/en/stable/platforms/espressif32.html) (advanced usage, packages, boards, frameworks, etc.)
# Usage
1. [Install PlatformIO CLI](http://docs.platformio.org/en/stable/installation.html)
2. Install Espressif 32 development platform:
```bash
# install the latest stable version
> platformio platform install espressif32
# install development version
> platformio platform install https://github.com/platformio/platform-espressif32.git
```
+24
View File
@@ -0,0 +1,24 @@
build: off
environment:
matrix:
- PLATFORMIO_PROJECT_DIR: "examples/arduino-blink"
- PLATFORMIO_PROJECT_DIR: "examples/arduino-wifiscan"
- PLATFORMIO_PROJECT_DIR: "examples/espidf-http-request"
install:
- cmd: git submodule update --init --recursive
- cmd: SET PATH=%PATH%;C:\Python27\Scripts
- cmd: pip install -U https://github.com/platformio/platformio/archive/develop.zip
- cmd: platformio platform install file://.
test_script:
- cmd: platformio run -d %PLATFORMIO_PROJECT_DIR%
notifications:
- provider: Slack
incoming_webhook:
secure: E9H0SU0Ju7WLDvgxsV8cs3J62T3nTTX7QkEjsczN0Sto/c9hWkVfhc5gGWUkxhlD975cokHByKGJIdwYwCewqOI+7BrcT8U+nlga4Uau7J8=
on_build_success: false
on_build_failure: true
on_build_status_changed: true
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_ESP320",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "esp320"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Electronic SweetPeas ESP320",
"upload": {
"maximum_ram_size": 294912,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "http://www.sweetpeas.se/controller-modules/10-esp210.html",
"vendor": "Electronic SweetPeas"
}
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_ESP32_DEV",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "esp32"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Espressif ESP32 Dev Module",
"upload": {
"maximum_ram_size": 114688,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Espressif"
}
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_ESPea32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "espea32"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "April Brother ESPea32",
"upload": {
"maximum_ram_size": 294912,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "https://blog.aprbrother.com/product/espea",
"vendor": "April Brother"
}
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_LoLin32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "lolin32"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "WEMOS LoLin32",
"upload": {
"maximum_ram_size": 294912,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "https://wemos.cc",
"vendor": "WEMOS"
}
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_NANO32",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "nano32"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "MakerAsia Nano32",
"upload": {
"maximum_ram_size": 294912,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "http://iot-bits.com/nano32-esp32-development-board",
"vendor": "MakerAsia"
}
+27
View File
@@ -0,0 +1,27 @@
{
"build": {
"core": "esp32",
"extra_flags": "-DESP32_DEV -DARDUINO_QUANTUM",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"ldscript": "esp32_out.ld",
"mcu": "esp32",
"variant": "quantum"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "Noduino Quantum",
"upload": {
"maximum_ram_size": 294912,
"maximum_size": 1044464,
"require_upload_port": true,
"resetmethod": "nodemcu",
"speed": 115200,
"wait_for_upload_port": true
},
"url": "http://wiki.jackslab.org/Noduino",
"vendor": "Noduino"
}
+111
View File
@@ -0,0 +1,111 @@
# Copyright 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Arduino
Arduino Wiring-based 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.
http://arduino.cc/en/Reference/HomePage
"""
from os.path import isdir, join
from SCons.Script import DefaultEnvironment
env = DefaultEnvironment()
platform = env.PioPlatform()
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32")
FRAMEWORK_VERSION = platform.get_package_version(
"framework-arduinoespressif32")
assert isdir(FRAMEWORK_DIR)
env.Prepend(
CPPDEFINES=[
"ARDUINO=%s" % FRAMEWORK_VERSION.split(".")[1],
"ARDUINO_ARCH_ESP32"
],
CPPPATH=[
join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "bt"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "driver"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "esp32"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "freertos"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "log"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "lwip"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "newlib"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nvs_flash"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "spi_flash"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "tcpip_adapter"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "vfs"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "expat"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "json"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "mbedtls"),
join(FRAMEWORK_DIR, "tools", "sdk", "include", "nghttp"),
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
],
LIBPATH=[
join(FRAMEWORK_DIR, "tools", "sdk", "lib"),
join(FRAMEWORK_DIR, "tools", "sdk", "ld"),
],
LIBS=[
"hal", "core", "net80211", "phy", "rtc", "pp", "wpa",
"smartconfig", "btdm_app", "bt", "driver", "esp32", "crypto", "expat",
"freertos", "json", "log", "lwip", "mbedtls", "nghttp", "nvs_flash",
"spi_flash", "tcpip_adapter", "newlib", "vfs", "gcc", "m", "c"
]
)
env.Append(
LIBSOURCE_DIRS=[
join(FRAMEWORK_DIR, "libraries")
],
LINKFLAGS=[
"-T", "esp32.common.ld",
"-T", "esp32.rom.ld",
"-T", "esp32.peripherals.ld"
]
)
#
# Target: Build Core Library
#
libs = []
if "build.variant" in env.BoardConfig():
env.Append(
CPPPATH=[
join(FRAMEWORK_DIR, "variants",
env.BoardConfig().get("build.variant"))
]
)
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FrameworkArduinoVariant"),
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
))
envsafe = env.Clone()
libs.append(envsafe.BuildLibrary(
join("$BUILD_DIR", "FrameworkArduino"),
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
))
env.Prepend(LIBS=libs)
+156
View File
@@ -0,0 +1,156 @@
# Copyright 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Espressif IDF
Espressif IoT Development Framework for ESP32 MCU
https://github.com/espressif/esp-idf
"""
import sys
from os import listdir, makedirs
from os.path import isdir, join
from SCons.Script import DefaultEnvironment
from platformio.util import exec_command
env = DefaultEnvironment()
platform = env.PioPlatform()
FRAMEWORK_DIR = platform.get_package_dir("framework-espidf")
FRAMEWORK_VERSION = platform.get_package_version(
"framework-espidf")
assert isdir(FRAMEWORK_DIR)
def generate_ld_script():
if not isdir(env.subst("$BUILD_DIR")):
makedirs(env.subst("$BUILD_DIR"))
result = exec_command([
join(platform.get_package_dir("toolchain-xtensa32")
or "", "bin", env.subst("$CC")),
"-I", env.subst("$PROJECTSRC_DIR"),
"-C", "-P", "-x", "c", "-E",
join(env.subst("$ESPIDF_DIR"), "components",
"esp32", "ld", "esp32.ld"),
"-o", join(env.subst("$BUILD_DIR"), "esp32_out.ld")
])
if result['returncode'] != 0:
sys.stderr.write(
"Cannot create linker script! %s" % result['err'])
env.Exit(1)
def generate_ptable():
if not isdir(env.subst("$BUILD_DIR")):
makedirs(env.subst("$BUILD_DIR"))
result = exec_command([
env.subst("$PYTHONEXE"),
join(env.subst("$ESPIDF_DIR"), "components",
"partition_table", "gen_esp32part.py"),
"-q", join(env.subst("$ESPIDF_DIR"), "components",
"partition_table", "partitions_singleapp.csv"),
join(env.subst("$BUILD_DIR"), "partitions_table.bin"),
])
if result['returncode'] != 0:
sys.stderr.write(
"Cannot create partition table! %s" % result['err'])
env.Exit(1)
env.Prepend(
CPPPATH=[
join("$PROJECTSRC_DIR"),
join(FRAMEWORK_DIR, "components", "nghttp", "include"),
join(FRAMEWORK_DIR, "components", "nghttp", "port", "include"),
join(FRAMEWORK_DIR, "components", "bt", "include"),
join(FRAMEWORK_DIR, "components", "driver", "include"),
join(FRAMEWORK_DIR, "components", "esp32", "include"),
join(FRAMEWORK_DIR, "components", "freertos", "include"),
join(FRAMEWORK_DIR, "components", "freertos", "include", "freertos"),
join(FRAMEWORK_DIR, "components", "log", "include"),
join(FRAMEWORK_DIR, "components", "newlib", "include"),
join(FRAMEWORK_DIR, "components", "nvs_flash", "include"),
join(FRAMEWORK_DIR, "components", "spi_flash", "include"),
join(FRAMEWORK_DIR, "components", "tcpip_adapter", "include"),
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip"),
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "port"),
join(FRAMEWORK_DIR, "components", "lwip", "include", "lwip", "posix"),
join(FRAMEWORK_DIR, "components", "expat", "include", "expat"),
join(FRAMEWORK_DIR, "components", "expat", "port", "include"),
join(FRAMEWORK_DIR, "components", "json", "include"),
join(FRAMEWORK_DIR, "components", "json", "port", "include"),
join(FRAMEWORK_DIR, "components", "mbedtls", "include"),
join(FRAMEWORK_DIR, "components", "mbedtls", "port", "include")
],
LIBPATH=[
join(FRAMEWORK_DIR, "components", "esp32"),
join(FRAMEWORK_DIR, "components", "esp32", "ld"),
join(FRAMEWORK_DIR, "components", "esp32", "lib"),
join(FRAMEWORK_DIR, "components", "bt", "lib"),
join(FRAMEWORK_DIR, "components", "newlib", "lib"),
"$BUILD_DIR"
],
LIBS=[
"hal", "crypto", "core", "net80211", "phy", "rtc", "pp", "wpa",
"smartconfig", "btdm_app", "m", "c", "gcc"
]
)
env.Append(
LIBSOURCE_DIRS=[
join(FRAMEWORK_DIR, "libraries")
],
LINKFLAGS=[
"-T", "esp32.common.ld",
"-T", "esp32.rom.ld",
"-T", "esp32.peripherals.ld"
],
)
#
# Generate a specific linker script
#
generate_ld_script()
generate_ptable()
#
# Target: Build Core Library
#
libs = []
ignore_dirs = (
"bootloader", "esptool_py", "idf_test", "newlib", "partition_table")
for d in listdir(join(FRAMEWORK_DIR, "components")):
if d in ignore_dirs:
continue
if isdir(join(FRAMEWORK_DIR, "components", d)):
libs.append(env.BuildLibrary(
join("$BUILD_DIR", "%s" % d),
join(FRAMEWORK_DIR, "components", d),
src_filter="+<*> -<test>"
))
env.Prepend(LIBS=libs)
+249
View File
@@ -0,0 +1,249 @@
# Copyright 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from os.path import join
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment)
def _get_board_f_flash(env):
frequency = env.subst("$BOARD_F_FLASH")
frequency = str(frequency).replace("L", "")
return str(int(int(frequency) / 1000000)) + "m"
def build_espidf_bootloader():
envsafe = env.Clone()
framework_dir = env.subst("$ESPIDF_DIR")
envsafe.Replace(
CPPDEFINES=["ESP_PLATFORM", "BOOTLOADER_BUILD=1"],
LIBPATH=[
join(framework_dir, "components", "esp32", "ld"),
join(framework_dir, "components", "bootloader", "src", "main")
],
LINKFLAGS=[
"-Os",
"-nostdlib",
"-Wl,-static",
"-u", "call_user_start_cpu0",
"-Wl,-static",
"-Wl,--gc-sections",
"-T", "esp32.bootloader.ld",
"-T", "esp32.rom.ld"
]
),
envsafe.Append(CCFLAGS=["-fstrict-volatile-bitfields"])
envsafe.Replace(
LIBS=[
envsafe.BuildLibrary(
join("$BUILD_DIR", "bootloaderLog"),
join(framework_dir, "components", "log")
), "gcc"
]
)
return envsafe.Program(
join("$BUILD_DIR", "bootloader.elf"),
envsafe.CollectBuildFiles(
join("$BUILD_DIR", "bootloader"),
join(framework_dir, "components", "bootloader", "src", "main")
)
)
env = DefaultEnvironment()
platform = env.PioPlatform()
env.Replace(
__get_board_f_flash=_get_board_f_flash,
AR="xtensa-esp32-elf-ar",
AS="xtensa-esp32-elf-as",
CC="xtensa-esp32-elf-gcc",
CXX="xtensa-esp32-elf-g++",
OBJCOPY=join(
platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),
RANLIB="xtensa-esp32-elf-ranlib",
SIZETOOL="xtensa-esp32-elf-size",
ARFLAGS=["rcs"],
ASFLAGS=["-x", "assembler-with-cpp"],
CFLAGS=["-std=gnu99"],
CCFLAGS=[
"-Og",
"-g3",
"-nostdlib",
"-Wpointer-arith",
"-Wno-error=unused-function",
"-Wno-error=unused-but-set-variable",
"-Wno-error=unused-variable",
"-mlongcalls",
"-ffunction-sections",
"-fdata-sections"
],
CXXFLAGS=[
"-fno-rtti",
"-fno-exceptions",
"-std=gnu++11",
"-fstrict-volatile-bitfields"
],
CPPDEFINES=[
"ESP32",
"ESP_PLATFORM",
"F_CPU=$BOARD_F_CPU",
"HAVE_CONFIG_H",
"MBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\""
],
LINKFLAGS=[
"-nostdlib",
"-Wl,-static",
"-u", "call_user_start_cpu0",
"-Wl,--undefined=uxTopUsedPriority",
"-Wl,--gc-sections"
],
#
# Packages
#
FRAMEWORK_ARDUINOESP32_DIR=platform.get_package_dir(
"framework-arduinoespressif32"),
ESPIDF_DIR=platform.get_package_dir("framework-espidf"),
#
# Upload
#
UPLOADER=join(
platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),
UPLOADERFLAGS=[
"--chip", "esp32",
"--port", '"$UPLOAD_PORT"',
"--baud", "$UPLOAD_SPEED",
"write_flash", "-z",
"--flash_mode", "$BOARD_FLASH_MODE",
"--flash_freq", "${__get_board_f_flash(__env__)}"
],
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE',
PROGNAME="firmware",
PROGSUFFIX=".elf"
)
if env.subst("$PIOFRAMEWORK") == "arduino":
env.Append(
UPLOADERFLAGS=[
"0x1000", join("$FRAMEWORK_ARDUINOESP32_DIR", "tools",
"sdk", "bin", "bootloader.bin"),
"0x4000", join("$FRAMEWORK_ARDUINOESP32_DIR", "tools",
"sdk", "bin", "partitions_singleapp.bin"),
"0x10000"
]
)
if env.subst("$PIOFRAMEWORK") == "espidf":
env.Append(
UPLOADERFLAGS=[
"0x1000", join("$BUILD_DIR", "bootloader.bin"),
"0x4000", join("$BUILD_DIR", "partitions_table.bin"),
"0x10000"
]
)
env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)
#
# Framework and SDK specific configuration
#
env.Append(
BUILDERS=dict(
ElfToBin=Builder(
action=env.VerboseAction(" ".join([
'"$PYTHONEXE" "$OBJCOPY"',
"--chip", "esp32",
"elf2image",
"--flash_mode", "$BOARD_FLASH_MODE",
"--flash_freq", "${__get_board_f_flash(__env__)}",
"-o", "$TARGET", "$SOURCES"
]), "Building $TARGET"),
suffix=".bin"
)
)
)
#
# Target: Build executable and linkable firmware or SPIFFS image
#
def __tmp_hook_before_pio_3_2():
env.ProcessFlags(env.get("BUILD_FLAGS"))
# append specified LD_SCRIPT
if ("LDSCRIPT_PATH" in env and
not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
target_elf = env.BuildProgram()
if "PIOFRAMEWORK" in env:
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
if "espidf" in env.subst("$PIOFRAMEWORK"):
target_boot = env.ElfToBin(
join("$BUILD_DIR", "bootloader"), build_espidf_bootloader())
env.Depends(target_firm, target_boot)
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
#
# Target: Print binary size
#
target_size = env.Alias(
"size", target_elf,
env.VerboseAction("$SIZEPRINTCMD", "Calculating size $SOURCE"))
AlwaysBuild(target_size)
#
# Target: Upload firmware or SPIFFS image
#
target_upload = env.Alias(
"upload", target_firm,
[env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."),
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")])
env.AlwaysBuild(target_upload)
#
# Default targets
#
Default([target_buildprog, target_size])
+3
View File
@@ -0,0 +1,3 @@
.pioenvs
.clang_complete
.gcc-flags.json
+65
View File
@@ -0,0 +1,65 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < http://docs.platformio.org/en/stable/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < http://docs.platformio.org/en/stable/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < http://docs.platformio.org/en/stable/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
#
# script:
# - platformio run
#
# Template #2: The project is intended to by used as a library with examples
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
+38
View File
@@ -0,0 +1,38 @@
.. Copyright 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/stable/installation.html>`_
2. Download `development platform with examples <https://github.com/platformio/platform-espressif8266/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platform-espressif32/examples/arduino-blink
# Build project
> platformio run
# Upload firmware
> platformio run --target upload
# Build specific environment
> platformio run -e esp32dev
# Upload firmware for the specific environment
> platformio run -e esp32dev --target upload
# Clean build files
> platformio run --target clean
+38
View File
@@ -0,0 +1,38 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organized `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/stable/projectconf.html#lib-install
+23
View File
@@ -0,0 +1,23 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/en/stable/projectconf.html
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
[env:quantum]
platform = espressif32
framework = arduino
board = quantum
[env:lolin32]
platform = espressif32
framework = arduino
board = lolin32
+27
View File
@@ -0,0 +1,27 @@
/*
* Blink
* Turns on an LED on for one second,
* then off for one second, repeatedly.
*/
#include <Arduino.h>
#define LED_BUILTIN 13
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(1000);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(1000);
}
+3
View File
@@ -0,0 +1,3 @@
.pioenvs
.clang_complete
.gcc-flags.json
+65
View File
@@ -0,0 +1,65 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < http://docs.platformio.org/en/stable/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < http://docs.platformio.org/en/stable/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < http://docs.platformio.org/en/stable/userguide/cmd_ci.html >
#
#
# Please choose one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
#
# script:
# - platformio run
#
# Template #2: The project is intended to by used as a library with examples
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
+38
View File
@@ -0,0 +1,38 @@
.. Copyright 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/stable/installation.html>`_
2. Download `development platform with examples <https://github.com/platformio/platform-espressif8266/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platform-espressif32/examples/arduino-wifiscan
# Build project
> platformio run
# Upload firmware
> platformio run --target upload
# Build specific environment
> platformio run -e quantum
# Upload firmware for the specific environment
> platformio run -e quantum --target upload
# Clean build files
> platformio run --target clean
+38
View File
@@ -0,0 +1,38 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organized `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/stable/projectconf.html#lib-install
+23
View File
@@ -0,0 +1,23 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/en/stable/projectconf.html
[env:nano32]
platform = espressif32
framework = arduino
board = nano32
[env:espea32]
platform = espressif32
framework = arduino
board = espea32
[env:esp320]
platform = espressif32
framework = arduino
board = esp320
@@ -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 "WiFi.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) == WIFI_AUTH_OPEN)?" ":"*");
delay(10);
}
}
Serial.println("");
// Wait a bit before scanning again
delay(5000);
}
+3
View File
@@ -0,0 +1,3 @@
.pioenvs
.clang_complete
.gcc-flags.json
+65
View File
@@ -0,0 +1,65 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < http://docs.platformio.org/en/stable/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < http://docs.platformio.org/en/stable/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < http://docs.platformio.org/en/stable/userguide/cmd_ci.html >
#
#
# Please choice one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
#
# script:
# - platformio run
#
# Template #2: The project is intended to by used as a library with examples
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
+38
View File
@@ -0,0 +1,38 @@
.. Copyright 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/stable/installation.html>`_
2. Download `development platform with examples <https://github.com/platformio/platform-espressif8266/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platform-espressif32/examples/espidf-hello-world
# Build project
> platformio run
# Upload firmware
> platformio run --target upload
# Build specific environment
> platformio run -e esp32dev
# Upload firmware for the specific environment
> platformio run -e esp32dev --target upload
# Clean build files
> platformio run --target clean
@@ -0,0 +1,38 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organised `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/stable/projectconf.html#lib-install
@@ -0,0 +1,23 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/en/stable/projectconf.html
[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
[env:quantum]
platform = espressif32
framework = espidf
board = quantum
[env:lolin32]
platform = espressif32
framework = espidf
board = lolin32
+32
View File
@@ -0,0 +1,32 @@
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "nvs_flash.h"
void hello_task(void *pvParameter)
{
printf("Hello world!\n");
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_RATE_MS);
}
printf("Restarting now.\n");
fflush(stdout);
system_restart();
}
void app_main()
{
nvs_flash_init();
system_init();
xTaskCreate(&hello_task, "hello_task", 2048, NULL, 5, NULL);
}
@@ -0,0 +1,53 @@
/*
*
* Automatically generated file; DO NOT EDIT.
* Espressif IoT Development Framework Configuration
*
*/
#define CONFIG_TRACEMEM_RESERVE_DRAM 0x0
#define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE 1
#define CONFIG_ESPTOOLPY_FLASHFREQ "80m"
#define CONFIG_NEWLIB_STDOUT_ADDCR 1
#define CONFIG_FREERTOS_PANIC_PRINT_REBOOT 1
#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1
#define CONFIG_LOG_DEFAULT_LEVEL_INFO 1
#define CONFIG_BT_RESERVE_DRAM 0x0
#define CONFIG_LWIP_MAX_SOCKETS 4
#define CONFIG_ULP_COPROC_RESERVE_MEM 0
#define CONFIG_ESPTOOLPY_BAUD 921600
#define CONFIG_TOOLPREFIX "xtensa-esp32-elf-"
#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0
#define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384
#define CONFIG_ESP32_ENABLE_STACK_WIFI 1
#define CONFIG_LOG_BOOTLOADER_LEVEL_WARN 1
#define CONFIG_MAIN_TASK_STACK_SIZE 4096
#define CONFIG_ESPTOOLPY_FLASHMODE "dio"
#define CONFIG_LOG_DEFAULT_LEVEL 3
#define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1
#define CONFIG_PYTHON "python"
#define CONFIG_ESPTOOLPY_COMPRESSED 1
#define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv"
#define CONFIG_WIFI_SSID "myssid"
#define CONFIG_PARTITION_TABLE_SINGLE_APP 1
#define CONFIG_WIFI_ENABLED 1
#define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 240
#define CONFIG_FREERTOS_HZ 100
#define CONFIG_LOG_COLORS 1
#define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1
#define CONFIG_LOG_BOOTLOADER_LEVEL 2
#define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
#define CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG 1
#define CONFIG_FREERTOS_CORETIMER_0 1
#define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv"
#define CONFIG_FREERTOS_DEBUG_OCDAWARE 1
#define CONFIG_WIFI_PASSWORD "myssid"
#define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32
#define CONFIG_ESPTOOLPY_BAUD_921600B 1
#define CONFIG_APP_OFFSET 0x10000
#define CONFIG_MEMMAP_SMP 1
#define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0"
+3
View File
@@ -0,0 +1,3 @@
.pioenvs
.clang_complete
.gcc-flags.json
+65
View File
@@ -0,0 +1,65 @@
# Continuous Integration (CI) is the practice, in software
# engineering, of merging all developer working copies with a shared mainline
# several times a day < http://docs.platformio.org/en/stable/ci/index.html >
#
# Documentation:
#
# * Travis CI Embedded Builds with PlatformIO
# < https://docs.travis-ci.com/user/integration/platformio/ >
#
# * PlatformIO integration with Travis CI
# < http://docs.platformio.org/en/stable/ci/travis.html >
#
# * User Guide for `platformio ci` command
# < http://docs.platformio.org/en/stable/userguide/cmd_ci.html >
#
#
# Please choice one of the following templates (proposed below) and uncomment
# it (remove "# " before each line) or use own configuration according to the
# Travis CI documentation (see above).
#
#
# Template #1: General project. Test it using existing `platformio.ini`.
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# install:
# - pip install -U platformio
#
# script:
# - platformio run
#
# Template #2: The project is intended to by used as a library with examples
#
# language: python
# python:
# - "2.7"
#
# sudo: false
# cache:
# directories:
# - "~/.platformio"
#
# env:
# - PLATFORMIO_CI_SRC=path/to/test/file.c
# - PLATFORMIO_CI_SRC=examples/file.ino
# - PLATFORMIO_CI_SRC=path/to/test/directory
#
# install:
# - pip install -U platformio
#
# script:
# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N
+38
View File
@@ -0,0 +1,38 @@
.. Copyright 2014-present PlatformIO <contact@platformio.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/stable/installation.html>`_
2. Download `development platform with examples <https://github.com/platformio/platform-espressif8266/archive/develop.zip>`_
3. Extract ZIP archive
4. Run these commands:
.. code-block:: bash
# Change directory to example
> cd platform-espressif32/examples/espidf-http-request
# Build project
> platformio run
# Upload firmware
> platformio run --target upload
# Build specific environment
> platformio run -e quantum
# Upload firmware for the specific environment
> platformio run -e quantum --target upload
# Clean build files
> platformio run --target clean
@@ -0,0 +1,38 @@
This directory is intended for the project specific (private) libraries.
PlatformIO will compile them to static libraries and link to executable file.
The source code of each library should be placed in separate directory, like
"lib/private_lib/[here are source files]".
For example, see how can be organised `Foo` and `Bar` libraries:
|--lib
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |- readme.txt --> THIS FILE
|- platformio.ini
|--src
|- main.c
Then in `src/main.c` you should use:
#include <Foo.h>
#include <Bar.h>
// rest H/C/CPP code
PlatformIO will find your libraries automatically, configure preprocessor's
include paths and build them.
See additional options for PlatformIO Library Dependency Finder `lib_*`:
http://docs.platformio.org/en/stable/projectconf.html#lib-install
@@ -0,0 +1,26 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter, extra scripting
; Upload options: custom port, speed and extra flags
; Library options: dependencies, extra library storages
;
; Please visit documentation for the other options and examples
; http://docs.platformio.org/en/stable/projectconf.html
[env:nano32]
platform = espressif32
framework = espidf
board = nano32
build_flags = -DCONFIG_WIFI_SSID=\"ESP_AP\" -DCONFIG_WIFI_PASSWORD=\"MYPASS\"
[env:espea32]
platform = espressif32
framework = espidf
board = espea32
build_flags = -DCONFIG_WIFI_SSID=\"ESP_AP\" -DCONFIG_WIFI_PASSWORD=\"MYPASS\"
[env:esp320]
platform = espressif32
framework = espidf
board = esp320
build_flags = -DCONFIG_WIFI_SSID=\"ESP_AP\" -DCONFIG_WIFI_PASSWORD=\"MYPASS\"
+181
View File
@@ -0,0 +1,181 @@
/* HTTP GET Example using plain POSIX sockets
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event_loop.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#include "lwip/netdb.h"
#include "lwip/dns.h"
/* The examples use simple WiFi configuration that you can set via
'make menuconfig'.
If you'd rather not, just change the below entries to strings with
the config you want - ie #define EXAMPLE_WIFI_SSID "mywifissid"
*/
#define EXAMPLE_WIFI_SSID CONFIG_WIFI_SSID
#define EXAMPLE_WIFI_PASS CONFIG_WIFI_PASSWORD
/* FreeRTOS event group to signal when we are connected & ready to make a request */
static EventGroupHandle_t wifi_event_group;
/* The event group allows multiple bits for each event,
but we only care about one event - are we connected
to the AP with an IP? */
const int CONNECTED_BIT = BIT0;
/* Constants that aren't configurable in menuconfig */
#define WEB_SERVER "example.com"
#define WEB_PORT 80
#define WEB_URL "http://example.com/"
static const char *TAG = "example";
static const char *REQUEST = "GET " WEB_URL " HTTP/1.1\n"
"Host: "WEB_SERVER"\n"
"User-Agent: esp-idf/1.0 esp32\n"
"\n";
static esp_err_t event_handler(void *ctx, system_event_t *event)
{
switch(event->event_id) {
case SYSTEM_EVENT_STA_START:
esp_wifi_connect();
break;
case SYSTEM_EVENT_STA_GOT_IP:
xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
/* This is a workaround as ESP32 WiFi libs don't currently
auto-reassociate. */
esp_wifi_connect();
xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
break;
default:
break;
}
return ESP_OK;
}
static void initialise_wifi(void)
{
tcpip_adapter_init();
wifi_event_group = xEventGroupCreate();
ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
wifi_config_t wifi_config = {
.sta = {
.ssid = EXAMPLE_WIFI_SSID,
.password = EXAMPLE_WIFI_PASS,
},
};
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK( esp_wifi_start() );
}
static void http_get_task(void *pvParameters)
{
const struct addrinfo hints = {
.ai_family = AF_INET,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *res;
struct in_addr *addr;
int s, r;
char recv_buf[64];
while(1) {
/* Wait for the callback to set the CONNECTED_BIT in the
event group.
*/
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
false, true, portMAX_DELAY);
ESP_LOGI(TAG, "Connected to AP");
int err = getaddrinfo(WEB_SERVER, "80", &hints, &res);
if(err != 0 || res == NULL) {
ESP_LOGE(TAG, "DNS lookup failed err=%d res=%p", err, res);
vTaskDelay(1000 / portTICK_RATE_MS);
continue;
}
/* Code to print the resolved IP.
Note: inet_ntoa is non-reentrant, look at ipaddr_ntoa_r for "real" code */
addr = &((struct sockaddr_in *)res->ai_addr)->sin_addr;
ESP_LOGI(TAG, "DNS lookup succeeded. IP=%s", inet_ntoa(*addr));
s = socket(res->ai_family, res->ai_socktype, 0);
if(s < 0) {
ESP_LOGE(TAG, "... Failed to allocate socket.");
freeaddrinfo(res);
vTaskDelay(1000 / portTICK_RATE_MS);
continue;
}
ESP_LOGI(TAG, "... allocated socket\r\n");
if(connect(s, res->ai_addr, res->ai_addrlen) != 0) {
ESP_LOGE(TAG, "... socket connect failed errno=%d", errno);
close(s);
freeaddrinfo(res);
vTaskDelay(4000 / portTICK_RATE_MS);
continue;
}
ESP_LOGI(TAG, "... connected");
freeaddrinfo(res);
if (write(s, REQUEST, strlen(REQUEST)) < 0) {
ESP_LOGE(TAG, "... socket send failed");
close(s);
vTaskDelay(4000 / portTICK_RATE_MS);
continue;
}
ESP_LOGI(TAG, "... socket send success");
/* Read HTTP response */
do {
bzero(recv_buf, sizeof(recv_buf));
r = read(s, recv_buf, sizeof(recv_buf)-1);
for(int i = 0; i < r; i++) {
putchar(recv_buf[i]);
}
} while(r > 0);
ESP_LOGI(TAG, "... done reading from socket. Last read return=%d errno=%d\r\n", r, errno);
close(s);
for(int countdown = 10; countdown >= 0; countdown--) {
ESP_LOGI(TAG, "%d... ", countdown);
vTaskDelay(1000 / portTICK_RATE_MS);
}
ESP_LOGI(TAG, "Starting again!");
}
}
void app_main()
{
nvs_flash_init();
system_init();
initialise_wifi();
xTaskCreate(&http_get_task, "http_get_task", 2048, NULL, 5, NULL);
}
@@ -0,0 +1,51 @@
/*
*
* Automatically generated file; DO NOT EDIT.
* Espressif IoT Development Framework Configuration
*
*/
#define CONFIG_TRACEMEM_RESERVE_DRAM 0x0
#define CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE 1
#define CONFIG_ESPTOOLPY_FLASHFREQ "80m"
#define CONFIG_NEWLIB_STDOUT_ADDCR 1
#define CONFIG_FREERTOS_PANIC_PRINT_REBOOT 1
#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1
#define CONFIG_LOG_DEFAULT_LEVEL_INFO 1
#define CONFIG_BT_RESERVE_DRAM 0x0
#define CONFIG_LWIP_MAX_SOCKETS 4
#define CONFIG_ULP_COPROC_RESERVE_MEM 0
#define CONFIG_ESPTOOLPY_BAUD 921600
#define CONFIG_TOOLPREFIX "xtensa-esp32-elf-"
#define CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX 0
#define CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN 16384
#define CONFIG_ESP32_ENABLE_STACK_WIFI 1
#define CONFIG_LOG_BOOTLOADER_LEVEL_WARN 1
#define CONFIG_MAIN_TASK_STACK_SIZE 4096
#define CONFIG_ESPTOOLPY_FLASHMODE "dio"
#define CONFIG_LOG_DEFAULT_LEVEL 3
#define CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1
#define CONFIG_PYTHON "python"
#define CONFIG_ESPTOOLPY_COMPRESSED 1
#define CONFIG_PARTITION_TABLE_FILENAME "partitions_singleapp.csv"
#define CONFIG_PARTITION_TABLE_SINGLE_APP 1
#define CONFIG_WIFI_ENABLED 1
#define CONFIG_ESPTOOLPY_FLASHFREQ_80M 1
#define CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE 2048
#define CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET 0x10000
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ 240
#define CONFIG_FREERTOS_HZ 100
#define CONFIG_LOG_COLORS 1
#define CONFIG_FREERTOS_ASSERT_FAIL_ABORT 1
#define CONFIG_LOG_BOOTLOADER_LEVEL 2
#define CONFIG_ESPTOOLPY_BAUD_OTHER_VAL 115200
#define CONFIG_ESP32_DEFAULT_CPU_FREQ_240 1
#define CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG 1
#define CONFIG_FREERTOS_CORETIMER_0 1
#define CONFIG_PARTITION_TABLE_CUSTOM_FILENAME "partitions.csv"
#define CONFIG_FREERTOS_DEBUG_OCDAWARE 1
#define CONFIG_SYSTEM_EVENT_QUEUE_SIZE 32
#define CONFIG_ESPTOOLPY_BAUD_921600B 1
#define CONFIG_APP_OFFSET 0x10000
#define CONFIG_MEMMAP_SMP 1
#define CONFIG_ESPTOOLPY_PORT "/dev/ttyUSB0"
+53
View File
@@ -0,0 +1,53 @@
{
"name": "espressif32",
"title": "Espressif 32",
"description": "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.",
"url": "https://espressif.com/",
"homepage": "http://platformio.org/platforms/espressif32",
"license": "Apache-2.0",
"engines": {
"platformio": "^3.0.0",
"scons": ">=2.3.0,<2.6.0"
},
"repository": {
"type": "git",
"url": "https://github.com/platformio/platform-espressif32.git"
},
"version": "0.1.0",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download",
"http://dl.platformio.org/packages/manifest.json",
"https://raw.githubusercontent.com/eerimoq/simba/master/make/platformio/manifest.json"
],
"frameworks": {
"arduino": {
"package": "framework-arduinoespressif32",
"script": "builder/frameworks/arduino.py"
},
"espidf": {
"package": "framework-espidf",
"script": "builder/frameworks/espidf.py"
}
},
"packages": {
"toolchain-xtensa32": {
"type": "toolchain",
"version": "~1.40805.0"
},
"framework-arduinoespressif32": {
"type": "framework",
"optional": true,
"version": "~1.0.0"
},
"framework-espidf": {
"type": "framework",
"optional": true,
"version": "~1.90.0"
},
"tool-esptoolpy": {
"type": "uploader",
"version": "~1.0.0"
}
}
}