-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,745 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.pyc | ||
.pio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
- "3.6" | ||
|
||
env: | ||
- PLATFORMIO_PROJECT_DIR=examples/arduino-blink | ||
- PLATFORMIO_PROJECT_DIR=examples/arduino-external-libs | ||
- PLATFORMIO_PROJECT_DIR=examples/arduino-internal-libs | ||
- PLATFORMIO_PROJECT_DIR=examples/native-blink | ||
|
||
install: | ||
- pip install -U https://github.com/platformio/platformio/archive/develop.zip | ||
- platformio platform install file://. | ||
|
||
script: | ||
- platformio run -d $PLATFORMIO_PROJECT_DIR | ||
|
||
notifications: | ||
email: false | ||
|
||
slack: | ||
rooms: | ||
secure: l3gd68M7ZBaMPkXQiyG8yQdWlmGLQ5E75NgRpFY+zNpIZB2EbQFqYacGwt8KyICJ4IC3Z3Db78FqxpUpKiYD+AX74GwsLHKc7GlLsEzRaOByAtm/xFRut7Fh32OL6xEigz0LUaCDF/ZDXqPYZHhiX9/7jzyjHOhDUIuk9j924qFtT/CRa5FHh8zeXCVlO79YXCir/+pdhoQLW3majfm+MWnSFGFB4wbYrb0RzP6hs45uJWb1tFaw4xKe/qi65FEFgQ33R+A944xAiNfiKgEEKkFcGXn+0ljCTLpu+svd+COKXWOMD0f5GDj5pVni1s4i4uCZXznKacD3QSKLhLBypd5pebCAdq6s9SBXwpNUNZ7EvzCAOZ3maH2XbkckfSyh7fZZq4tnluOCmnu6gEdLSciemJCfv8Xe+TXgs05LlLg1q3gsqfZ/1kyILfADdVwprVpjwwgAsFF8VTuzV6WRw+gZm3giVIdlu7sLT+GPQ07vsS+3lsybQivm4ZjJuEIMuI8Gig7JcQwHbD1GD7Q5hoeBuEz5XEVxhc+0pUzMdKkajS9BP5ap1g6rylkesSNlAIpPnTQXx0Ejj7jAPBJE9UWJPZVRBuT4FYeJR5vYUSZ0dFv4WoS7dGMqelg9xj+Rbnb2TP3m0QkIEaUNz6nF/ARnJBsTW/6w+Iqc5otA1Yg= | ||
on_failure: always | ||
on_success: change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# platform-atmelmegaavr | ||
Atmel megaAVR: development platform for PlatformIO | ||
# Atmel megaAVR: development platform for [PlatformIO](http://platformio.org) | ||
[![Build Status](https://travis-ci.org/platformio/platform-atmelmegaavr.svg?branch=develop)](https://travis-ci.org/platformio/platform-atmelmegaavr) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/wm6hx8n8c23dfbnk/branch/develop?svg=true)](https://ci.appveyor.com/project/ivankravets/platform-atmelmegaavr/branch/develop) | ||
|
||
Microchip's megaAVR is suitable for applications requiring large amounts of code and offers substantial program and data memories with performance up to 20 MIPS. Based on industry-leading, proven technology, the megaAVR family offers Microchip's widest selection of devices in terms of memories, pin counts, and peripherals. | ||
|
||
* [Home](http://platformio.org/platforms/atmelmegaavr) (home page in PlatformIO Platform Registry) | ||
* [Documentation](http://docs.platformio.org/page/platforms/atmelmegaavr.html) (advanced usage, packages, boards, frameworks, etc.) | ||
|
||
# Usage | ||
|
||
1. [Install PlatformIO](http://platformio.org) | ||
2. Create PlatformIO project and configure a platform option in [platformio.ini](http://docs.platformio.org/page/projectconf.html) file: | ||
|
||
## Stable version | ||
|
||
```ini | ||
[env:stable] | ||
platform = atmelmegaavr | ||
board = ... | ||
... | ||
``` | ||
|
||
## Development version | ||
|
||
```ini | ||
[env:development] | ||
platform = https://github.com/platformio/platform-atmelmegaavr.git | ||
board = ... | ||
... | ||
``` | ||
|
||
# Configuration | ||
|
||
Please navigate to [documentation](http://docs.platformio.org/page/platforms/atmelmegaavr.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
build: off | ||
environment: | ||
|
||
matrix: | ||
- PLATFORMIO_PROJECT_DIR: "examples/arduino-blink" | ||
- PLATFORMIO_PROJECT_DIR: "examples/arduino-external-libs" | ||
- PLATFORMIO_PROJECT_DIR: "examples/arduino-internal-libs" | ||
- PLATFORMIO_PROJECT_DIR: "examples/native-blink" | ||
|
||
install: | ||
- cmd: git submodule update --init --recursive | ||
- cmd: SET PATH=C:\Python36\Scripts;%PATH% | ||
- cmd: pip3 install -U https://github.com/platformio/platformio/archive/develop.zip | ||
- cmd: platformio platform install file://. | ||
|
||
test_script: | ||
- cmd: platformio run -d %PLATFORMIO_PROJECT_DIR% | ||
|
||
notifications: | ||
- provider: Slack | ||
incoming_webhook: | ||
secure: E9H0SU0Ju7WLDvgxsV8cs3J62T3nTTX7QkEjsczN0Sto/c9hWkVfhc5gGWUkxhlD975cokHByKGJIdwYwCewqOI+7BrcT8U+nlga4Uau7J8= | ||
on_build_success: false | ||
on_build_failure: true | ||
on_build_status_changed: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"build": { | ||
"core": "arduino", | ||
"extra_flags": "-DARDUINO_AVR_NANO_EVERY -DAVR_NANO_4809_328MODE -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP", | ||
"f_cpu": "16000000L", | ||
"hwids": [ | ||
[ | ||
"0x2341", | ||
"0x0058" | ||
] | ||
], | ||
"mcu": "atmega4809", | ||
"usb_product": "Arduino Nano Every", | ||
"variant": "nona4809" | ||
}, | ||
"bootloader": { | ||
"SYSCFG0": "0xC9", | ||
"file": "atmega4809_uart_bl.hex", | ||
"fuses_file": "fuses_4809.bin", | ||
"BOOTEND": "0x00", | ||
"OSCCFG": "0x01" | ||
}, | ||
"frameworks": [ | ||
"arduino" | ||
], | ||
"name": "Arduino Nano Every", | ||
"upload": { | ||
"maximum_ram_size": 6144, | ||
"maximum_size": 48640, | ||
"protocol": "jtag2updi", | ||
"require_upload_port": true, | ||
"speed": 115200, | ||
"use_1200bps_touch": true, | ||
"wait_for_upload_port": true | ||
}, | ||
"url": "https://www.arduino.cc/en/Guide/NANOEvery", | ||
"vendor": "Arduino" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"build": { | ||
"core": "arduino", | ||
"extra_flags": "-DARDUINO_AVR_UNO_WIFI_REV2 -DUNO_WIFI_REV2_328MODE -DMILLIS_USE_TIMERB3", | ||
"text_section_start": "0x200", | ||
"f_cpu": "16000000L", | ||
"hwids": [ | ||
[ | ||
"0x03eb", | ||
"0x2145" | ||
] | ||
], | ||
"mcu": "atmega4809", | ||
"usb_product": "Arduino Uno WiFi Rev2", | ||
"variant": "uno2018" | ||
}, | ||
"bootloader": { | ||
"file": "atmega4809_uart_bl.hex", | ||
"fuses_file": "fuses_4809.bin", | ||
"BOOTEND": "0x02", | ||
"SYSCFG0": "0xC9", | ||
"OSCCFG": "0x01" | ||
}, | ||
"frameworks": [ | ||
"arduino" | ||
], | ||
"name": "Arduino Uno WiFi Rev2", | ||
"upload": { | ||
"disable_flushing": true, | ||
"maximum_ram_size": 6144, | ||
"maximum_size": 48640, | ||
"protocol": "xplainedmini_updi", | ||
"require_upload_port": true, | ||
"speed": 115200, | ||
"wait_for_upload_port": true | ||
}, | ||
"url": "https://www.arduino.cc/en/Guide/ArduinoUnoWiFiRev2", | ||
"vendor": "Arduino" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright 2019-present PlatformIO <[email protected]> | ||
# | ||
# 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. | ||
|
||
# | ||
# Default flags for bare-metal programming (without any framework layers) | ||
# | ||
|
||
from SCons.Script import Import | ||
|
||
Import("env") | ||
|
||
env.Append( | ||
ASFLAGS=["-x", "assembler-with-cpp"], | ||
|
||
CFLAGS=[ | ||
"-std=gnu11", | ||
"-fno-fat-lto-objects" | ||
], | ||
|
||
CCFLAGS=[ | ||
"-Os", | ||
"-w", | ||
"-ffunction-sections", | ||
"-fdata-sections", | ||
"-flto", | ||
"-mmcu=$BOARD_MCU" | ||
], | ||
|
||
CPPDEFINES=[ | ||
("F_CPU", "$BOARD_F_CPU") | ||
], | ||
|
||
CXXFLAGS=[ | ||
"-std=gnu++11", | ||
"-fno-exceptions", | ||
"-fno-threadsafe-statics", | ||
"-fpermissive", | ||
"-Wno-error=narrowing" | ||
], | ||
|
||
LINKFLAGS=[ | ||
"-Os", | ||
"-flto", | ||
"-mmcu=$BOARD_MCU", | ||
"-Wl,--gc-sections", | ||
"-Wl,--section-start=.text=%s" % env.BoardConfig().get( | ||
"build.text_section_start", "0x0"), | ||
"-fuse-linker-plugin" | ||
], | ||
|
||
LIBS=["m"] | ||
) | ||
|
||
# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode) | ||
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Copyright 2019-present PlatformIO <[email protected]> | ||
# | ||
# 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. | ||
|
||
""" | ||
Arduino | ||
Arduino Wiring-based Framework allows writing cross-platform software to | ||
control devices attached to a wide range of Arduino boards to create all | ||
kinds of creative coding, interactive objects, spaces or physical experiences. | ||
http://arduino.cc/en/Reference/HomePage | ||
""" | ||
|
||
import sys | ||
from os.path import isdir, isfile, join | ||
|
||
from SCons.Script import DefaultEnvironment | ||
|
||
env = DefaultEnvironment() | ||
platform = env.PioPlatform() | ||
|
||
FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-megaavr") | ||
assert isdir(FRAMEWORK_DIR) | ||
|
||
board = env.BoardConfig() | ||
build_core = board.get("build.core", "") | ||
|
||
CPPDEFINES = [ | ||
"ARDUINO_ARCH_MEGAAVR", | ||
("ARDUINO", 10808) | ||
] | ||
|
||
if "build.usb_product" in board: | ||
CPPDEFINES += [ | ||
("USB_VID", board.get("build.hwids")[0][0]), | ||
("USB_PID", board.get("build.hwids")[0][1]), | ||
("USB_PRODUCT", '\\"%s\\"' % | ||
board.get("build.usb_product", "").replace('"', "")), | ||
("USB_MANUFACTURER", '\\"%s\\"' % | ||
board.get("vendor", "").replace('"', "")) | ||
] | ||
|
||
env.SConscript("_bare.py", exports="env") | ||
|
||
env.Append( | ||
CPPDEFINES=CPPDEFINES, | ||
|
||
CPPPATH=[ | ||
join(FRAMEWORK_DIR, "cores", build_core, "api", "deprecated"), | ||
join(FRAMEWORK_DIR, "cores", build_core) | ||
], | ||
|
||
LIBSOURCE_DIRS=[ | ||
join(FRAMEWORK_DIR, "libraries") | ||
] | ||
) | ||
|
||
# Bootloader and fuses for uploading purposes | ||
bootloader_config = board.get("bootloader", {}) | ||
if "BOOTLOADER_CMD" not in env: | ||
if env.subst("$BOARD") == "uno_wifi_rev2": | ||
bootloader_path = join( | ||
FRAMEWORK_DIR, "bootloaders", board.get("bootloader.file", "")) | ||
if isfile(bootloader_path): | ||
env.Replace(BOOTLOADER_CMD='-Uflash:w:"%s":i' % bootloader_path) | ||
else: | ||
sys.stderr.write( | ||
"Error: Couldn't find bootloader image %s\n" % bootloader_path) | ||
env.Exit(1) | ||
|
||
if "FUSES_CMD" not in env: | ||
for fuse in ("OSCCFG", "SYSCFG0", "BOOTEND"): | ||
if not bootloader_config.get(fuse, ""): | ||
sys.stderr.write("Error: Missing %s fuse value\n" % fuse) | ||
env.Exit(1) | ||
|
||
env.Replace( | ||
FUSES_CMD="-Ufuse2:w:%s:m -Ufuse5:w:%s:m -Ufuse8:w:%s:m" % ( | ||
bootloader_config.get("OSCCFG"), | ||
bootloader_config.get("SYSCFG0"), | ||
bootloader_config.get("BOOTEND") | ||
) | ||
) | ||
|
||
# | ||
# Target: Build Core Library | ||
# | ||
|
||
libs = [] | ||
|
||
if "build.variant" in board: | ||
variants_dir = join( | ||
"$PROJECT_DIR", board.get("build.variants_dir")) if board.get( | ||
"build.variants_dir", "") else join(FRAMEWORK_DIR, "variants") | ||
|
||
env.Append( | ||
CPPPATH=[ | ||
join(variants_dir, board.get("build.variant")) | ||
] | ||
) | ||
env.BuildSources( | ||
join("$BUILD_DIR", "FrameworkArduinoVariant"), | ||
join(variants_dir, board.get("build.variant")) | ||
) | ||
|
||
env.BuildSources( | ||
join("$BUILD_DIR", "FrameworkArduino"), | ||
join(FRAMEWORK_DIR, "cores", build_core) | ||
) | ||
|
||
env.Prepend(LIBS=libs) |
Oops, something went wrong.