STM32duino support (#4)
* Added STM32duino support; Serial and DFU upload protocols * Fixed ld script naming for Olimexino STM32 * Renamed boards and their framework to arduino * Board genericSTM32F103RB framework renamed to arduino * Changed boards url and vendor * Merged usbid with hwid's; renamed STM32duino to Arduino; some other minor changes * Replaced framework-stm32duino with framework-arduinoststm32 * Updated platform.json
This commit is contained in:
parent
5912ee631a
commit
e2a9c070da
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103C8",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "jtag_c8.ld",
|
||||
"mcu": "stm32f103c8",
|
||||
"variant": "generic_stm32f103c"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103C8 (20k RAM. 64k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 20480,
|
||||
"maximum_size": 65536,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103c8.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103CB",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "jtag.ld",
|
||||
"mcu": "stm32f103cb",
|
||||
"variant": "generic_stm32f103c"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103CB (20k RAM. 128k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 20480,
|
||||
"maximum_size": 131072,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103cb.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103R8",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "stm32f103r8.ld",
|
||||
"mcu": "stm32f103r8",
|
||||
"variant": "generic_stm32f103r8"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103R8 (20k RAM. 64 Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 20480,
|
||||
"maximum_size": 65536,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103r8.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103RB",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "stm32f103rb.ld",
|
||||
"mcu": "stm32f103rb",
|
||||
"variant": "generic_stm32f103r8"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103RB (20k RAM. 128k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 20480,
|
||||
"maximum_size": 131072,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103rb.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103RC",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "stm32f103rc.ld",
|
||||
"mcu": "stm32f103rc",
|
||||
"variant": "generic_stm32f103r"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103RC (48k RAM. 256k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 49152,
|
||||
"maximum_size": 262144,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103rc.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103RE",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "stm32f103re.ld",
|
||||
"mcu": "stm32f103re",
|
||||
"variant": "generic_stm32f103r"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "STM32F103RE (64k RAM. 512k Flash)",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 65536,
|
||||
"maximum_size": 524288,
|
||||
"protocol": "maple_serial",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f103/stm32f103re.html",
|
||||
"vendor": "Generic"
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"build": {
|
||||
"core": "maple",
|
||||
"cpu": "cortex-m3",
|
||||
"extra_flags": "-DMCU_STM32F103RB",
|
||||
"f_cpu": "72000000L",
|
||||
"hwids": [
|
||||
["0x1EAF", "0x0003"],
|
||||
["0x1EAF", "0x0004"]
|
||||
],
|
||||
"ldscript": "flash.ld",
|
||||
"mcu": "stm32f103rb_maple",
|
||||
"variant": "maple"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "Olimexino STM32",
|
||||
"upload": {
|
||||
"disable_flushing": false,
|
||||
"maximum_ram_size": 17000,
|
||||
"maximum_size": 108000,
|
||||
"protocol": "dfu",
|
||||
"require_upload_port": true,
|
||||
"use_1200bps_touch": false,
|
||||
"wait_for_upload_port": false
|
||||
},
|
||||
"url": "https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/",
|
||||
"vendor": "Olimex"
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
# Copyright 2014-present 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.
|
||||
|
||||
"""
|
||||
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://www.stm32duino.com
|
||||
"""
|
||||
|
||||
from os import walk
|
||||
from os.path import isdir, isfile, join
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
platform = env.PioPlatform()
|
||||
|
||||
if "stm32f103" in env.BoardConfig().get("build.mcu", ""):
|
||||
FRAMEWORK_DIR = join(platform.get_package_dir("framework-arduinoststm32"), "STM32F1")
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"ERROR_LED_PORT=GPIOB",
|
||||
"ERROR_LED_PIN=1",
|
||||
"ARDUINO_ARCH_STM32F1"
|
||||
]
|
||||
)
|
||||
if "stm32f103r8" or "stm32f103rb" in env.BoardConfig().get("build.mcu", ""):
|
||||
env.Append(CPPDEFINES=["BOARD_generic_stm32f103r8", "ARDUINO_GENERIC_STM32F103R"])
|
||||
elif "stm32f103rc" or "stm32f103re" in env.BoardConfig().get("build.mcu", ""):
|
||||
env.Append(CPPDEFINES=["BOARD_generic_stm32f103r", "ARDUINO_GENERIC_STM32F103R"])
|
||||
elif "stm32f103c" in env.BoardConfig().get("build.mcu", ""):
|
||||
env.Append(CPPDEFINES=["BOARD_generic_stm32f103c", "ARDUINO_GENERIC_STM32F103C"])
|
||||
elif "stm32f103rb_maple" in env.BoardConfig().get("build.mcu", ""):
|
||||
env.Append(CPPDEFINES=["BOARD_maple", "ARDUINO_MAPLE_REV3"])
|
||||
|
||||
FRAMEWORK_VERSION = platform.get_package_version("framework-arduinoststm32")
|
||||
assert isdir(FRAMEWORK_DIR)
|
||||
|
||||
ARDUINO_VERSION = int(FRAMEWORK_VERSION.replace(".", "").strip())
|
||||
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"ARDUINO=%s" % FRAMEWORK_VERSION.split(".")[1]
|
||||
],
|
||||
|
||||
CPPPATH=[
|
||||
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core")),
|
||||
join(FRAMEWORK_DIR, "system", "libmaple"),
|
||||
join(FRAMEWORK_DIR, "system", "libmaple", "include"),
|
||||
join(FRAMEWORK_DIR, "system", "libmaple", "usb", "stm32f1"),
|
||||
join(FRAMEWORK_DIR, "system", "libmaple", "usb", "usb_lib")
|
||||
],
|
||||
|
||||
LIBPATH=[
|
||||
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"), "ld")
|
||||
]
|
||||
)
|
||||
|
||||
for item in ("-nostartfiles", "-nostdlib"):
|
||||
if item in env['LINKFLAGS']:
|
||||
env['LINKFLAGS'].remove(item)
|
||||
|
||||
ld = env.BoardConfig().get("build.ldscript")
|
||||
|
||||
if env.subst("$UPLOAD_PROTOCOL") == "dfu":
|
||||
if "stm32f103c" in env.BoardConfig().get("build.mcu", ""):
|
||||
ld = "bootloader_20.ld"
|
||||
elif "stm32f103r" in env.BoardConfig().get("build.mcu", ""):
|
||||
ld = "bootloader.ld"
|
||||
if "stm32f103rb_maple" in env.BoardConfig().get("build.mcu", ""):
|
||||
env.Append(CPPDEFINES=["VECT_TAB_ADDR=0x8005000", "SERIAL_USB"])
|
||||
else:
|
||||
env.Append(CPPDEFINES=["VECT_TAB_ADDR=0x8002000", "SERIAL_USB", "GENERIC_BOOTLOADER"])
|
||||
env.Replace(LDSCRIPT_PATH=ld)
|
||||
else:
|
||||
env.Append(CPPDEFINES=["VECT_TAB_ADDR=0x8000000"])
|
||||
#
|
||||
# Lookup for specific core's libraries
|
||||
#
|
||||
|
||||
BOARD_CORELIBDIRNAME = env.BoardConfig().get("build.core", "")
|
||||
env.Append(
|
||||
LIBSOURCE_DIRS=[
|
||||
join(FRAMEWORK_DIR, "libraries", "__cores__", BOARD_CORELIBDIRNAME),
|
||||
join(FRAMEWORK_DIR, "libraries")
|
||||
]
|
||||
)
|
||||
|
||||
#
|
||||
# Target: Build Core Library
|
||||
#
|
||||
|
||||
libs = []
|
||||
|
||||
if "build.variant" in env.BoardConfig():
|
||||
env.Append(
|
||||
CPPPATH=[
|
||||
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
|
||||
]
|
||||
)
|
||||
libs.append(env.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkArduinoVariant"),
|
||||
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
|
||||
))
|
||||
|
||||
envsafe = env.Clone()
|
||||
|
||||
libs.append(envsafe.BuildLibrary(
|
||||
join("$BUILD_DIR", "FrameworkArduino"),
|
||||
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
|
||||
))
|
||||
|
||||
env.Append(
|
||||
LIBPATH=[
|
||||
join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"))
|
||||
]
|
||||
)
|
||||
|
||||
env.Prepend(LIBS=libs)
|
|
@ -21,6 +21,8 @@ from os.path import isfile, join
|
|||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment)
|
||||
|
||||
from platformio import util
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
env.Replace(
|
||||
|
@ -140,6 +142,31 @@ if env.subst("$UPLOAD_PROTOCOL") == "gdb":
|
|||
UPLOADCMD='$UPLOADER $UPLOADERFLAGS'
|
||||
)
|
||||
|
||||
if "arduino" in env.subst("$PIOFRAMEWORK"):
|
||||
uploadProtocol = ""
|
||||
uploadParams = ""
|
||||
if "linux" in util.get_systype():
|
||||
uploadPlatform = "linux"
|
||||
elif "darwin" in util.get_systype():
|
||||
uploadPlatform = "macosx"
|
||||
else:
|
||||
uploadPlatform = "win"
|
||||
if env.subst("$UPLOAD_PROTOCOL") == "serial":
|
||||
uploadProtocol = "serial_upload"
|
||||
uploadParams = "{upload.altID} {upload.usbID} $PROJECT_DIR/$SOURCES"
|
||||
elif env.subst("$UPLOAD_PROTOCOL") == "dfu":
|
||||
uploadProtocol = "maple_upload"
|
||||
usbids = env.BoardConfig().get("build.hwids", "")
|
||||
usbid = '2 %s:%s' % (usbids[0][0], usbids[0][1])
|
||||
env.Replace(UPLOADERFLAGS=usbid)
|
||||
uploadParams = usbid
|
||||
env.Replace(
|
||||
UPLOADER=join(env.PioPlatform().get_package_dir("framework-arduinoststm32") or "", "tools", uploadPlatform, uploadProtocol),
|
||||
UPLOADERFLAGS=["$UPLOAD_PORT"],
|
||||
UPLOADERPARAMS=uploadParams,
|
||||
UPLOADCMD='$UPLOADER $UPLOADERFLAGS $UPLOADERPARAMS $PROJECT_DIR/$SOURCES'
|
||||
)
|
||||
|
||||
#
|
||||
# Target: Build executable and linkable firmware
|
||||
#
|
||||
|
@ -174,6 +201,12 @@ if "mbed" in env.subst("$PIOFRAMEWORK") and not env.subst("$UPLOAD_PROTOCOL"):
|
|||
[env.VerboseAction(env.AutodetectUploadPort,
|
||||
"Looking for upload disk..."),
|
||||
env.VerboseAction(env.UploadToDisk, "Uploading $SOURCE")])
|
||||
elif "arduino" in env.subst("$PIOFRAMEWORK"):
|
||||
upload = env.Alias(
|
||||
["upload", "uploadlazy"], target_firm,
|
||||
[env.VerboseAction(env.AutodetectUploadPort,
|
||||
"Looking for upload disk..."),
|
||||
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")])
|
||||
else:
|
||||
upload = env.Alias(["upload", "uploadlazy"], target_firm,
|
||||
env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE"))
|
||||
|
|
|
@ -17,7 +17,17 @@
|
|||
"packageRepositories": [
|
||||
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
|
||||
"https://sourceforge.net/projects/platformio-storage/files/packages/manifest.json/download",
|
||||
"http://dl.platformio.org/packages/manifest.json"
|
||||
"http://dl.platformio.org/packages/manifest.json",
|
||||
{
|
||||
"framework-arduinoststm32": [
|
||||
{
|
||||
"url": "https://github.com/ubis/Arduino_STM32/archive/v1.0.0.tar.gz",
|
||||
"sha1": "36F26069B70EF6B7CEAE2A91E3C23BE74CC79337",
|
||||
"version": "1.0.0",
|
||||
"system": "*"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"frameworks": {
|
||||
"mbed": {
|
||||
|
@ -35,6 +45,10 @@
|
|||
"libopencm3": {
|
||||
"package": "framework-libopencm3",
|
||||
"script": "builder/frameworks/libopencm3/libopencm3.py"
|
||||
},
|
||||
"arduino": {
|
||||
"package": "framework-arduinoststm32",
|
||||
"script": "builder/frameworks/arduino.py"
|
||||
}
|
||||
},
|
||||
"packages": {
|
||||
|
@ -62,6 +76,11 @@
|
|||
"optional": true,
|
||||
"version": "~1.1.0"
|
||||
},
|
||||
"framework-arduinoststm32": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"version": "~1.0.0"
|
||||
},
|
||||
"tool-stlink": {
|
||||
"type": "uploader",
|
||||
"optional": true,
|
||||
|
|
Loading…
Reference in New Issue