diff --git a/examples/mbed/mbed-blink/platformio.ini b/examples/mbed/mbed-blink/platformio.ini index b6a88e91..306e976c 100644 --- a/examples/mbed/mbed-blink/platformio.ini +++ b/examples/mbed/mbed-blink/platformio.ini @@ -47,3 +47,9 @@ board = nucleo_f401re platform = teensy framework = mbed board = teensy31 + +# Silicon Labs EFM32 Platform +[env:siliconlabsefm32] +platform = siliconlabsefm32 +framework = mbed +board = efm32hg_stk3400 diff --git a/platformio/boards/siliconlabsefm32.json b/platformio/boards/siliconlabsefm32.json new file mode 100644 index 00000000..dfa58584 --- /dev/null +++ b/platformio/boards/siliconlabsefm32.json @@ -0,0 +1,86 @@ +{ + "efm32wg_stk3800": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m4", + "mcu": "efm32wg990f256" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32WG-STK3800 (Wonder Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Wonder-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32gg_stk3700": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m3", + "mcu": "efm32gg990f1024" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32GG-STK3700 (Giant Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 131072, + "maximum_size": 1048576 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Giant-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32lg_stk3600": { + "build": { + "f_cpu": "48000000L", + "cpu": "cortex-m3", + "mcu": "efm32lg990f256" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32LG-STK3600 (Leopard Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 32768, + "maximum_size": 262144 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Leopard-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32zg_stk3200": { + "build": { + "f_cpu": "24000000L", + "cpu": "cortex-m0plus", + "mcu": "efm2zg222f32" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs EFM32ZG-STK3200 (Zero Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 4096, + "maximum_size": 32768 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Zero-Gecko/", + "vendor": "Silicon Labs" + }, + + "efm32hg_stk3400": { + "build": { + "f_cpu": "24000000L", + "cpu": "cortex-m3", + "mcu": "efm32hg322f64" + }, + "frameworks": ["mbed"], + "name": "Silicon Labs SLSTK3400A USB-enabled (Happy Gecko)", + "platform": "siliconlabsefm32", + "upload": { + "maximum_ram_size": 8192, + "maximum_size": 65536 + }, + "url": "https://developer.mbed.org/platforms/EFM32-Happy-Gecko/", + "vendor": "Silicon Labs" + } +} diff --git a/platformio/builder/scripts/siliconlabsefm32.py b/platformio/builder/scripts/siliconlabsefm32.py new file mode 100644 index 00000000..29692f6f --- /dev/null +++ b/platformio/builder/scripts/siliconlabsefm32.py @@ -0,0 +1,50 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Silicon Labs EFM32 series ARM microcontrollers. +""" + +from os.path import join + +from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default, + DefaultEnvironment, SConscript) + +env = DefaultEnvironment() + +SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))) + +# +# Target: Build executable and linkable firmware +# + +target_elf = env.BuildFirmware() + +# +# Target: Build the .bin file +# + +if "uploadlazy" in COMMAND_LINE_TARGETS: + target_firm = join("$BUILD_DIR", "firmware.bin") +else: + target_firm = env.ElfToBin(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 .bin file +# + +upload = env.Alias(["upload", "uploadlazy"], target_firm, env.UploadToDisk) +AlwaysBuild(upload) + +# +# Target: Define targets +# + +Default([target_firm, target_size]) diff --git a/platformio/platforms/siliconlabsefm32.py b/platformio/platforms/siliconlabsefm32.py new file mode 100644 index 00000000..a39f7fb7 --- /dev/null +++ b/platformio/platforms/siliconlabsefm32.py @@ -0,0 +1,36 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform + + +class Siliconlabsefm32Platform(BasePlatform): + + """ + Silicon Labs EFM32 Gecko 32-bit microcontroller (MCU) family includes + devices that offer flash memory configurations up to 256 kB, 32 kB of + RAM and CPU speeds up to 48 MHz. + + Based on the powerful ARM Cortex-M core, the Gecko family features + innovative low energy techniques, short wake-up time from energy saving + modes and a wide selection of peripherals, making it ideal for battery + operated applications and other systems requiring high performance and + low-energy consumption. + + http://www.silabs.com/products/mcu/32-bit/efm32-gecko/Pages/efm32-gecko.aspx + """ + + PACKAGES = { + + "toolchain-gccarmnoneeabi": { + "alias": "toolchain", + "default": True + }, + + "framework-mbed": { + "default": True + } + } + + def get_name(self): + return "Silicon Labs EFM32"