diff --git a/HISTORY.rst b/HISTORY.rst index 98b4544c..32650f05 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -12,6 +12,8 @@ PlatformIO 2.0 PlatformIO. ``pip install platformio`` rocks! * Added support for the new Adafruit boards Bluefruit Micro and Feather (`issue #403 `_) +* Added support for RFDuino + (`issue #319 `_) * Updated Arduino framework for Atmel AVR development platform to 1.6.7 * Documented `firmware uploading for Atmel AVR development platform using Programmers `_: diff --git a/docs/frameworks/arduino.rst b/docs/frameworks/arduino.rst index eb9b54d1..1b862d81 100644 --- a/docs/frameworks/arduino.rst +++ b/docs/frameworks/arduino.rst @@ -36,6 +36,9 @@ Platforms * - :ref:`platform_espressif` - Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications. + * - :ref:`platform_nordicnrf51` + - The Nordic nRF51 Series is a family of highly flexible, multi-protocol, system-on-chip (SoC) devices for ultra-low power wireless applications. nRF51 Series devices support a range of protocol stacks including Bluetooth Smart (previously called Bluetooth low energy), ANT and proprietary 2.4GHz protocols such as Gazell. + * - :ref:`platform_teensy` - Teensy is a complete USB-based microcontroller development system, in a very small footprint, capable of implementing many types of projects. All programming is done via the USB port. No special programmer is needed, only a standard "Mini-B" USB cable and a PC or Macintosh with a USB port. @@ -783,6 +786,26 @@ Quirkbot - 32 Kb - 2.5 Kb +RFduino +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``rfduino`` + - `RFduino `_ + - NRF51822 + - 16 MHz + - 128 Kb + - 8 Kb + RedBearLab ~~~~~~~~~~ diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index e1ba86d9..134b888b 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -62,6 +62,9 @@ Packages * - ``framework-arduinomsp430`` - `Arduino Wiring-based Framework (MSP430 Core) `_ + * - ``framework-arduinonordicnrf51`` + - `Arduino Wiring-based Framework (RFDuino Core) `_ + * - ``framework-arduinosam`` - `Arduino Wiring-based Framework (SAM Core, 1.6) `_ @@ -113,6 +116,9 @@ Packages * - ``tool-mspdebug`` - `MSPDebug `_ + * - ``tool-rfdloader`` + - `rfdloader `_ + * - ``tool-scons`` - `SCons software construction tool `_ diff --git a/docs/platforms/nordicnrf51.rst b/docs/platforms/nordicnrf51.rst index 542fcc44..2e74f90e 100644 --- a/docs/platforms/nordicnrf51.rst +++ b/docs/platforms/nordicnrf51.rst @@ -31,9 +31,15 @@ Packages * - ``framework-mbed`` - `mbed Framework `_ + * - ``tool-rfdloader`` + - `rfdloader `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ + * - ``framework-arduinonordicnrf51`` + - `Arduino Wiring-based Framework (RFDuino Core) `_ + .. warning:: **Linux Users:** Don't forget to install "udev" rules file `99-platformio-udev.rules `_ (an instruction is located in the file). @@ -51,6 +57,9 @@ Frameworks * - Name - Description + * - :ref:`framework_arduino` + - Arduino 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. + * - :ref:`framework_mbed` - The mbed framework The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community. @@ -137,6 +146,26 @@ Nordic - 128 Kb - 16 Kb +RFduino +~~~~~~~ + +.. list-table:: + :header-rows: 1 + + * - Type ``board`` + - Name + - Microcontroller + - Frequency + - Flash + - RAM + + * - ``rfduino`` + - `RFduino `_ + - NRF51822 + - 16 MHz + - 128 Kb + - 8 Kb + RedBearLab ~~~~~~~~~~ diff --git a/platformio/__init__.py b/platformio/__init__.py index cd2d6c86..914802b5 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (2, 7, "0.dev0") +VERSION = (2, 7, "0.dev1") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/boards/nordicnrf51.json b/platformio/boards/nordicnrf51.json index beaedcd9..82631856 100644 --- a/platformio/boards/nordicnrf51.json +++ b/platformio/boards/nordicnrf51.json @@ -142,5 +142,25 @@ }, "url": "https://developer.mbed.org/platforms/Delta-DFCM-NNN40/", "vendor": "Delta" + }, + "rfduino": { + "build": { + "core": "arduino", + "extra_flags": "-D__RFduino__", + "f_cpu": "16000000L", + "ldscript": "RFduino.ld", + "cpu": "cortex-m0", + "mcu": "nrf51822", + "variant": "rfduino" + }, + "frameworks": ["arduino"], + "name": "RFduino", + "platform": "nordicnrf51", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 131072 + }, + "url": "http://www.rfduino.com/product/rfd22102-rfduino-dip/index.html", + "vendor": "RFduino" } } diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 23f377e9..6cf1e05d 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -111,12 +111,7 @@ if "BOARD" in env: UPLOAD_SPEED="${BOARD_OPTIONS['upload'].get('speed', None)}") if "ldscript" in env.get("BOARD_OPTIONS", {}).get("build", {}): env.Replace( - LDSCRIPT_PATH=( - env['BOARD_OPTIONS']['build']['ldscript'] - if isfile(env['BOARD_OPTIONS']['build']['ldscript']) - else join("$PIOHOME_DIR", "packages", "ldscripts", - "${BOARD_OPTIONS['build']['ldscript']}") - ) + LDSCRIPT_PATH="${BOARD_OPTIONS['build']['ldscript']}" ) if env['PLATFORM'] != env.get("BOARD_OPTIONS", {}).get("platform"): diff --git a/platformio/builder/scripts/frameworks/arduino.py b/platformio/builder/scripts/frameworks/arduino.py index f6637e36..a320d170 100644 --- a/platformio/builder/scripts/frameworks/arduino.py +++ b/platformio/builder/scripts/frameworks/arduino.py @@ -60,6 +60,34 @@ elif env.get("PLATFORM") == "espressif": LIBS=["smartconfig", "pp", "main", "wpa", "lwip", "net80211", "wps", "crypto", "phy", "hal", "axtls", "gcc", "m"] ) +elif env.get("PLATFORM") == "nordicnrf51": + PLATFORMFW_DIR = join( + "$PIOPACKAGES_DIR", + "framework-arduinonordicnrf51" + ) + env.Prepend( + CPPPATH=[ + join("$PLATFORMFW_DIR", "system", "CMSIS", "CMSIS", "Include"), + join("$PLATFORMFW_DIR", "system", "RFduino"), + join("$PLATFORMFW_DIR", "system", "RFduino", "include") + ], + LIBPATH=[ + join( + "$PLATFORMFW_DIR", + "variants", + "${BOARD_OPTIONS['build']['variant']}" + ), + join( + "$PLATFORMFW_DIR", + "variants", + "${BOARD_OPTIONS['build']['variant']}", + "linker_scripts", + "gcc" + ), + ], + LIBS=["RFduino", "RFduinoBLE", "RFduinoGZLL", "RFduinoSystem"] + ) + env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR) diff --git a/platformio/builder/scripts/nordicnrf51.py b/platformio/builder/scripts/nordicnrf51.py index 5d32791d..9ffd1527 100644 --- a/platformio/builder/scripts/nordicnrf51.py +++ b/platformio/builder/scripts/nordicnrf51.py @@ -25,6 +25,17 @@ env = DefaultEnvironment() SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) +if env.subst("$BOARD") == "rfduino": + env.Append( + CPPFLAGS=["-fno-builtin"], + LINKFLAGS=["--specs=nano.specs"] + ) + env.Replace( + UPLOADER=join("$PIOPACKAGES_DIR", "tool-rfdloader", "rfdloader"), + UPLOADERFLAGS=["-q", "$UPLOAD_PORT", "$SOURCES"], + UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS"' + ) + # # Target: Build executable and linkable firmware # @@ -51,7 +62,12 @@ AlwaysBuild(target_size) # Target: Upload by default .bin file # -upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) +if env.subst("$BOARD") == "rfduino": + upload = env.Alias( + ["upload", "uploadlazy"], target_firm, + [lambda target, source, env: env.AutodetectUploadPort(), "$UPLOADCMD"]) +else: + upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) AlwaysBuild(upload) # diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index b76f70d2..2ce781f4 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -47,6 +47,10 @@ PLATFORM_PACKAGES = { ("Arduino Wiring-based Framework (ESP8266 Core)", "https://github.com/esp8266/Arduino") ], + "framework-arduinonordicnrf51": [ + ("Arduino Wiring-based Framework (RFDuino Core)", + "https://github.com/RFduino/RFduino") + ], "framework-energiamsp430": [ ("Energia Wiring-based Framework (MSP430 Core)", "http://energia.nu/reference/") @@ -139,6 +143,9 @@ PLATFORM_PACKAGES = { ], "tool-esptool": [ ("esptool-ck", "https://github.com/igrr/esptool-ck") + ], + "tool-rfdloader": [ + ("rfdloader", "https://github.com/RFduino/RFduino") ] } diff --git a/platformio/platforms/nordicnrf51.py b/platformio/platforms/nordicnrf51.py index b2ef7197..3f9fbcf3 100644 --- a/platformio/platforms/nordicnrf51.py +++ b/platformio/platforms/nordicnrf51.py @@ -37,8 +37,22 @@ class Nordicnrf51Platform(BasePlatform): "framework-mbed": { "alias": "framework" + }, + + "framework-arduinonordicnrf51": { + "alias": "framework" + }, + + "tool-rfdloader": { } } def get_name(self): return "Nordic nRF51" + + def configure_default_packages(self, envoptions, targets): + if envoptions.get("board") == "rfduino": + self.PACKAGES['tool-rfdloader']['alias'] = "uploader" + + return BasePlatform.configure_default_packages( + self, envoptions, targets)