New framework: Pumbaa (#7)

* New framework: Pumbaa

Pumbaa is MicroPython on top of Simba.

The framework will generate a file called frozen.c from all .py files
found in the project src/ folder. The script file main.py is the entry
point for the user script. If main.py is missing the application will
enter the interactive Python interpreter.

All c/cpp source files (including frozen.c) will be compiled, linked
and uploaded as an ordinary c application.

http://pumbaa.readthedocs.io/en/latest/

* Added pumbaa-blink example to appveyor.
This commit is contained in:
Erik Moqvist
2016-12-24 14:48:08 +01:00
committed by Ivan Kravets
parent 26ab13411d
commit 1a2734cc62
12 changed files with 285 additions and 2 deletions
+1
View File
@@ -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
+1
View File
@@ -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
+2 -1
View File
@@ -12,7 +12,8 @@
"frameworks": [
"arduino",
"espidf",
"simba"
"simba",
"pumbaa"
],
"name": "MakerAsia Nano32",
"upload": {
+60
View File
@@ -0,0 +1,60 @@
# 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.
"""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, "-<svn%s>" % sep,
"-<example%s>" % sep, "-<examples%s>" % sep,
"-<test%s>" % sep, "-<tests%s>" % 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"))])
+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
+29
View File
@@ -0,0 +1,29 @@
.. 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-espressif32/archive/develop.zip>`_
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
+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 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
+13
View File
@@ -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
+22
View File
@@ -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.
*/
+40
View File
@@ -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)
+11 -1
View File
@@ -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"