diff --git a/.travis.yml b/.travis.yml index c7d61aa..dc79645 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ env: - PLATFORMIO_PROJECT_DIR=examples/espidf-hello-world - PLATFORMIO_PROJECT_DIR=examples/espidf-http-request - PLATFORMIO_PROJECT_DIR=examples/simba-blink + - PLATFORMIO_PROJECT_DIR=examples/pumbaa-blink install: - pip install -U https://github.com/platformio/platformio/archive/develop.zip diff --git a/appveyor.yml b/appveyor.yml index 938da90..18b5da1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,7 @@ environment: - PLATFORMIO_PROJECT_DIR: "examples/espidf-hello-world" - PLATFORMIO_PROJECT_DIR: "examples/espidf-http-request" - PLATFORMIO_PROJECT_DIR: "examples/simba-blink" + - PLATFORMIO_PROJECT_DIR: "examples/pumbaa-blink" install: - cmd: git submodule update --init --recursive diff --git a/boards/nano32.json b/boards/nano32.json index a7e5de4..dffa41c 100644 --- a/boards/nano32.json +++ b/boards/nano32.json @@ -12,7 +12,8 @@ "frameworks": [ "arduino", "espidf", - "simba" + "simba", + "pumbaa" ], "name": "MakerAsia Nano32", "upload": { diff --git a/builder/frameworks/pumbaa.py b/builder/frameworks/pumbaa.py new file mode 100644 index 0000000..4283113 --- /dev/null +++ b/builder/frameworks/pumbaa.py @@ -0,0 +1,60 @@ +# Copyright 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. + +"""Pumbaa + +Pumbaa is Python on top of Simba. + +The implementation is a port of MicroPython, designed for embedded +devices with limited amount of RAM and code memory. + +http://pumbaa.readthedocs.org + +""" + +from os.path import join, sep + +from SCons.Script import DefaultEnvironment, SConscript + +from platformio.builder.tools import platformio as platformio_tool + +# +# Backward compatibility with PlatformIO 2.0 +# +platformio_tool.SRC_DEFAULT_FILTER = " ".join([ + "+<*>", "-<.git%s>" % sep, "-" % sep, + "-" % sep, "-" % sep, + "-" % sep, "-" % sep +]) + + +def LookupSources(env, variant_dir, src_dir, duplicate=True, src_filter=None): + return env.CollectBuildFiles(variant_dir, src_dir, src_filter, duplicate) + + +def VariantDirWrap(env, variant_dir, src_dir, duplicate=False): + env.VariantDir(variant_dir, src_dir, duplicate) + + +env = DefaultEnvironment() + +env.AddMethod(LookupSources) +env.AddMethod(VariantDirWrap) + +env.Replace( + PLATFORMFW_DIR=env.PioPlatform().get_package_dir("framework-pumbaa") +) + +SConscript( + [env.subst(join("$PLATFORMFW_DIR", "make", "platformio.sconscript"))]) diff --git a/examples/pumbaa-blink/.gitignore b/examples/pumbaa-blink/.gitignore new file mode 100755 index 0000000..5402c18 --- /dev/null +++ b/examples/pumbaa-blink/.gitignore @@ -0,0 +1,3 @@ +.pioenvs +.clang_complete +.gcc-flags.json diff --git a/examples/pumbaa-blink/.travis.yml b/examples/pumbaa-blink/.travis.yml new file mode 100755 index 0000000..72c6e43 --- /dev/null +++ b/examples/pumbaa-blink/.travis.yml @@ -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 diff --git a/examples/pumbaa-blink/README.rst b/examples/pumbaa-blink/README.rst new file mode 100755 index 0000000..e6ef98a --- /dev/null +++ b/examples/pumbaa-blink/README.rst @@ -0,0 +1,29 @@ +.. Copyright 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. + +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `development platform with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platform-espressif32/examples/pumbaa-blink + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload diff --git a/examples/pumbaa-blink/lib/readme.txt b/examples/pumbaa-blink/lib/readme.txt new file mode 100755 index 0000000..a3271c7 --- /dev/null +++ b/examples/pumbaa-blink/lib/readme.txt @@ -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 +#include + +// 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 + diff --git a/examples/pumbaa-blink/platformio.ini b/examples/pumbaa-blink/platformio.ini new file mode 100755 index 0000000..fc5acc9 --- /dev/null +++ b/examples/pumbaa-blink/platformio.ini @@ -0,0 +1,13 @@ +; 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 = pumbaa +board = nano32 diff --git a/examples/pumbaa-blink/src/main.c b/examples/pumbaa-blink/src/main.c new file mode 100755 index 0000000..c43d531 --- /dev/null +++ b/examples/pumbaa-blink/src/main.c @@ -0,0 +1,22 @@ +/** + * @file main.c + * + * @section License + * Copyright (C) 2015-2016, Erik Moqvist + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * This file is part of the Pumbaa project. + */ + +/* + * This file is required by PlatformIO, but is unused in Pumbaa. + */ diff --git a/examples/pumbaa-blink/src/main.py b/examples/pumbaa-blink/src/main.py new file mode 100755 index 0000000..fde1e23 --- /dev/null +++ b/examples/pumbaa-blink/src/main.py @@ -0,0 +1,40 @@ +# +# @section License +# +# The MIT License (MIT) +# +# Copyright (c) 2016, Erik Moqvist +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, copy, +# modify, merge, publish, distribute, sublicense, and/or sell copies +# of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# This file is part of the Pumbaa project. +# + + +import time +import board +from drivers import Pin + +LED = Pin(board.PIN_LED, Pin.OUTPUT) + +while True: + LED.toggle() + time.sleep(0.5) diff --git a/platform.json b/platform.json index b9ff826..0dd36d1 100644 --- a/platform.json +++ b/platform.json @@ -17,7 +17,8 @@ "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" + "https://raw.githubusercontent.com/eerimoq/simba/master/make/platformio/manifest.json", + "https://raw.githubusercontent.com/eerimoq/pumbaa/master/make/platformio/manifest.json" ], "frameworks": { "arduino": { @@ -31,6 +32,10 @@ "simba": { "package": "framework-simba", "script": "builder/frameworks/simba.py" + }, + "pumbaa": { + "package": "framework-pumbaa", + "script": "builder/frameworks/pumbaa.py" } }, "packages": { @@ -53,6 +58,11 @@ "optional": true, "version": ">=12.2.0" }, + "framework-pumbaa": { + "type": "framework", + "optional": true, + "version": ">=2.3.0" + }, "tool-esptoolpy": { "type": "uploader", "version": "~1.0.0"