From ad7be3b397098ccfd0078cb098cb28e7111d84f1 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 10 Aug 2015 21:39:31 +0300 Subject: [PATCH] Add new development platforms: linux_arm, linux_i686 and linux_x86_64 --- HISTORY.rst | 5 ++- docs/platforms/creating_platform.rst | 9 ++++ docs/platforms/index.rst | 3 ++ docs/platforms/linux_arm.rst | 21 +++++++++ docs/platforms/linux_i686.rst | 21 +++++++++ docs/platforms/linux_x86_64.rst | 21 +++++++++ docs/platforms/windows_x86.rst | 2 +- examples/desktop/hello-world/platformio.ini | 20 +++++++++ platformio/__init__.py | 2 +- platformio/builder/scripts/linux_arm.py | 49 +++++++++++++++++++++ platformio/builder/scripts/linux_i686.py | 49 +++++++++++++++++++++ platformio/builder/scripts/linux_x86_64.py | 49 +++++++++++++++++++++ platformio/platforms/base.py | 16 +++++-- platformio/platforms/linux_arm.py | 32 ++++++++++++++ platformio/platforms/linux_i686.py | 32 ++++++++++++++ platformio/platforms/linux_x86_64.py | 32 ++++++++++++++ 16 files changed, 357 insertions(+), 6 deletions(-) create mode 100644 docs/platforms/linux_arm.rst create mode 100644 docs/platforms/linux_i686.rst create mode 100644 docs/platforms/linux_x86_64.rst create mode 100644 platformio/builder/scripts/linux_arm.py create mode 100644 platformio/builder/scripts/linux_i686.py create mode 100644 platformio/builder/scripts/linux_x86_64.py create mode 100644 platformio/platforms/linux_arm.py create mode 100644 platformio/platforms/linux_i686.py create mode 100644 platformio/platforms/linux_x86_64.py diff --git a/HISTORY.rst b/HISTORY.rst index 7408ff9d..6623fa7b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -6,8 +6,11 @@ Release History * Added `native `__, + `linux_arm `__, + `linux_i686 `__, + `linux_x86_64 `__, `windows_x86 `__ - development platform + development platforms (`issue #263 `_) * Added support for Adafruit Gemma board to `atmelavr `__ diff --git a/docs/platforms/creating_platform.rst b/docs/platforms/creating_platform.rst index 3296277f..2521f0a0 100644 --- a/docs/platforms/creating_platform.rst +++ b/docs/platforms/creating_platform.rst @@ -108,9 +108,18 @@ Packages * - ``toolchain-atmelavr`` - `avr-gcc `_, `GDB `_, `AVaRICE `_, `SimulAVR `_ + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ + * - ``toolchain-gccarmnoneeabi`` - `gcc-arm-embedded `_, `GDB `_ + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ + * - ``toolchain-gccmingw32`` - `MinGW `_ diff --git a/docs/platforms/index.rst b/docs/platforms/index.rst index fd0f0605..f39029f9 100644 --- a/docs/platforms/index.rst +++ b/docs/platforms/index.rst @@ -36,6 +36,9 @@ Desktop :maxdepth: 2 native + linux_arm + linux_i686 + linux_x86_64 windows_x86 Own Platform/Board diff --git a/docs/platforms/linux_arm.rst b/docs/platforms/linux_arm.rst new file mode 100644 index 00000000..9a3b3f02 --- /dev/null +++ b/docs/platforms/linux_arm.rst @@ -0,0 +1,21 @@ +.. _platform_linux_arm: + +Platform ``linux_arm`` +====================== +Linux ARM is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X, Linux ARM) you can build native application for Linux ARM platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gccarmlinuxgnueabi`` + - `GCC for Linux ARM GNU EABI `_, `GDB `_ \ No newline at end of file diff --git a/docs/platforms/linux_i686.rst b/docs/platforms/linux_i686.rst new file mode 100644 index 00000000..8b0e18d4 --- /dev/null +++ b/docs/platforms/linux_i686.rst @@ -0,0 +1,21 @@ +.. _platform_linux_i686: + +Platform ``linux_i686`` +======================= +Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 32-bit) you can build native application for Linux i686 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux32`` + - `GCC for Linux i686 `_ \ No newline at end of file diff --git a/docs/platforms/linux_x86_64.rst b/docs/platforms/linux_x86_64.rst new file mode 100644 index 00000000..a19f02a4 --- /dev/null +++ b/docs/platforms/linux_x86_64.rst @@ -0,0 +1,21 @@ +.. _platform_linux_x86_64: + +Platform ``linux_x86_64`` +========================= +Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant computer operating system (OS) assembled under the model of free and open-source software development and distribution. Using host OS (Mac OS X or Linux 64-bit) you can build native application for Linux x86_64 platform. + +For more detailed information please visit `vendor site `_. + +.. contents:: + +Packages +-------- + +.. list-table:: + :header-rows: 1 + + * - Name + - Contents + + * - ``toolchain-gcclinux64`` + - `GCC for Linux x86_64 `_ \ No newline at end of file diff --git a/docs/platforms/windows_x86.rst b/docs/platforms/windows_x86.rst index 01a45063..a8b72c95 100644 --- a/docs/platforms/windows_x86.rst +++ b/docs/platforms/windows_x86.rst @@ -2,7 +2,7 @@ Platform ``windows_x86`` ======================== -Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows or Mac OS X) you can build native application for Windows x86 platform. +Windows x86 (32-bit) is a metafamily of graphical operating systems developed and marketed by Microsoft. Using host OS (Windows, Linux 32/64 or Mac OS X) you can build native application for Windows x86 platform. For more detailed information please visit `vendor site `_. diff --git a/examples/desktop/hello-world/platformio.ini b/examples/desktop/hello-world/platformio.ini index 9d028e13..1d508758 100644 --- a/examples/desktop/hello-world/platformio.ini +++ b/examples/desktop/hello-world/platformio.ini @@ -22,3 +22,23 @@ platform = native [env:win32] platform = windows_x86 + +# +# If host OS is Mac OS X +# + +# [env:darwin_x86_64] +# platform = native + +# [env:linux_i686] +# platform = linux_i686 + +# [env:linux_x86_64] +# platform = linux_x86_64 + +# [env:windows_x86] +# platform = windows_x86 + +# [env:linux_armv6l] +# platform = linux_arm +# build_flags = -march=armv6 diff --git a/platformio/__init__.py b/platformio/__init__.py index 10e7fc39..3f7f72eb 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (2, 3, "0.dev1") +VERSION = (2, 3, "0.dev2") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/builder/scripts/linux_arm.py b/platformio/builder/scripts/linux_arm.py new file mode 100644 index 00000000..b8864388 --- /dev/null +++ b/platformio/builder/scripts/linux_arm.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux ARM +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="arm-linux-gnueabihf-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_i686.py b/platformio/builder/scripts/linux_i686.py new file mode 100644 index 00000000..d0b0968e --- /dev/null +++ b/platformio/builder/scripts/linux_i686.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux i686 / 32-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="i586-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/builder/scripts/linux_x86_64.py b/platformio/builder/scripts/linux_x86_64.py new file mode 100644 index 00000000..ecb5e775 --- /dev/null +++ b/platformio/builder/scripts/linux_x86_64.py @@ -0,0 +1,49 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +""" + Builder for Linux Linux x64_64 / 64-bit +""" + +from SCons.Script import AlwaysBuild, Default, DefaultEnvironment + +from platformio.util import get_systype + +env = DefaultEnvironment() + +env.Replace( + _BINPREFIX="", + AR="${_BINPREFIX}ar", + AS="${_BINPREFIX}as", + CC="${_BINPREFIX}gcc", + CXX="${_BINPREFIX}g++", + OBJCOPY="${_BINPREFIX}objcopy", + RANLIB="${_BINPREFIX}ranlib", + SIZETOOL="${_BINPREFIX}size", + + SIZEPRINTCMD='"$SIZETOOL" $SOURCES' +) + +if get_systype() == "darwin_x86_64": + env.Replace( + _BINPREFIX="x86_64-pc-linux-" + ) + +# +# Target: Build executable program +# + +target_bin = env.BuildProgram() + +# +# Target: Print binary size +# + +target_size = env.Alias("size", target_bin, "$SIZEPRINTCMD") +AlwaysBuild(target_size) + +# +# Target: Define targets +# + +Default([target_bin]) diff --git a/platformio/platforms/base.py b/platformio/platforms/base.py index 03a71134..f52669e3 100644 --- a/platformio/platforms/base.py +++ b/platformio/platforms/base.py @@ -76,6 +76,19 @@ PLATFORM_PACKAGES = { ("gcc-arm-embedded", "https://launchpad.net/gcc-arm-embedded"), ("GDB", "http://www.gnu.org/software/gdb/") ], + "toolchain-gccarmlinuxgnueabi": [ + ("GCC for Linux ARM GNU EABI", "https://gcc.gnu.org"), + ("GDB", "http://www.gnu.org/software/gdb/") + ], + "toolchain-gccmingw32": [ + ("MinGW", "http://www.mingw.org") + ], + "toolchain-gcclinux32": [ + ("GCC for Linux i686", "https://gcc.gnu.org") + ], + "toolchain-gcclinux64": [ + ("GCC for Linux x86_64", "https://gcc.gnu.org") + ], "toolchain-xtensa": [ ("xtensa-gcc", "https://github.com/jcmvbkbc/gcc-xtensa"), ("GDB", "http://www.gnu.org/software/gdb/") @@ -90,9 +103,6 @@ PLATFORM_PACKAGES = { "tool-micronucleus": [ ("Micronucleus", "https://github.com/micronucleus/micronucleus") ], - "toolchain-gccmingw32": [ - ("MinGW", "http://www.mingw.org") - ], "tool-bossac": [ ("BOSSA CLI", "https://sourceforge.net/projects/b-o-s-s-a/") ], diff --git a/platformio/platforms/linux_arm.py b/platformio/platforms/linux_arm.py new file mode 100644 index 00000000..83aa75b1 --- /dev/null +++ b/platformio/platforms/linux_arm.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_armPlatform(BasePlatform): + + """ + Linux ARM is a Unix-like and mostly POSIX-compliant computer + operating system (OS) assembled under the model of free and open-source + software development and distribution. + + Using host OS (Mac OS X, Linux ARM) you can build native application + for Linux ARM platform. + + http://platformio.org/#!/platforms/linux_arm + """ + + PACKAGES = { + + "toolchain-gccarmlinuxgnueabi": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if "linux_arm" in get_systype(): + del self.PACKAGES['toolchain-gccarmlinuxgnueabi'] + BasePlatform.__init__(self) diff --git a/platformio/platforms/linux_i686.py b/platformio/platforms/linux_i686.py new file mode 100644 index 00000000..c5928ab8 --- /dev/null +++ b/platformio/platforms/linux_i686.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_i686Platform(BasePlatform): + + """ + Linux i686 (32-bit) is a Unix-like and mostly POSIX-compliant + computer operating system (OS) assembled under the model of free and + open-source software development and distribution. + + Using host OS (Mac OS X or Linux 32-bit) you can build native + application for Linux i686 platform. + + http://platformio.org/#!/platforms/linux_i686 + """ + + PACKAGES = { + + "toolchain-gcclinux32": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if get_systype() == "linux_i686": + del self.PACKAGES['toolchain-gcclinux32'] + BasePlatform.__init__(self) diff --git a/platformio/platforms/linux_x86_64.py b/platformio/platforms/linux_x86_64.py new file mode 100644 index 00000000..a142d076 --- /dev/null +++ b/platformio/platforms/linux_x86_64.py @@ -0,0 +1,32 @@ +# Copyright (C) Ivan Kravets +# See LICENSE for details. + +from platformio.platforms.base import BasePlatform +from platformio.util import get_systype + + +class Linux_x86_64Platform(BasePlatform): + + """ + Linux x86_64 (64-bit) is a Unix-like and mostly POSIX-compliant + computer operating system (OS) assembled under the model of free and + open-source software development and distribution. + + Using host OS (Mac OS X or Linux 64-bit) you can build native + application for Linux x86_64 platform. + + http://platformio.org/#!/platforms/linux_i686 + """ + + PACKAGES = { + + "toolchain-gcclinux64": { + "alias": "toolchain", + "default": True + } + } + + def __init__(self): + if get_systype() == "linux_x86_64": + del self.PACKAGES['toolchain-gcclinux64'] + BasePlatform.__init__(self)