Skip to content

Commit

Permalink
Merge branch 'release/v4.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Aug 19, 2019
2 parents 590ccad + 619b010 commit b873ddf
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 15 deletions.
31 changes: 31 additions & 0 deletions boards/teensy40.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"build": {
"core": "teensy4",
"cpu": "cortex-m7",
"extra_flags": "-D__IMXRT1062__ -DTEENSY40",
"f_cpu": "600000000",
"ldscript": "imxrt1062.ld",
"mcu": "imxrt1062"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "MIMXRT1062xxxxA"
},
"frameworks": [
"arduino"
],
"name": "Teensy 4.0",
"upload": {
"maximum_ram_size": 1048576,
"maximum_size": 2031616,
"protocol": "teensy-gui",
"protocols": [
"teensy-gui",
"jlink"
]
},
"url": "https://www.pjrc.com/store/teensy40.html",
"vendor": "Teensy"
}
37 changes: 26 additions & 11 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoteensy")
FRAMEWORK_VERSION = platform.get_package_version("framework-arduinoteensy")
BUILD_CORE = env.BoardConfig().get("build.core")

assert isdir(FRAMEWORK_DIR)

BUILTIN_USB_FLAGS = (
Expand Down Expand Up @@ -61,22 +63,27 @@
if not set(env.get("CPPDEFINES", [])) & set(BUILTIN_USB_FLAGS):
env.Append(CPPDEFINES=["USB_SERIAL"])

env.Replace(
SIZEPROGREGEXP=r"^(?:\.text|\.text\.progmem|\.text\.itcm|\.data)\s+([0-9]+).*",
SIZEDATAREGEXP=r"^(?:\.usbdescriptortable|\.dmabuffers|\.usbbuffers|\.data|\.bss|\.bss\.dma|\.noinit|\.text\.itcm)\s+([0-9]+).*"
)

env.Append(
CPPDEFINES=[
("ARDUINO", 10805),
("TEENSYDUINO", int(FRAMEWORK_VERSION.split(".")[1]))
],

CPPPATH=[
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
join(FRAMEWORK_DIR, "cores", BUILD_CORE)
],

LIBSOURCE_DIRS=[
join(FRAMEWORK_DIR, "libraries")
]
)

if "BOARD" in env and env.BoardConfig().get("build.core") == "teensy":
if "BOARD" in env and BUILD_CORE == "teensy":
env.Append(
ASFLAGS=["-x", "assembler-with-cpp"],

Expand All @@ -91,7 +98,8 @@
CXXFLAGS=[
"-fno-exceptions",
"-felide-constructors",
"-std=gnu++11"
"-std=gnu++11",
"-fpermissive"
],

CPPDEFINES=[
Expand All @@ -107,7 +115,7 @@

LIBS=["m"]
)
elif "BOARD" in env and env.BoardConfig().get("build.core") == "teensy3":
elif "BOARD" in env and BUILD_CORE in ("teensy3", "teensy4"):
env.Replace(
AR="arm-none-eabi-gcc-ar",
RANLIB="$AR"
Expand All @@ -131,7 +139,8 @@
"-felide-constructors",
"-fno-rtti",
"-std=gnu++14",
"-Wno-error=narrowing"
"-Wno-error=narrowing",
"-fpermissive"
],

CPPDEFINES=[
Expand All @@ -152,16 +161,20 @@
LIBS=["m", "stdc++"]
)

if env.BoardConfig().id_ in ("teensy35", "teensy36"):
if env.BoardConfig().id_ in ("teensy35", "teensy36", "teensy40"):
fpv_version = "4-sp"
if env.BoardConfig().id_ == "teensy40":
fpv_version = "5"

env.Append(
CCFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16"
"-mfpu=fpv%s-d16" % fpv_version
],

LINKFLAGS=[
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16"
"-mfpu=fpv%s-d16" % fpv_version
]
)

Expand Down Expand Up @@ -254,13 +267,15 @@
math_lib = math_lib % "M4lf"
elif board in ("teensy30", "teensy31"):
math_lib = math_lib % "M4l"
elif board == "teensy40":
math_lib = math_lib % "M7lfsp"
else:
math_lib = math_lib % "M0l"

env.Prepend(LIBS=[math_lib])

# Teensy 2.x Core
if env.BoardConfig().get("build.core") == "teensy":
if BUILD_CORE == "teensy":
env.Append(CPPPATH=[join(FRAMEWORK_DIR, "cores")])

# search relative includes in teensy directories
Expand All @@ -281,7 +296,7 @@
with open(file_path, "w", encoding="latin-1") as fp:
fp.write(content)
else:
env.Prepend(LIBPATH=[join(FRAMEWORK_DIR, "cores", "teensy3")])
env.Prepend(LIBPATH=[join(FRAMEWORK_DIR, "cores", BUILD_CORE)])

#
# Target: Build Core Library
Expand All @@ -303,7 +318,7 @@

libs.append(env.BuildLibrary(
join("$BUILD_DIR", "FrameworkArduino"),
join(FRAMEWORK_DIR, "cores", env.BoardConfig().get("build.core"))
join(FRAMEWORK_DIR, "cores", BUILD_CORE)
))

env.Prepend(LIBS=libs)
3 changes: 2 additions & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
if not env.get("PIOFRAMEWORK"):
env.SConscript("frameworks/_bare_avr.py")

elif "BOARD" in env and board_config.get("build.core") == "teensy3":
elif "BOARD" in env and board_config.get("build.core") in ("teensy3", "teensy4"):
env.Replace(
AR="arm-none-eabi-ar",
AS="arm-none-eabi-as",
Expand Down Expand Up @@ -138,6 +138,7 @@

target_elf = None
if "nobuild" in COMMAND_LINE_TARGETS:
target_elf = join("$BUILD_DIR", "${PROGNAME}.elf")
target_firm = join("$BUILD_DIR", "${PROGNAME}.hex")
else:
target_elf = env.BuildProgram()
Expand Down
5 changes: 5 additions & 0 deletions examples/arduino-blink/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ board = teensy35
platform = teensy
framework = arduino
board = teensy36

[env:teensy40]
platform = teensy
framework = arduino
board = teensy40
5 changes: 5 additions & 0 deletions examples/arduino-internal-libs/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ board = teensy35
platform = teensy
framework = arduino
board = teensy36

[env:teensy40]
platform = teensy
framework = arduino
board = teensy40
6 changes: 3 additions & 3 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-teensy.git"
},
"version": "4.3.0",
"version": "4.4.0",
"packageRepositories": [
"https://dl.bintray.com/platformio/dl-packages/manifest.json",
"http://dl.platformio.org/packages/manifest.json"
Expand Down Expand Up @@ -41,12 +41,12 @@
"framework-arduinoteensy": {
"type": "framework",
"optional": true,
"version": "~1.145.0"
"version": "~1.147.0"
},
"framework-mbed": {
"type": "framework",
"optional": true,
"version": "~5.51203.190509"
"version": "~5.51203.0"
},
"tool-teensy": {
"type": "uploader",
Expand Down

0 comments on commit b873ddf

Please sign in to comment.