mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Merge branch 'feature/adafruit-boards' into develop
This commit is contained in:
@ -0,0 +1,21 @@
|
|||||||
|
How to buid PlatformIO based project
|
||||||
|
====================================
|
||||||
|
|
||||||
|
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
|
||||||
|
2. Download `source code with examples <https://github.com/ivankravets/platformio/archive/develop.zip>`_
|
||||||
|
3. Extract ZIP archive
|
||||||
|
4. Run these commands:
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
# Change directory to example
|
||||||
|
> cd platformio-develop/examples/atmelavr-and-arduino/arduino-adafruit-blink
|
||||||
|
|
||||||
|
# Process example project
|
||||||
|
> platformio run
|
||||||
|
|
||||||
|
# Upload firmware
|
||||||
|
> platformio run --target upload
|
||||||
|
|
||||||
|
# Clean build files
|
||||||
|
> platformio run --target clean
|
@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# Project Configuration File
|
||||||
|
#
|
||||||
|
# A detailed documentation with the EXAMPLES is located here:
|
||||||
|
# http://docs.platformio.org/en/latest/projectconf.html
|
||||||
|
#
|
||||||
|
|
||||||
|
# A sign `#` at the beginning of the line indicates a comment
|
||||||
|
# Comment lines are ignored.
|
||||||
|
|
||||||
|
# Simple and base environment
|
||||||
|
# [env:mybaseenv]
|
||||||
|
# platform = %INSTALLED_PLATFORM_NAME_HERE%
|
||||||
|
# framework =
|
||||||
|
# board =
|
||||||
|
#
|
||||||
|
# Automatic targets - enable auto-uploading
|
||||||
|
# targets = upload
|
||||||
|
|
||||||
|
[env:flora8]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = flora8
|
||||||
|
|
||||||
|
[env:trinket3]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = trinket3
|
||||||
|
|
||||||
|
[env:protrinket5]
|
||||||
|
platform = atmelavr
|
||||||
|
framework = arduino
|
||||||
|
board = protrinket5
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
Blink
|
||||||
|
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||||
|
|
||||||
|
This example code is in the public domain.
|
||||||
|
|
||||||
|
To upload to your Gemma or Trinket:
|
||||||
|
1) Select the proper board from the Tools->Board Menu
|
||||||
|
2) Select USBtinyISP from the Tools->Programmer
|
||||||
|
3) Plug in the Gemma/Trinket, make sure you see the green LED lit
|
||||||
|
4) For windows, install the USBtiny drivers
|
||||||
|
5) Press the button on the Gemma/Trinket - verify you see
|
||||||
|
the red LED pulse. This means it is ready to receive data
|
||||||
|
6) Click the upload button above within 10 seconds
|
||||||
|
*/
|
||||||
|
|
||||||
|
int led = 1; // blink 'digital' pin 1 - AKA the built in red LED
|
||||||
|
|
||||||
|
// the setup routine runs once when you press reset:
|
||||||
|
void setup() {
|
||||||
|
// initialize the digital pin as an output.
|
||||||
|
pinMode(led, OUTPUT);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// the loop routine runs over and over again forever:
|
||||||
|
void loop() {
|
||||||
|
digitalWrite(led, HIGH);
|
||||||
|
delay(1000);
|
||||||
|
digitalWrite(led, LOW);
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
|
129
platformio/boards/adafruit.json
Normal file
129
platformio/boards/adafruit.json
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
{
|
||||||
|
"flora8": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "8000000L",
|
||||||
|
"mcu": "atmega32u4",
|
||||||
|
"usb_product": "Adafruit Flora",
|
||||||
|
"pid": "0x8004",
|
||||||
|
"variant": "flora",
|
||||||
|
"vid": "0x239A"
|
||||||
|
},
|
||||||
|
"name": "Adafruit Flora",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"disable_flushing": true,
|
||||||
|
"maximum_ram_size": 2560,
|
||||||
|
"maximum_size": 28672,
|
||||||
|
"protocol": "avr109",
|
||||||
|
"speed": 57600,
|
||||||
|
"use_1200bps_touch": true,
|
||||||
|
"wait_for_upload_port": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"trinket3": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "8000000L",
|
||||||
|
"mcu": "attiny85",
|
||||||
|
"variant": "tiny8"
|
||||||
|
},
|
||||||
|
"name": "Adafruit Trinket 8MHz",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 512,
|
||||||
|
"maximum_size": 5310,
|
||||||
|
"protocol": "usbtiny"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"trinket5": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"mcu": "attiny85",
|
||||||
|
"variant": "tiny8"
|
||||||
|
},
|
||||||
|
"name": "Adafruit Trinket 16MHz",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 512,
|
||||||
|
"protocol": "usbtiny",
|
||||||
|
"maximum_size": 5310
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"protrinket3": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "12000000L",
|
||||||
|
"mcu": "atmega328p",
|
||||||
|
"variant": "eightanaloginputs"
|
||||||
|
},
|
||||||
|
"name": "Pro Trinket 3V/12MHz (USB)",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 2048,
|
||||||
|
"maximum_size": 28672,
|
||||||
|
"protocol": "usbtiny",
|
||||||
|
"speed": 115200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"protrinket5": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"mcu": "atmega328p",
|
||||||
|
"variant": "eightanaloginputs"
|
||||||
|
},
|
||||||
|
"name": "Pro Trinket 5V/16MHz (USB)",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 2048,
|
||||||
|
"maximum_size": 28672,
|
||||||
|
"protocol": "usbtiny",
|
||||||
|
"speed": 115200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"protrinket3ftdi": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"mcu": "atmega328p",
|
||||||
|
"variant": "eightanaloginputs"
|
||||||
|
},
|
||||||
|
"name": "Pro Trinket 3V/12MHz (FTDI)",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 2048,
|
||||||
|
"maximum_size": 28672,
|
||||||
|
"protocol": "arduino",
|
||||||
|
"speed": 115200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"protrinket5ftdi": {
|
||||||
|
"build": {
|
||||||
|
"core": "arduino",
|
||||||
|
"extra_flags": "-DARDUINO_ARCH_AVR",
|
||||||
|
"f_cpu": "16000000L",
|
||||||
|
"mcu": "atmega328p",
|
||||||
|
"variant": "eightanaloginputs"
|
||||||
|
},
|
||||||
|
"name": "Pro Trinket 5V/16MHz (USB)",
|
||||||
|
"platform": "atmelavr",
|
||||||
|
"upload": {
|
||||||
|
"maximum_ram_size": 2048,
|
||||||
|
"maximum_size": 28672,
|
||||||
|
"protocol": "arduino",
|
||||||
|
"speed": 115200
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -553,8 +553,8 @@
|
|||||||
"platform": "atmelsam",
|
"platform": "atmelsam",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": true,
|
"disable_flushing": true,
|
||||||
"maximum_ram_size": 524288,
|
"maximum_ram_size": 28672,
|
||||||
"maximum_size": 28672,
|
"maximum_size": 524288,
|
||||||
"protocol": "sam-ba",
|
"protocol": "sam-ba",
|
||||||
"speed": 57600,
|
"speed": 57600,
|
||||||
"use_1200bps_touch": true,
|
"use_1200bps_touch": true,
|
||||||
|
@ -65,16 +65,19 @@ env.Replace(
|
|||||||
"-q", # suppress progress output
|
"-q", # suppress progress output
|
||||||
"-D", # disable auto erase for flash memory
|
"-D", # disable auto erase for flash memory
|
||||||
"-p", "$BOARD_MCU",
|
"-p", "$BOARD_MCU",
|
||||||
"-C", '"%s"' % join("$PIOPACKAGES_DIR",
|
"-C",
|
||||||
"tool-avrdude", "avrdude.conf"),
|
'"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
|
||||||
"-c", "$UPLOAD_PROTOCOL",
|
"-c", "$UPLOAD_PROTOCOL"
|
||||||
"-b", "$UPLOAD_SPEED",
|
|
||||||
"-P", "$UPLOAD_PORT"
|
|
||||||
],
|
],
|
||||||
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
||||||
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "UPLOAD_SPEED" in env:
|
||||||
|
env.Append(UPLOADERFLAGS=["-b", "$UPLOAD_SPEED"])
|
||||||
|
if env.subst("$UPLOAD_PROTOCOL") != "usbtiny":
|
||||||
|
env.Append(UPLOADERFLAGS=["-P", "$UPLOAD_PORT"])
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
BUILDERS=dict(
|
BUILDERS=dict(
|
||||||
ElfToEep=Builder(
|
ElfToEep=Builder(
|
||||||
@ -108,7 +111,7 @@ env.Append(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def before_upload():
|
def before_upload(target, source, env_): # pylint: disable=W0613
|
||||||
|
|
||||||
def rpi_sysgpio(path, value):
|
def rpi_sysgpio(path, value):
|
||||||
with open(path, "w") as f:
|
with open(path, "w") as f:
|
||||||
@ -173,7 +176,7 @@ AlwaysBuild(target_size)
|
|||||||
#
|
#
|
||||||
|
|
||||||
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
|
upload = env.Alias(["upload", "uploadlazy"], target_hex, [
|
||||||
lambda target, source, env: before_upload(), "$UPLOADHEXCMD"])
|
before_upload, "$UPLOADHEXCMD"])
|
||||||
AlwaysBuild(upload)
|
AlwaysBuild(upload)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -181,7 +184,7 @@ AlwaysBuild(upload)
|
|||||||
#
|
#
|
||||||
|
|
||||||
uploadeep = env.Alias("uploadeep", target_eep, [
|
uploadeep = env.Alias("uploadeep", target_eep, [
|
||||||
lambda target, source, env: before_upload(), "$UPLOADEEPCMD"])
|
before_upload, "$UPLOADEEPCMD"])
|
||||||
AlwaysBuild(uploadeep)
|
AlwaysBuild(uploadeep)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -191,7 +194,7 @@ AlwaysBuild(uploadeep)
|
|||||||
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
|
is_uptarget = (set(["upload", "uploadlazy", "uploadeep"]) &
|
||||||
set(COMMAND_LINE_TARGETS))
|
set(COMMAND_LINE_TARGETS))
|
||||||
|
|
||||||
if is_uptarget:
|
if is_uptarget and env.subst("$UPLOAD_PROTOCOL") != "usbtiny":
|
||||||
# try autodetect upload port
|
# try autodetect upload port
|
||||||
if "UPLOAD_PORT" not in env:
|
if "UPLOAD_PORT" not in env:
|
||||||
for item in get_serialports():
|
for item in get_serialports():
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
from random import randint
|
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||||
DefaultEnvironment)
|
DefaultEnvironment)
|
||||||
@ -33,10 +32,6 @@ if env.get("BOARD_OPTIONS", {}).get("build", {}).get("core") == "teensy":
|
|||||||
"-mmcu=$BOARD_MCU"
|
"-mmcu=$BOARD_MCU"
|
||||||
],
|
],
|
||||||
|
|
||||||
CPPDEFINES=[
|
|
||||||
"SERIALNUM=-%d" % randint(1000000000, 2000000000)
|
|
||||||
],
|
|
||||||
|
|
||||||
LINKFLAGS=[
|
LINKFLAGS=[
|
||||||
"-mmcu=$BOARD_MCU"
|
"-mmcu=$BOARD_MCU"
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user