forked from platformio/platformio-core
Merge pull request #97 from valeros/develop
Merge Digistump platform to "atmelavr" and "atmelsam"
This commit is contained in:
@ -9,7 +9,7 @@ How to buid PlatformIO based project
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Change directory to example
|
# Change directory to example
|
||||||
> cd platformio-develop/examples/digistump/digitstump-blink
|
> cd platformio-develop/examples/atmelavr-and-arduino/adafruit-blink
|
||||||
|
|
||||||
# Process example project
|
# Process example project
|
||||||
> platformio run
|
> platformio run
|
@ -1,60 +0,0 @@
|
|||||||
#include <EngduinoLEDs.h>
|
|
||||||
#include <EngduinoAccelerometer.h>
|
|
||||||
#include <Wire.h>
|
|
||||||
|
|
||||||
// Accelerometer demo - level
|
|
||||||
//
|
|
||||||
// Show a red LED on one side if we're low on that side
|
|
||||||
// show nothing if we're high, and show green on both sides
|
|
||||||
// if it's level(ish)
|
|
||||||
//
|
|
||||||
// We delay between readings because it's a bit flashy
|
|
||||||
// otherwise - too hard to hold steady
|
|
||||||
//
|
|
||||||
|
|
||||||
void setup()
|
|
||||||
{
|
|
||||||
EngduinoLEDs.begin();
|
|
||||||
EngduinoAccelerometer.begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop()
|
|
||||||
{ float xyz[3];
|
|
||||||
|
|
||||||
// Read the acceleration
|
|
||||||
//
|
|
||||||
EngduinoAccelerometer.xyz(xyz);
|
|
||||||
|
|
||||||
// And light the appropriate LEDs depending on whether we're level
|
|
||||||
// or not. The LEDs chosen are on opposite sides of the board.
|
|
||||||
//
|
|
||||||
if ((xyz[0] > 0 && xyz[0] < 0.02) || (xyz[0] < 0 && xyz[0] > -0.02)) {
|
|
||||||
EngduinoLEDs.setLED(12, GREEN);
|
|
||||||
EngduinoLEDs.setLED( 4, GREEN);
|
|
||||||
}
|
|
||||||
else if (xyz[0] > 0.02) {
|
|
||||||
EngduinoLEDs.setLED(12, RED);
|
|
||||||
EngduinoLEDs.setLED( 4, OFF);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EngduinoLEDs.setLED(12, OFF);
|
|
||||||
EngduinoLEDs.setLED( 4, RED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((xyz[1] > 0 && xyz[1] < 0.02) || (xyz[1] < 0 && xyz[1] > -0.02)) {
|
|
||||||
EngduinoLEDs.setLED( 9, GREEN);
|
|
||||||
EngduinoLEDs.setLED(15, GREEN);
|
|
||||||
}
|
|
||||||
else if (xyz[1] > 0.02) {
|
|
||||||
EngduinoLEDs.setLED( 9, RED);
|
|
||||||
EngduinoLEDs.setLED(15, OFF);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
EngduinoLEDs.setLED( 9, OFF);
|
|
||||||
EngduinoLEDs.setLED(15, RED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait 50ms, then loop
|
|
||||||
//
|
|
||||||
delay(50);
|
|
||||||
}
|
|
@ -9,7 +9,7 @@ How to buid PlatformIO based project
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Change directory to example
|
# Change directory to example
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/arduino-adafruit-blink
|
> cd platformio-develop/examples/atmelavr-and-arduino/digitstump-mouse
|
||||||
|
|
||||||
# Process example project
|
# Process example project
|
||||||
> platformio run
|
> platformio run
|
@ -18,16 +18,11 @@
|
|||||||
# targets = upload
|
# targets = upload
|
||||||
|
|
||||||
[env:digispark-tiny]
|
[env:digispark-tiny]
|
||||||
platform = digistump
|
platform = atmelavr
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = digispark-tiny
|
board = digispark-tiny
|
||||||
|
|
||||||
[env:digispark-pro32]
|
[env:digispark-pro32]
|
||||||
platform = digistump
|
platform = atmelavr
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = digispark-pro32
|
board = digispark-pro32
|
||||||
|
|
||||||
[env:digix]
|
|
||||||
platform = digistump
|
|
||||||
framework = arduino
|
|
||||||
board = digix
|
|
41
examples/atmelavr-and-arduino/digitstump-mouse/src/Mouse.ino
Normal file
41
examples/atmelavr-and-arduino/digitstump-mouse/src/Mouse.ino
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// DigiMouse test and usage documentation
|
||||||
|
// CAUTION!!!! This does click things!!!!!!!!
|
||||||
|
// Originally created by Sean Murphy (duckythescientist)
|
||||||
|
|
||||||
|
#include <DigiMouse.h>
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
DigiMouse.begin(); //start or reenumerate USB - BREAKING CHANGE from old versions that didn't require this
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
// If not using plentiful DigiMouse.delay(), make sure to call
|
||||||
|
// DigiMouse.update() at least every 50ms
|
||||||
|
|
||||||
|
// move across the screen
|
||||||
|
// these are signed chars
|
||||||
|
DigiMouse.moveY(10); //down 10
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
DigiMouse.moveX(20); //right 20
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
DigiMouse.scroll(5);
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
|
||||||
|
// or DigiMouse.move(X, Y, scroll) works
|
||||||
|
|
||||||
|
// three buttons are the three LSBs of an unsigned char
|
||||||
|
DigiMouse.setButtons(1<<0); //left click
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
DigiMouse.setButtons(0); //unclick all
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
|
||||||
|
//or you can use these functions to click
|
||||||
|
DigiMouse.rightClick();
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
DigiMouse.leftClick();
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
DigiMouse.middleClick();
|
||||||
|
DigiMouse.delay(500);
|
||||||
|
|
||||||
|
//for compatability with other libraries you can also use DigiMouse.move(X, Y, scroll, buttons)
|
||||||
|
}
|
@ -9,7 +9,7 @@ How to buid PlatformIO based project
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Change directory to example
|
# Change directory to example
|
||||||
> cd platformio-develop/examples/atmelavr-and-arduino/arduino-engduino-library
|
> cd platformio-develop/examples/atmelavr-and-arduino/engduino-magnetometer
|
||||||
|
|
||||||
# Process example project
|
# Process example project
|
||||||
> platformio run
|
> platformio run
|
@ -0,0 +1,44 @@
|
|||||||
|
#include <EngduinoMagnetometer.h>
|
||||||
|
#include <Wire.h>
|
||||||
|
|
||||||
|
// Magnetometer demo
|
||||||
|
//
|
||||||
|
// Print the field strength values
|
||||||
|
//
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
EngduinoMagnetometer.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
float magneticField[3];
|
||||||
|
|
||||||
|
// Read magnetic field strength. The values range from -20000
|
||||||
|
// to +20000 counts and are based on internal calibration
|
||||||
|
// values
|
||||||
|
//
|
||||||
|
EngduinoMagnetometer.xyz(magneticField);
|
||||||
|
|
||||||
|
float x = magneticField[0];
|
||||||
|
float y = magneticField[1];
|
||||||
|
float z = magneticField[2];
|
||||||
|
Serial.print("Magnetic field strength: x = ");
|
||||||
|
Serial.print(x);
|
||||||
|
Serial.print(" counts y = ");
|
||||||
|
Serial.print(y);
|
||||||
|
Serial.print(" counts z = ");
|
||||||
|
Serial.print(z);
|
||||||
|
Serial.println(" counts");
|
||||||
|
|
||||||
|
// Note that this is an uncalibrated temperature
|
||||||
|
// of the die itself. Whilst it should be a value
|
||||||
|
// in degrees C, the lack of calibration could mean
|
||||||
|
// that it's anything.
|
||||||
|
int8_t t = EngduinoMagnetometer.temperature();
|
||||||
|
Serial.print("Temperature: ");
|
||||||
|
Serial.println(t);
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
|
}
|
@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
Blink
|
|
||||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
|
||||||
|
|
||||||
Most Arduinos have an on-board LED you can control. On the Uno and
|
|
||||||
Leonardo, it is attached to digital pin 13. If you're unsure what
|
|
||||||
pin the on-board LED is connected to on your Arduino model, check
|
|
||||||
the documentation at http://arduino.cc
|
|
||||||
|
|
||||||
This example code is in the public domain.
|
|
||||||
|
|
||||||
modified 8 May 2014
|
|
||||||
by Scott Fitzgerald
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
// the setup function runs once when you press reset or power the board
|
|
||||||
void setup() {
|
|
||||||
// initialize digital pin 13 as an output.
|
|
||||||
pinMode(13, OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// the loop function runs over and over again forever
|
|
||||||
void loop() {
|
|
||||||
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
|
|
||||||
delay(1000); // wait for a second
|
|
||||||
}
|
|
@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"framework": "arduino",
|
"framework": "arduino",
|
||||||
"name": "Digispark (Default - 16.5mhz)",
|
"name": "Digispark (Default - 16.5mhz)",
|
||||||
"platform": "digistump",
|
"platform": "atmelavr",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": false,
|
"disable_flushing": false,
|
||||||
"maximum_ram_size": 512,
|
"maximum_ram_size": 512,
|
||||||
@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"framework": "arduino",
|
"framework": "arduino",
|
||||||
"name": "Digispark Pro (Default 16 Mhz)",
|
"name": "Digispark Pro (Default 16 Mhz)",
|
||||||
"platform": "digistump",
|
"platform": "atmelavr",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": false,
|
"disable_flushing": false,
|
||||||
"maximum_ram_size": 512,
|
"maximum_ram_size": 512,
|
||||||
@ -49,7 +49,7 @@
|
|||||||
},
|
},
|
||||||
"framework": "arduino",
|
"framework": "arduino",
|
||||||
"name": "Digispark Pro (16 Mhz) (32 byte buffer)",
|
"name": "Digispark Pro (16 Mhz) (32 byte buffer)",
|
||||||
"platform": "digistump",
|
"platform": "atmelavr",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": false,
|
"disable_flushing": false,
|
||||||
"maximum_ram_size": 512,
|
"maximum_ram_size": 512,
|
||||||
@ -69,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
"framework": "arduino",
|
"framework": "arduino",
|
||||||
"name": "Digispark Pro (16 Mhz) (64 byte buffer)",
|
"name": "Digispark Pro (16 Mhz) (64 byte buffer)",
|
||||||
"platform": "digistump",
|
"platform": "atmelavr",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": false,
|
"disable_flushing": false,
|
||||||
"maximum_ram_size": 512,
|
"maximum_ram_size": 512,
|
||||||
@ -94,7 +94,7 @@
|
|||||||
},
|
},
|
||||||
"framework": "arduino",
|
"framework": "arduino",
|
||||||
"name": "Digistump DigiX",
|
"name": "Digistump DigiX",
|
||||||
"platform": "digistump",
|
"platform": "atmelsam",
|
||||||
"upload": {
|
"upload": {
|
||||||
"disable_flushing": false,
|
"disable_flushing": false,
|
||||||
"maximum_ram_size": 28672,
|
"maximum_ram_size": 28672,
|
||||||
|
@ -57,20 +57,31 @@ env = DefaultEnvironment()
|
|||||||
|
|
||||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
||||||
|
|
||||||
env.Replace(
|
if "digispark" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("core", ""):
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
env.Replace(
|
||||||
UPLOADERFLAGS=[
|
UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"),
|
||||||
"-v",
|
UPLOADERFLAGS=[
|
||||||
"-D", # disable auto erase for flash memory
|
"-c", "$UPLOAD_PROTOCOL",
|
||||||
"-p", "$BOARD_MCU",
|
"--timeout", "60"
|
||||||
"-C",
|
],
|
||||||
'"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
|
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i'
|
||||||
"-c", "$UPLOAD_PROTOCOL"
|
)
|
||||||
],
|
|
||||||
|
|
||||||
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
else:
|
||||||
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
env.Replace(
|
||||||
)
|
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||||
|
UPLOADERFLAGS=[
|
||||||
|
"-v",
|
||||||
|
"-D", # disable auto erase for flash memory
|
||||||
|
"-p", "$BOARD_MCU",
|
||||||
|
"-C",
|
||||||
|
'"%s"' % join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude.conf"),
|
||||||
|
"-c", "$UPLOAD_PROTOCOL"
|
||||||
|
],
|
||||||
|
|
||||||
|
UPLOADHEXCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i',
|
||||||
|
UPLOADEEPCMD='"$UPLOADER" $UPLOADERFLAGS -U eeprom:w:$SOURCES:i'
|
||||||
|
)
|
||||||
|
|
||||||
CORELIBS = env.ProcessGeneral()
|
CORELIBS = env.ProcessGeneral()
|
||||||
|
|
||||||
|
@ -18,16 +18,10 @@ env.Replace(
|
|||||||
RANLIB="arm-none-eabi-ranlib",
|
RANLIB="arm-none-eabi-ranlib",
|
||||||
SIZETOOL="arm-none-eabi-size",
|
SIZETOOL="arm-none-eabi-size",
|
||||||
|
|
||||||
ARFLAGS=["rcs"],
|
ASCOM=("$AS -o $TARGET -c -x assembler-with-cpp "
|
||||||
|
"$CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"),
|
||||||
|
|
||||||
ASFLAGS=[
|
ARFLAGS=["rcs"],
|
||||||
"-c",
|
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
|
||||||
"-x", "assembler-with-cpp",
|
|
||||||
"-Wall",
|
|
||||||
"-mthumb",
|
|
||||||
"-mcpu=${BOARD_OPTIONS['build']['cpu']}"
|
|
||||||
],
|
|
||||||
|
|
||||||
CPPFLAGS=[
|
CPPFLAGS=[
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
"-g", # include debugging info (so errors include line numbers)
|
||||||
|
@ -18,14 +18,10 @@ env.Replace(
|
|||||||
RANLIB="avr-ranlib",
|
RANLIB="avr-ranlib",
|
||||||
SIZETOOL="avr-size",
|
SIZETOOL="avr-size",
|
||||||
|
|
||||||
ARFLAGS=["rcs"],
|
ASCOM=("$AS -o $TARGET -c -x assembler-with-cpp "
|
||||||
|
"$CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"),
|
||||||
|
|
||||||
ASFLAGS=[
|
ARFLAGS=["rcs"],
|
||||||
"-c",
|
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
|
||||||
"-x", "assembler-with-cpp",
|
|
||||||
"-mmcu=$BOARD_MCU"
|
|
||||||
],
|
|
||||||
|
|
||||||
CCFLAGS=[
|
CCFLAGS=[
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
"-g", # include debugging info (so errors include line numbers)
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
||||||
# See LICENSE for details.
|
|
||||||
|
|
||||||
"""
|
|
||||||
Builder for Digistump boards
|
|
||||||
"""
|
|
||||||
|
|
||||||
from os.path import join
|
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
|
|
||||||
DefaultEnvironment, SConscript)
|
|
||||||
|
|
||||||
|
|
||||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
|
||||||
if "cortex" in env.get("BOARD_OPTIONS").get("build").get("cpu"):
|
|
||||||
env.AutodetectUploadPort()
|
|
||||||
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
|
||||||
|
|
||||||
if "cortex" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("cpu", ""):
|
|
||||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py")))
|
|
||||||
|
|
||||||
env.Replace(
|
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "$PIOPACKAGE_UPLOADER", "bossac"),
|
|
||||||
UPLOADERFLAGS=[
|
|
||||||
"--info",
|
|
||||||
"--debug",
|
|
||||||
"--port", "$UPLOAD_PORT",
|
|
||||||
"--erase",
|
|
||||||
"--write",
|
|
||||||
"--verify",
|
|
||||||
"--boot",
|
|
||||||
"--reset"
|
|
||||||
],
|
|
||||||
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCES'
|
|
||||||
)
|
|
||||||
|
|
||||||
env.Append(
|
|
||||||
CPPDEFINES=[
|
|
||||||
"printf=iprintf"
|
|
||||||
],
|
|
||||||
|
|
||||||
LINKFLAGS=[
|
|
||||||
"-Wl,--entry=Reset_Handler",
|
|
||||||
"-Wl,--start-group"
|
|
||||||
]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "baseavr.py")))
|
|
||||||
|
|
||||||
env.Replace(
|
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-micronucleus", "micronucleus"),
|
|
||||||
UPLOADERFLAGS=[
|
|
||||||
"-c", "$UPLOAD_PROTOCOL",
|
|
||||||
"--timeout", "60"
|
|
||||||
],
|
|
||||||
UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS -U flash:w:$SOURCES:i'
|
|
||||||
)
|
|
||||||
|
|
||||||
CORELIBS = env.ProcessGeneral()
|
|
||||||
|
|
||||||
#
|
|
||||||
# Target: Build executable and linkable firmware
|
|
||||||
#
|
|
||||||
|
|
||||||
target_elf = env.BuildFirmware(["m"] + CORELIBS)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Target: Build the firmware file
|
|
||||||
#
|
|
||||||
|
|
||||||
if "cortex" in env.get("BOARD_OPTIONS", {}).get("build", {}).get("cpu", ""):
|
|
||||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
|
||||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
|
||||||
else:
|
|
||||||
target_firm = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
|
||||||
else:
|
|
||||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
|
||||||
target_firm = join("$BUILD_DIR", "firmware.hex")
|
|
||||||
else:
|
|
||||||
target_firm = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Target: Print binary size
|
|
||||||
#
|
|
||||||
|
|
||||||
target_size = env.Alias("size", target_elf, "$SIZEPRINTCMD")
|
|
||||||
AlwaysBuild(target_size)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Target: Upload by default firmware file
|
|
||||||
#
|
|
||||||
|
|
||||||
upload = env.Alias(["upload", "uploadlazy"], target_firm,
|
|
||||||
[BeforeUpload, "$UPLOADCMD"])
|
|
||||||
AlwaysBuild(upload)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Target: Define targets
|
|
||||||
#
|
|
||||||
|
|
||||||
Default([target_firm, target_size])
|
|
@ -23,14 +23,10 @@ env.Replace(
|
|||||||
RANLIB="msp430-ranlib",
|
RANLIB="msp430-ranlib",
|
||||||
SIZETOOL="msp430-size",
|
SIZETOOL="msp430-size",
|
||||||
|
|
||||||
ARFLAGS=["rcs"],
|
ASCOM=("$AS -o $TARGET -c -x assembler-with-cpp "
|
||||||
|
"$CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES"),
|
||||||
|
|
||||||
ASFLAGS=[
|
ARFLAGS=["rcs"],
|
||||||
"-c",
|
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
|
||||||
"-x", "-assembler-with-cpp",
|
|
||||||
"-mmcu=$BOARD_MCU"
|
|
||||||
],
|
|
||||||
|
|
||||||
CCFLAGS=[
|
CCFLAGS=[
|
||||||
"-g", # include debugging info (so errors include line numbers)
|
"-g", # include debugging info (so errors include line numbers)
|
||||||
|
@ -50,7 +50,7 @@ def BuildFirmware(env, corelibs):
|
|||||||
|
|
||||||
# enable "cyclic reference" for linker
|
# enable "cyclic reference" for linker
|
||||||
firmenv.Prepend(
|
firmenv.Prepend(
|
||||||
_LIBFLAGS="-Wl,--start-group ",
|
_LIBFLAGS="-Wl,--start-group "
|
||||||
)
|
)
|
||||||
firmenv.Append(
|
firmenv.Append(
|
||||||
_LIBFLAGS=" -Wl,--end-group"
|
_LIBFLAGS=" -Wl,--end-group"
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
from platformio.platforms.base import BasePlatform
|
from platformio.platforms.base import BasePlatform
|
||||||
|
from platformio.util import get_boards
|
||||||
|
|
||||||
|
|
||||||
class AtmelavrPlatform(BasePlatform):
|
class AtmelavrPlatform(BasePlatform):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
An embedded platform for Atmel AVR microcontrollers
|
An embedded platform for Atmel AVR microcontrollers
|
||||||
(with Arduino Framework)
|
(with Arduino Framework)
|
||||||
@ -18,7 +20,10 @@ class AtmelavrPlatform(BasePlatform):
|
|||||||
},
|
},
|
||||||
|
|
||||||
"tool-avrdude": {
|
"tool-avrdude": {
|
||||||
"alias": "uploader",
|
"default": True
|
||||||
|
},
|
||||||
|
|
||||||
|
"tool-micronucleus": {
|
||||||
"default": True
|
"default": True
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -33,3 +38,16 @@ class AtmelavrPlatform(BasePlatform):
|
|||||||
self.on_run_out(line)
|
self.on_run_out(line)
|
||||||
else:
|
else:
|
||||||
BasePlatform.on_run_err(self, line)
|
BasePlatform.on_run_err(self, line)
|
||||||
|
|
||||||
|
def run(self, variables, targets):
|
||||||
|
for v in variables:
|
||||||
|
if "BOARD=" not in v:
|
||||||
|
continue
|
||||||
|
tuploader = "tool-avrdude"
|
||||||
|
_, board = v.split("=")
|
||||||
|
bdata = get_boards(board)
|
||||||
|
if "digispark" in bdata['build']['core']:
|
||||||
|
tuploader = "tool-micronucleus"
|
||||||
|
self.PACKAGES[tuploader]['alias'] = "uploader"
|
||||||
|
break
|
||||||
|
return BasePlatform.run(self, variables, targets)
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
|
||||||
# See LICENSE for details.
|
|
||||||
|
|
||||||
from platformio.platforms.base import BasePlatform
|
|
||||||
from platformio.util import get_boards
|
|
||||||
|
|
||||||
|
|
||||||
class DigistumpPlatform(BasePlatform):
|
|
||||||
|
|
||||||
"""
|
|
||||||
An embedded platform for Digistump boards
|
|
||||||
(with Arduino Framework)
|
|
||||||
"""
|
|
||||||
|
|
||||||
PACKAGES = {
|
|
||||||
|
|
||||||
"toolchain-atmelavr": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"toolchain-gccarmnoneeabi": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"ldscripts": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"tool-bossac": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"tool-micronucleus": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"framework-arduinoavr": {
|
|
||||||
"default": True
|
|
||||||
},
|
|
||||||
|
|
||||||
"framework-arduinosam": {
|
|
||||||
"default": True
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def run(self, variables, targets):
|
|
||||||
for v in variables:
|
|
||||||
if "BOARD=" not in v:
|
|
||||||
continue
|
|
||||||
_, board = v.split("=")
|
|
||||||
bdata = get_boards(board)
|
|
||||||
if "cpu" in bdata['build']:
|
|
||||||
tpackage = "toolchain-gccarmnoneeabi"
|
|
||||||
tuploader = "tool-bossac"
|
|
||||||
else:
|
|
||||||
tpackage = "toolchain-atmelavr"
|
|
||||||
tuploader = "tool-micronucleus"
|
|
||||||
self.PACKAGES[tpackage]['alias'] = "toolchain"
|
|
||||||
self.PACKAGES[tuploader]['alias'] = "uploader"
|
|
||||||
break
|
|
||||||
return BasePlatform.run(self, variables, targets)
|
|
@ -19,4 +19,4 @@ def test_search_json_output(clirunner, validate_cliresult):
|
|||||||
def test_search_raw_output(clirunner, validate_cliresult):
|
def test_search_raw_output(clirunner, validate_cliresult):
|
||||||
result = clirunner.invoke(cli, ["arduino"])
|
result = clirunner.invoke(cli, ["arduino"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "digistump" in result.output
|
assert "teensy" in result.output
|
||||||
|
Reference in New Issue
Block a user