mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Initial support for intel_arc32 platform // Issue #535
This commit is contained in:
30
platformio/boards/intel.json
Normal file
30
platformio/boards/intel.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"genuino101": {
|
||||
"build": {
|
||||
"core": "arc32",
|
||||
"extra_flags": "-DARDUINO_ARCH_ARC32 -D__ARDUINO_ARC__",
|
||||
"f_cpu": "32000000L",
|
||||
"ldscript": "flash.ld",
|
||||
"mcu": "ARCv2EM",
|
||||
"usb_product": "Genuino 101",
|
||||
"variant": "arduino_101",
|
||||
"hwid": [
|
||||
["0x8087", "0x0AB6"]
|
||||
]
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Arduino/Genuino 101",
|
||||
"platform": "intel_arc32",
|
||||
"upload": {
|
||||
"maximum_ram_size": 81920,
|
||||
"maximum_size": 196608,
|
||||
"use_1200bps_touch": true,
|
||||
"protocol": "script",
|
||||
"require_upload_port" : true,
|
||||
"speed": 115200,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "https://www.arduino.cc/en/Main/ArduinoBoard101",
|
||||
"vendor": "Intel"
|
||||
}
|
||||
}
|
@ -115,6 +115,41 @@ elif env.get("PLATFORM") == "microchippic32":
|
||||
]
|
||||
)
|
||||
|
||||
elif "intel" in env.get("PLATFORM"):
|
||||
PLATFORMFW_DIR = join(
|
||||
"$PIOPACKAGES_DIR",
|
||||
"framework-arduinointel"
|
||||
)
|
||||
|
||||
if "arc32" == BOARD_CORELIBDIRNAME:
|
||||
env.Prepend(
|
||||
CPPPATH=[
|
||||
join("$PLATFORMFW_DIR", "system",
|
||||
"libarc32_arduino101", "drivers"),
|
||||
join("$PLATFORMFW_DIR", "system",
|
||||
"libarc32_arduino101", "common"),
|
||||
join("$PLATFORMFW_DIR", "system",
|
||||
"libarc32_arduino101", "framework", "include"),
|
||||
join("$PLATFORMFW_DIR", "system",
|
||||
"libarc32_arduino101", "bootcode"),
|
||||
join("$BUILD_DIR", "IntelDrivers")
|
||||
]
|
||||
)
|
||||
|
||||
env.Prepend(
|
||||
LIBPATH=[
|
||||
join(
|
||||
"$PLATFORMFW_DIR", "variants",
|
||||
"${BOARD_OPTIONS['build']['variant']}"
|
||||
),
|
||||
join(
|
||||
"$PLATFORMFW_DIR", "variants",
|
||||
"${BOARD_OPTIONS['build']['variant']}",
|
||||
"linker_scripts"
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
env.Replace(PLATFORMFW_DIR=PLATFORMFW_DIR)
|
||||
|
||||
#
|
||||
@ -283,6 +318,8 @@ if BOARD_BUILDOPTS.get("core", None) == "teensy3":
|
||||
libs.append("arm_cortex%sl_math" % (
|
||||
"M4" if BOARD_BUILDOPTS.get("cpu") == "cortex-m4" else "M0"))
|
||||
|
||||
if env.subst("$BOARD") == "genuino101":
|
||||
libs.append("libarc32drv_arduino101")
|
||||
|
||||
libs.append(envsafe.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkArduino"),
|
||||
|
199
platformio/builder/scripts/intel_arc32.py
Normal file
199
platformio/builder/scripts/intel_arc32.py
Normal file
@ -0,0 +1,199 @@
|
||||
# Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Builder for Intel ARC32 microcontrollers
|
||||
"""
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
|
||||
|
||||
def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
|
||||
|
||||
if "program" in COMMAND_LINE_TARGETS:
|
||||
return
|
||||
|
||||
env.AutodetectUploadPort()
|
||||
env.Prepend(UPLOADERFLAGS=['"$UPLOAD_PORT"'])
|
||||
|
||||
if env.get("BOARD_OPTIONS", {}).get("upload", {}).get(
|
||||
"use_1200bps_touch", False):
|
||||
env.TouchSerialPort("$UPLOAD_PORT", 1200)
|
||||
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
AR="arc-elf32-ar",
|
||||
AS="arc-elf32-as",
|
||||
CC="arc-elf32-gcc",
|
||||
CXX="arc-elf32-g++",
|
||||
OBJCOPY="arc-elf32-objcopy",
|
||||
RANLIB="arc-elf32-ranlib",
|
||||
SIZETOOL="arc-elf32-size",
|
||||
|
||||
ARFLAGS=["rcs"],
|
||||
|
||||
ASFLAGS=["-x", "assembler-with-cpp"],
|
||||
|
||||
CCFLAGS=[
|
||||
"-g",
|
||||
"-Os",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-Wall",
|
||||
"-mav2em",
|
||||
"-mlittle-endian",
|
||||
"-m${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-fno-reorder-functions",
|
||||
"-fno-asynchronous-unwind-tables",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-defer-pop",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-main",
|
||||
"-ffreestanding",
|
||||
"-fno-stack-protector",
|
||||
"-mno-sdata",
|
||||
"-fsigned-char"
|
||||
],
|
||||
|
||||
CXXFLAGS=[
|
||||
"-fno-rtti",
|
||||
"-std=c++11",
|
||||
"-fno-exceptions"
|
||||
],
|
||||
|
||||
CPPDEFINES=[
|
||||
"F_CPU=$BOARD_F_CPU",
|
||||
"ARDUINO_ARC32_TOOLS",
|
||||
"__CPU_ARC__",
|
||||
"CLOCK_SPEED=%d" % (
|
||||
int(env.subst("${BOARD_OPTIONS['build']['f_cpu']}").replace(
|
||||
"L", ""))/1000000),
|
||||
"CONFIG_SOC_GPIO_32",
|
||||
"CONFIG_SOC_GPIO_AON",
|
||||
"INFRA_MULTI_CPU_SUPPORT",
|
||||
"CFW_MULTI_CPU_SUPPORT",
|
||||
"HAS_SHARED_MEM"
|
||||
],
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-X",
|
||||
"-Wl,-N",
|
||||
"-Wl,-m${BOARD_OPTIONS['build']['mcu']}",
|
||||
"-Wl,-marcelf",
|
||||
"-static",
|
||||
"-nostdlib",
|
||||
"-nodefaultlibs",
|
||||
"-nostartfiles",
|
||||
"-Wl,--whole-archive",
|
||||
"-larc32drv_arduino101",
|
||||
"-Wl,--no-whole-archive"
|
||||
],
|
||||
|
||||
LIBS=["c", "m", "gcc"],
|
||||
|
||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-arduino101load", "arduino101load"),
|
||||
UPLOADCMD='"$UPLOADER" $BUILD_DIR $SOURCES $UPLOADERFLAGS verbose',
|
||||
|
||||
PROGNAME="firmware",
|
||||
PROGSUFFIX=".elf"
|
||||
)
|
||||
|
||||
|
||||
env.Append(
|
||||
ASFLAGS=env.get("CCFLAGS", [])[:],
|
||||
|
||||
BUILDERS=dict(
|
||||
ElfToBin=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-S",
|
||||
"-O",
|
||||
"binary",
|
||||
"-R",
|
||||
".note",
|
||||
"-R",
|
||||
".comment",
|
||||
"-R",
|
||||
"COMMON",
|
||||
"-R",
|
||||
".eh_frame",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".bin"
|
||||
),
|
||||
ElfToHex=Builder(
|
||||
action=" ".join([
|
||||
"$OBJCOPY",
|
||||
"-S",
|
||||
"-O",
|
||||
"binary",
|
||||
"-R",
|
||||
".note",
|
||||
"-R",
|
||||
".comment",
|
||||
"-R",
|
||||
"COMMON",
|
||||
"-R",
|
||||
".eh_frame",
|
||||
"$SOURCES",
|
||||
"$TARGET"]),
|
||||
suffix=".hex"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
#
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
||||
target_elf = env.BuildProgram()
|
||||
|
||||
#
|
||||
# Target: Build the .bin
|
||||
#
|
||||
|
||||
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 firmware
|
||||
#
|
||||
|
||||
upload = env.Alias(
|
||||
["upload", "uploadlazy"], target_firm, [BeforeUpload, "$UPLOADCMD"])
|
||||
AlwaysBuild(upload)
|
||||
|
||||
#
|
||||
# Target: Define targets
|
||||
#
|
||||
|
||||
Default([target_firm, target_size])
|
45
platformio/platforms/intel_arc32.py
Normal file
45
platformio/platforms/intel_arc32.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
|
||||
#
|
||||
# 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 platformio.platforms.base import BasePlatform
|
||||
|
||||
|
||||
class Intel_arc32Platform(BasePlatform):
|
||||
|
||||
"""
|
||||
ARC embedded processors are a family of 32-bit CPUs that are widely used
|
||||
in SoC devices for storage, home, mobile, automotive, and Internet of
|
||||
Things applications.
|
||||
|
||||
http://www.intel.com/content/www/us/en/wearables/wearable-soc.html
|
||||
"""
|
||||
|
||||
PACKAGES = {
|
||||
|
||||
"toolchain-intelarc32": {
|
||||
"alias": "toolchain",
|
||||
"default": True
|
||||
},
|
||||
|
||||
"framework-arduinointel": {
|
||||
"alias": "framework"
|
||||
},
|
||||
|
||||
"tool-arduino101load": {
|
||||
"alias": "uploader"
|
||||
},
|
||||
}
|
||||
|
||||
def get_name(self):
|
||||
return "Intel ARC32"
|
Reference in New Issue
Block a user