diff --git a/.gitignore b/.gitignore index fede0103d..5710441dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *.bz2 - bootloaders/*/build/ - .DS_Store -*.json +package_electroniccats-samd-2.0.0_index.json diff --git a/builder/compat.py b/builder/compat.py new file mode 100644 index 000000000..2aca045cc --- /dev/null +++ b/builder/compat.py @@ -0,0 +1,38 @@ +# Copyright 2014-present PlatformIO +# +# 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. + +from SCons.Script import AlwaysBuild, Import + + +Import("env") + + +# Added in PIO Core 4.4.0 +if not hasattr(env, "AddPlatformTarget"): + + def AddPlatformTarget( + env, + name, + dependencies, + actions, + title=None, + description=None, + always_build=True, + ): + target = env.Alias(name, dependencies, actions) + if always_build: + AlwaysBuild(target) + return target + + env.AddMethod(AddPlatformTarget) \ No newline at end of file diff --git a/builder/frameworks/arduino.py b/builder/frameworks/arduino.py new file mode 100644 index 000000000..694cd0e99 --- /dev/null +++ b/builder/frameworks/arduino.py @@ -0,0 +1,40 @@ +# Copyright 2014-present PlatformIO +# +# 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 os + +from SCons.Script import DefaultEnvironment + +env = DefaultEnvironment() + +board = env.BoardConfig() +build_mcu = env.get("BOARD_MCU", board.get("build.mcu", "")) + +MCU_FAMILY = board.get( + "build.system", "sam" if build_mcu.startswith("at91") else "samd") + +if env.BoardConfig().get("build.core", "").lower() == "mbcwb": + env.SConscript( + os.path.join(env.PioPlatform().get_package_dir( + "framework-arduino-mbcwb"), "tools", "platformio-samd-build.py")) +else: + env.SConscript(os.path.join("arduino", "arduino-%s.py" % MCU_FAMILY)) \ No newline at end of file diff --git a/builder/main.py b/builder/main.py new file mode 100644 index 000000000..9b894fb4a --- /dev/null +++ b/builder/main.py @@ -0,0 +1,25 @@ +########################################################################## +# +# Electronic Cats SAPI de CV 2020 +# http://www.electroniccats.com/ +# +########################################################################## + +from os.path import join +from SCons.Script import (AlwaysBuild, Default, DefaultEnvironment) +from colorama import Fore + +env = DefaultEnvironment() +print( Fore.GREEN + '<<<<<<<<<<<< ' + env.BoardConfig().get("name").upper() + " 2019 ElectronicCats >>>>>>>>>>>>" + Fore.BLACK ) + +elf = env.BuildProgram() +bin = env.CreateBin( join("$BUILD_DIR", "${PROGNAME}"), elf ) +hex = env.CreateHex( join("$BUILD_DIR", "${PROGNAME}"), elf ) +AlwaysBuild( hex, bin ) + +#env.Depends(hex, env.CreateBin( join("$BUILD_DIR", "${PROGNAME}"), elf )) + +upload = env.Alias("upload", hex, [ env.VerboseAction("$UPLOADCMD", "\n"), env.VerboseAction("", "\n") ] ) +AlwaysBuild( upload ) + +Default( hex, bin ) \ No newline at end of file diff --git a/platform.json b/platform.json new file mode 100644 index 000000000..1ac0c1d70 --- /dev/null +++ b/platform.json @@ -0,0 +1,54 @@ +{ + "name": "electronic-cats-samd", + "title": "Electronic Cats SAMD(L)(C) Core for Arduino", + "description": "Arduino support for SAM D|L|C (M0+ and M4F). Support for D51, SAMR34, L21, C21, and D11", + "homepage": "http://www.electroniccats.com", + "license": "LGPL 2.0", + "keywords": [ + "dev-platform", + "ARM", + "Cortex-M", + "Atmel", + "Microchip", + "samr34", + "samd51", + "samd21", + "saml21", + "samc21", + "samd11" + ], + "engines": { "platformio": "^3.0.0" }, + "repository": { + "type": "git", + "url": "https://github.com/ElectronicCats/ArduinoCore-samd" + }, + "version": "2.0.4", + "packageRepositories": [ + "https://dl.bintray.com/platformio/dl-packages/manifest.json", + "http://dl.platformio.org/packages/manifest.json" + ], + "frameworks": { + "arduino": { + "package": "framework-arduino-samd-electroniccats", + "script": "builder/frameworks/arduino.py" + }, + "baremetal": { + "package": "framework-arduino-samd-electroniccats", + "script": "builder/frameworks/baremetal.py" + } + }, + "packages": { + "toolchain-gccarmnoneeabi": { + "type": "toolchain", + "version": "=1.70201.0" + }, + "framework-arduino-samd-electroniccats": { + "type": "framework", + "version": "https://github.com/ElectronicCats/ArduinoCore-samd" + }, + "tool-arduino-samd-electroniccats": { + "type": "uploader", + "version": "https://github.com/ElectronicCats/Arduino_Boards_Index" + } + } + } \ No newline at end of file