mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Merge branch 'release/v0.2.0'
This commit is contained in:
16
HISTORY.rst
Normal file
16
HISTORY.rst
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
Release History
|
||||||
|
===============
|
||||||
|
|
||||||
|
0.2.0 (2014-06-15)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Resolved `issue #1 "Build referred libraries" <https://github.com/ivankravets/platformio/issues/1>`_
|
||||||
|
* Renamed project's "libs" directory to "lib"
|
||||||
|
* Added `arduino-internal-library <https://github.com/ivankravets/platformio/tree/develop/examples/arduino-internal-library>`_ example
|
||||||
|
* Changed to beta status
|
||||||
|
|
||||||
|
|
||||||
|
0.1.0 (2014-06-13)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
* Birth! First alpha release
|
@ -35,7 +35,9 @@ instruments.
|
|||||||
|
|
||||||
**Platformio** is well suited for **embedded development**. It can:
|
**Platformio** is well suited for **embedded development**. It can:
|
||||||
|
|
||||||
* Compile frameworks and libraries sources to static libraries
|
* Automatically analyse dependency
|
||||||
|
* Reliably detect build changes
|
||||||
|
* Build framework or library source code to static library
|
||||||
* Build *ELF* (executable and linkable firmware)
|
* Build *ELF* (executable and linkable firmware)
|
||||||
* Convert *ELF* to *HEX* or *BIN* file
|
* Convert *ELF* to *HEX* or *BIN* file
|
||||||
* Extract *EEPROM* data
|
* Extract *EEPROM* data
|
||||||
@ -285,14 +287,14 @@ Initialize new platformio based project.
|
|||||||
# Example
|
# Example
|
||||||
$ platformio init
|
$ platformio init
|
||||||
Project successfully initialized.
|
Project successfully initialized.
|
||||||
Please put your source code to `src` directory, external libraries to `libs`
|
Please put your source code to `src` directory, external libraries to `lib`
|
||||||
and setup environments in `platformio.ini` file.
|
and setup environments in `platformio.ini` file.
|
||||||
Then process project with `platformio run` command.
|
Then process project with `platformio run` command.
|
||||||
|
|
||||||
After this command ``platformio`` will create:
|
After this command ``platformio`` will create:
|
||||||
|
|
||||||
* ``.pioenvs`` - a temporary working directory.
|
* ``.pioenvs`` - a temporary working directory.
|
||||||
* ``libs`` - a directory for project specific libraries. Platformio will
|
* ``lib`` - a directory for project specific libraries. Platformio will
|
||||||
compile their to static libraries and link to executable file
|
compile their to static libraries and link to executable file
|
||||||
* ``src`` - a source directory. Put code here.
|
* ``src`` - a source directory. Put code here.
|
||||||
* ``platformio.ini`` - a configuration file for project
|
* ``platformio.ini`` - a configuration file for project
|
||||||
|
20
examples/arduino-internal-library/README.rst
Normal file
20
examples/arduino-internal-library/README.rst
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
Arduino Example: Build code with internal library
|
||||||
|
=================================================
|
||||||
|
|
||||||
|
1. Download ``platformio``
|
||||||
|
`sources <https://github.com/ivankravets/platformio/archive/develop.zip>`_
|
||||||
|
2. Extract ZIP archive
|
||||||
|
3. Then run these commands:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Change directory to example
|
||||||
|
$ cd platformio-develop/examples/arduino-internal-library/
|
||||||
|
|
||||||
|
# Install Atmel AVR development platform with Arduino Framework
|
||||||
|
$ platformio install atmelavr
|
||||||
|
|
||||||
|
# Process example project
|
||||||
|
$ platformio run
|
||||||
|
|
||||||
|
.. image:: console-result.png
|
BIN
examples/arduino-internal-library/console-result.png
Normal file
BIN
examples/arduino-internal-library/console-result.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 806 KiB |
7
examples/arduino-internal-library/platformio.ini
Normal file
7
examples/arduino-internal-library/platformio.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
|
# See LICENSE for details.
|
||||||
|
|
||||||
|
[env:arduino_pro5v]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = pro16MHzatmega168
|
51
examples/arduino-internal-library/src/main.cpp
Normal file
51
examples/arduino-internal-library/src/main.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
|
* See LICENSE for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* EEPROM Read
|
||||||
|
*
|
||||||
|
* Reads the value of each byte of the EEPROM and prints it
|
||||||
|
* to the computer.
|
||||||
|
* This example code is in the public domain.
|
||||||
|
*
|
||||||
|
* https://github.com/arduino/Arduino/blob/master/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <EEPROM.h>
|
||||||
|
|
||||||
|
// start reading from the first byte (address 0) of the EEPROM
|
||||||
|
int address = 0;
|
||||||
|
byte value;
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
// initialize serial and wait for port to open:
|
||||||
|
Serial.begin(9600);
|
||||||
|
while (!Serial) {
|
||||||
|
; // wait for serial port to connect. Needed for Leonardo only
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
// read a byte from the current address of the EEPROM
|
||||||
|
value = EEPROM.read(address);
|
||||||
|
|
||||||
|
Serial.print(address);
|
||||||
|
Serial.print("\t");
|
||||||
|
Serial.print(value, DEC);
|
||||||
|
Serial.println();
|
||||||
|
|
||||||
|
// advance to the next address of the EEPROM
|
||||||
|
address = address + 1;
|
||||||
|
|
||||||
|
// there are only 512 bytes of EEPROM, from 0 to 511, so if we're
|
||||||
|
// on address 512, wrap around to address 0
|
||||||
|
if (address == 512)
|
||||||
|
address = 0;
|
||||||
|
|
||||||
|
delay(500);
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
VERSION = (0, 1, 0)
|
VERSION = (0, 2, 0)
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -41,7 +41,11 @@ DefaultEnvironment(
|
|||||||
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
|
PLATFORMFW_DIR=join("$PLATFORM_DIR", "frameworks", "$FRAMEWORK"),
|
||||||
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
|
PLATFORMTOOLS_DIR=join("$PLATFORM_DIR", "tools"),
|
||||||
|
|
||||||
BUILD_DIR=join("$PROJECT_DIR", ".pioenvs", "$PIOENV")
|
BUILD_DIR=join("$PROJECT_DIR", ".pioenvs", "$PIOENV"),
|
||||||
|
LIBSOURCE_DIRS=[
|
||||||
|
join("$PROJECT_DIR", "lib"),
|
||||||
|
join("$PLATFORMFW_DIR", "libraries"),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
@ -23,6 +23,7 @@ ARDUINO_FLAGS = [
|
|||||||
"-DARDUINO=%d" % ARDUINO_VERSION,
|
"-DARDUINO=%d" % ARDUINO_VERSION,
|
||||||
"-DARDUINO_%s" % BOARD_OPTIONS['build.board']
|
"-DARDUINO_%s" % BOARD_OPTIONS['build.board']
|
||||||
]
|
]
|
||||||
|
|
||||||
# usb flags
|
# usb flags
|
||||||
if "build.usb_product" in BOARD_OPTIONS:
|
if "build.usb_product" in BOARD_OPTIONS:
|
||||||
ARDUINO_FLAGS += [
|
ARDUINO_FLAGS += [
|
||||||
@ -32,12 +33,18 @@ if "build.usb_product" in BOARD_OPTIONS:
|
|||||||
'"', "")
|
'"', "")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# include board variant
|
||||||
|
env.VariantDir(
|
||||||
|
join("$BUILD_DIR", "variant"),
|
||||||
|
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
|
||||||
|
)
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
ASFLAGS=ARDUINO_FLAGS,
|
ASFLAGS=ARDUINO_FLAGS,
|
||||||
CCFLAGS=ARDUINO_FLAGS,
|
CCFLAGS=ARDUINO_FLAGS,
|
||||||
CPPPATH=[
|
CPPPATH=[
|
||||||
join("$BUILD_DIR", "core"),
|
join("$BUILD_DIR", "core"),
|
||||||
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
|
join("$BUILD_DIR", "variant")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,12 +24,18 @@ ENERGIA_FLAGS = [
|
|||||||
"-DENERGIA=%d" % ENERGIA_VERSION
|
"-DENERGIA=%d" % ENERGIA_VERSION
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# include board variant
|
||||||
|
env.VariantDir(
|
||||||
|
join("$BUILD_DIR", "variant"),
|
||||||
|
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
|
||||||
|
)
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
ASFLAGS=ENERGIA_FLAGS,
|
ASFLAGS=ENERGIA_FLAGS,
|
||||||
CCFLAGS=ENERGIA_FLAGS,
|
CCFLAGS=ENERGIA_FLAGS,
|
||||||
CPPPATH=[
|
CPPPATH=[
|
||||||
join("$BUILD_DIR", "core"),
|
join("$BUILD_DIR", "core"),
|
||||||
join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant'])
|
join("$BUILD_DIR", "variant")
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
from os import walk
|
import re
|
||||||
from os.path import isfile, join
|
from os import listdir, walk
|
||||||
|
from os.path import isdir, isfile, join
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from serial import Serial
|
from serial import Serial
|
||||||
@ -17,10 +18,34 @@ def BuildLibrary(env, variant_dir, library_dir):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def BuildDependentLibraries(env, src_dir):
|
||||||
|
libs = []
|
||||||
|
for deplibfile in env.GetDependentLibraries(src_dir):
|
||||||
|
for lsd_dir in env['LIBSOURCE_DIRS']:
|
||||||
|
lsd_dir = env.subst(lsd_dir)
|
||||||
|
if not isdir(lsd_dir):
|
||||||
|
continue
|
||||||
|
for libname in listdir(lsd_dir):
|
||||||
|
if not isfile(join(lsd_dir, libname, deplibfile)):
|
||||||
|
continue
|
||||||
|
_libbuild_dir = join("$BUILD_DIR", libname)
|
||||||
|
env.Append(CPPPATH=[_libbuild_dir])
|
||||||
|
libs.append(
|
||||||
|
env.BuildLibrary(_libbuild_dir, join(lsd_dir, libname)))
|
||||||
|
return libs
|
||||||
|
|
||||||
|
|
||||||
def BuildFirmware(env, libslist):
|
def BuildFirmware(env, libslist):
|
||||||
src = env.Clone()
|
src = env.Clone()
|
||||||
vdirs = src.VariantDirRecursive(join("$BUILD_DIR", "src"),
|
vdirs = src.VariantDirRecursive(
|
||||||
join("$PROJECT_DIR", "src"))
|
join("$BUILD_DIR", "src"), join("$PROJECT_DIR", "src"))
|
||||||
|
|
||||||
|
# build source's dependent libs
|
||||||
|
for vdir in vdirs:
|
||||||
|
_libs = src.BuildDependentLibraries(vdir)
|
||||||
|
if _libs:
|
||||||
|
libslist += _libs
|
||||||
|
|
||||||
return src.Program(
|
return src.Program(
|
||||||
join("$BUILD_DIR", "firmware"),
|
join("$BUILD_DIR", "firmware"),
|
||||||
[src.GlobCXXFiles(vdir) for vdir in vdirs],
|
[src.GlobCXXFiles(vdir) for vdir in vdirs],
|
||||||
@ -38,6 +63,14 @@ def GlobCXXFiles(env, path):
|
|||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
|
def GetDependentLibraries(env, src_dir):
|
||||||
|
deplibs = []
|
||||||
|
regexp = re.compile(r"^#include\s+<([^>]+)>", re.M)
|
||||||
|
for node in env.GlobCXXFiles(src_dir):
|
||||||
|
deplibs += regexp.findall(node.get_text_contents())
|
||||||
|
return deplibs
|
||||||
|
|
||||||
|
|
||||||
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
|
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
|
||||||
# add root dir by default
|
# add root dir by default
|
||||||
variants = [variant_dir]
|
variants = [variant_dir]
|
||||||
@ -101,8 +134,10 @@ def exists(_):
|
|||||||
|
|
||||||
def generate(env):
|
def generate(env):
|
||||||
env.AddMethod(BuildLibrary)
|
env.AddMethod(BuildLibrary)
|
||||||
|
env.AddMethod(BuildDependentLibraries)
|
||||||
env.AddMethod(BuildFirmware)
|
env.AddMethod(BuildFirmware)
|
||||||
env.AddMethod(GlobCXXFiles)
|
env.AddMethod(GlobCXXFiles)
|
||||||
|
env.AddMethod(GetDependentLibraries)
|
||||||
env.AddMethod(VariantDirRecursive)
|
env.AddMethod(VariantDirRecursive)
|
||||||
env.AddMethod(ParseBoardOptions)
|
env.AddMethod(ParseBoardOptions)
|
||||||
env.AddMethod(ResetDevice)
|
env.AddMethod(ResetDevice)
|
||||||
|
@ -16,7 +16,7 @@ def cli():
|
|||||||
|
|
||||||
if isfile("platformio.ini") and isdir("src"):
|
if isfile("platformio.ini") and isdir("src"):
|
||||||
raise ProjectInitialized()
|
raise ProjectInitialized()
|
||||||
for d in (".pioenvs", "libs", "src"):
|
for d in (".pioenvs", "lib", "src"):
|
||||||
if not isdir(d):
|
if not isdir(d):
|
||||||
makedirs(d)
|
makedirs(d)
|
||||||
if not isfile("platformio.ini"):
|
if not isfile("platformio.ini"):
|
||||||
@ -24,7 +24,7 @@ def cli():
|
|||||||
"platformio.ini")
|
"platformio.ini")
|
||||||
secho("Project successfully initialized.\n"
|
secho("Project successfully initialized.\n"
|
||||||
"Please put your source code to `src` directory, "
|
"Please put your source code to `src` directory, "
|
||||||
"external libraries to `libs` and "
|
"external libraries to `lib` and "
|
||||||
"setup environments in `platformio.ini` file.\n"
|
"setup environments in `platformio.ini` file.\n"
|
||||||
"Then process project with `platformio run` command.",
|
"Then process project with `platformio run` command.",
|
||||||
fg="green")
|
fg="green")
|
||||||
|
@ -26,7 +26,7 @@ class AtmelavrPlatform(BasePlatform):
|
|||||||
|
|
||||||
"framework-arduinoavr": {
|
"framework-arduinoavr": {
|
||||||
"path": join("frameworks", "arduino"),
|
"path": join("frameworks", "arduino"),
|
||||||
"default": False
|
"default": True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class Timsp430Platform(BasePlatform):
|
|||||||
|
|
||||||
"framework-energiamsp430": {
|
"framework-energiamsp430": {
|
||||||
"path": join("frameworks", "energia"),
|
"path": join("frameworks", "energia"),
|
||||||
"default": False
|
"default": True
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
click==2.0
|
click==2.1
|
||||||
colorama==0.3.1
|
colorama==0.3.1
|
||||||
pyserial==2.7
|
pyserial==2.7
|
||||||
requests=2.3.0
|
requests==2.3.0
|
||||||
scons=2.3.0
|
scons==2.3.0
|
||||||
|
2
setup.py
2
setup.py
@ -30,7 +30,7 @@ setup(
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 3 - Alpha",
|
"Development Status :: 4 - Beta",
|
||||||
"Environment :: Console",
|
"Environment :: Console",
|
||||||
"Intended Audience :: Developers",
|
"Intended Audience :: Developers",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
|
Reference in New Issue
Block a user