diff --git a/package.json b/package.json new file mode 100644 index 0000000000..da97f8a4b7 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "name": "framework-arduinoespressif8266", + "description": "Arduino Wiring-based Framework (ESP8266 Core)", + "url": "https://github.com/esp8266/Arduino", + "version": "2.4.0-rc.1" +} diff --git a/tests/common.sh b/tests/common.sh index af5ceff642..1387e5467b 100755 --- a/tests/common.sh +++ b/tests/common.sh @@ -122,6 +122,53 @@ function build_package() ./build_boards_manager_package.sh } + +function install_platformio() +{ + pip install -U https://github.com/platformio/platformio/archive/develop.zip + platformio platform install https://github.com/platformio/platform-espressif8266.git#feature/stage + sed -i 's/https:\/\/github\.com\/esp8266\/Arduino\.git/*/' ~/.platformio/platforms/espressif8266_stage/platform.json + ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif8266 + # Install dependencies: + # - esp8266/examples/ConfigFile + pio lib install ArduinoJson +} + +function build_sketches_with_platformio() +{ + set +e + local srcpath=$1 + local build_arg=$2 + local sketches=$(find $srcpath -name *.ino) + for sketch in $sketches; do + local sketchdir=$(dirname $sketch) + local sketchdirname=$(basename $sketchdir) + local sketchname=$(basename $sketch) + if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then + echo "Skipping $sketch, beacause it is not the main sketch file"; + continue + fi; + if [[ -f "$sketchdir/.test.skip" ]]; then + echo -e "\n ------------ Skipping $sketch ------------ \n"; + continue + fi + local build_cmd="pio ci $sketchdir $build_arg" + echo -e "\n ------------ Building $sketch ------------ \n"; + echo "$build_cmd" + time ($build_cmd >build.log) + local result=$? + if [ $result -ne 0 ]; then + echo "Build failed ($1)" + echo "Build log:" + cat build.log + set -e + return $result + fi + rm build.log + done + set -e +} + function run_travis_ci_build() { # Build documentation using Sphinx @@ -165,6 +212,15 @@ function run_travis_ci_build() echo -e "travis_fold:start:size_report" cat size.log echo -e "travis_fold:end:size_report" + + # PlatformIO + echo -e "travis_fold:start:install_platformio" + install_platformio + echo -e "travis_fold:end:install_platformio" + + echo -e "travis_fold:start:build_sketches_with_platformio" + build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" + echo -e "travis_fold:end:build_sketches_with_platformio" } set -e diff --git a/tools/platformio-build.py b/tools/platformio-build.py new file mode 100644 index 0000000000..d3e78781aa --- /dev/null +++ b/tools/platformio-build.py @@ -0,0 +1,95 @@ +# Copyright (c) 2014-present PlatformIO +# +# 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 +""" + +# Extends: https://github.com/platformio/platform-espressif8266/blob/develop/builder/main.py + +from os.path import isdir, join + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() +platform = env.PioPlatform() + +FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif8266") +assert isdir(FRAMEWORK_DIR) + + +env.Prepend( + CPPDEFINES=[ + ("ARDUINO", 10600), + "LWIP_OPEN_SRC" + ], + CPPPATH=[ + join(FRAMEWORK_DIR, "tools", "sdk", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "lwip", "include"), + join(FRAMEWORK_DIR, "tools", "sdk", "libc", + "xtensa-lx106-elf", "include"), + join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")) + ], + LIBPATH=[ + join(FRAMEWORK_DIR, "tools", "sdk", "lib"), + join(FRAMEWORK_DIR, "tools", "sdk", "ld"), + join(FRAMEWORK_DIR, "tools", "sdk", "libc", "xtensa-lx106-elf", "lib") + ], + LIBS=[ + "mesh", "wpa2", "smartconfig", "espnow", "pp", "main", "wpa", "lwip_gcc", + "net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", + "m", "c", "stdc++" + ] +) + +env.Append( + LIBSOURCE_DIRS=[ + join(FRAMEWORK_DIR, "libraries") + ], + LINKFLAGS=[ + "-Wl,-wrap,system_restart_local", + "-Wl,-wrap,spi_flash_read" + ] +) + +# +# 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")) + )) + +libs.append(env.BuildLibrary( + join("$BUILD_DIR", "FrameworkArduino"), + join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")) +)) + +env.Prepend(LIBS=libs) \ No newline at end of file diff --git a/tools/sdk/ld/eagle.app.v6.common.ld b/tools/sdk/ld/eagle.app.v6.common.ld index ba43f358b7..343448d03c 100644 --- a/tools/sdk/ld/eagle.app.v6.common.ld +++ b/tools/sdk/ld/eagle.app.v6.common.ld @@ -157,6 +157,18 @@ SECTIONS *.c.o( EXCLUDE_FILE (umm_malloc.c.o) .literal*, \ EXCLUDE_FILE (umm_malloc.c.o) .text*) *.cpp.o(.literal*, .text*) + *.pioenvs\\*\\lib*.a:(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) + *.pioenvs/*/lib*.a:(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) + *.pioenvs\\*\\lib\*.a:(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) + *.pioenvs/*/lib/*.a:(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) + *.pioenvs\\*\\src\\*.o(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) + *.pioenvs/*/src/*.o(EXCLUDE_FILE (umm_malloc.o) .literal*, \ + EXCLUDE_FILE (umm_malloc.o) .text*) *libc.a:(.literal .text .literal.* .text.*) *libm.a:(.literal .text .literal.* .text.*) *libgcc.a:_umoddi3.o(.literal .text) @@ -205,6 +217,12 @@ SECTIONS *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) *.cpp.o(.iram.text) *.c.o(.iram.text) + *.pioenvs\\*\\lib*.a:(.iram.text) + *.pioenvs/*/lib*.a:(.iram.text) + *.pioenvs\\*\\lib\\*.a:(.iram.text) + *.pioenvs/*/lib/*.a:(.iram.text) + *.pioenvs\\*\\src\\*.o(.iram.text) + *.pioenvs/*/src/*.o(.iram.text) *(.fini.literal) *(.fini) *(.gnu.version)