Skip to content

Commit

Permalink
Merge branch 'release/v4.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Jul 26, 2021
2 parents 8491e99 + b1290f7 commit 036581a
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-16.04, windows-latest, macos-latest]
python-version: [2.7, 3.7]
python-version: [3.7]
example:
- "examples/arduino-blink"
- "examples/arduino-hid-usb-mouse"
Expand Down
1 change: 1 addition & 0 deletions boards/teensy40.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"maximum_size": 2031616,
"protocol": "teensy-gui",
"protocols": [
"teensy-cli",
"teensy-gui",
"jlink"
]
Expand Down
1 change: 1 addition & 0 deletions boards/teensy41.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"maximum_size": 8126464,
"protocol": "teensy-gui",
"protocols": [
"teensy-cli",
"teensy-gui",
"jlink"
]
Expand Down
34 changes: 34 additions & 0 deletions boards/teensymm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"build": {
"arduino": {
"ldscript": "imxrt1062_mm.ld"
},
"core": "teensy4",
"cpu": "cortex-m7",
"extra_flags": "-D__IMXRT1062__ -DARDUINO_TEENSY_MICROMOD",
"f_cpu": "600000000",
"mcu": "imxrt1062"
},
"connectivity": [
"can"
],
"debug": {
"jlink_device": "MIMXRT1062xxxxA"
},
"frameworks": [
"arduino"
],
"name": "SparkFun MicroMod Teensy",
"upload": {
"maximum_ram_size": 524288,
"maximum_size": 8126464,
"protocol": "teensy-gui",
"protocols": [
"teensy-cli",
"teensy-gui",
"jlink"
]
},
"url": "https://www.sparkfun.com/products/16402",
"vendor": "SparkFun"
}
40 changes: 30 additions & 10 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
env.Append(CPPDEFINES=["USB_SERIAL"])

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

Expand Down Expand Up @@ -157,8 +157,7 @@
"-Wl,--gc-sections,--relax",
"-mthumb",
"-mcpu=%s" % env.BoardConfig().get("build.cpu"),
"-Wl,--defsym=__rtc_localtime=$UNIX_TIME",
"-fsingle-precision-constant"
"-Wl,--defsym=__rtc_localtime=$UNIX_TIME"
],

LIBS=["m", "stdc++"]
Expand All @@ -167,10 +166,17 @@
if not env.BoardConfig().get("build.ldscript", ""):
env.Replace(LDSCRIPT_PATH=env.BoardConfig().get("build.arduino.ldscript", ""))

if env.BoardConfig().id_ in ("teensy35", "teensy36", "teensy40", "teensy41"):
if env.BoardConfig().id_ in (
"teensy35",
"teensy36",
"teensy40",
"teensy41",
"teensymm",
):
fpv_version = "4-sp"
if env.BoardConfig().id_.startswith("teensy4"):
if env.BoardConfig().id_.startswith(("teensy4", "teensymm")):
fpv_version = "5"
env.Append(CXXFLAGS=["-fno-threadsafe-statics"])

env.Append(
CCFLAGS=[
Expand Down Expand Up @@ -262,24 +268,38 @@
LINKFLAGS=["-O2"]
)

env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)

if "cortex-m" in env.BoardConfig().get("build.cpu", ""):
cpu = env.BoardConfig().get("build.cpu", "")
if "cortex-m" in cpu:
board = env.subst("$BOARD")
math_lib = "arm_cortex%s_math"
if board in ("teensy35", "teensy36"):
math_lib = math_lib % "M4lf"
elif board in ("teensy30", "teensy31"):
math_lib = math_lib % "M4l"
elif board.startswith("teensy4"):
elif board.startswith(("teensy4", "teensymm")):
math_lib = math_lib % "M7lfsp"
else:
math_lib = math_lib % "M0l"

env.Prepend(LIBS=[math_lib])

if cpu.startswith(("cortex-m4", "cortex-m0")):
env.Append(
CCFLAGS=[
"-mno-unaligned-access",
"-fsingle-precision-constant"
],

LINKFLAGS=[
"-fsingle-precision-constant"
]
)

env.Append(
ASFLAGS=env.get("CCFLAGS", [])[:]
)

# Teensy 2.x Core
if BUILD_CORE == "teensy":
env.Append(CPPPATH=[join(FRAMEWORK_DIR, "cores")])
Expand Down
3 changes: 2 additions & 1 deletion builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
else:
target_elf = env.BuildProgram()
target_firm = env.ElfToHex(join("$BUILD_DIR", "${PROGNAME}"), target_elf)
env.Depends(target_firm, "checkprogsize")

AlwaysBuild(env.Alias("nobuild", target_firm))
target_buildprog = env.Alias("buildprog", target_firm, target_firm)
Expand Down Expand Up @@ -188,7 +189,7 @@ def _jlink_cmd_script(env, source):
UPLOADER="JLink.exe" if system() == "Windows" else "JLinkExe",
UPLOADERFLAGS=[
"-device", board_config.get("debug", {}).get("jlink_device"),
"-speed", "4000",
"-speed", env.GetProjectOption("debug_speed", "4000"),
"-if", ("jtag" if upload_protocol == "jlink-jtag" else "swd"),
"-autoconnect", "1",
"-NoGui", "1"
Expand Down
5 changes: 5 additions & 0 deletions examples/arduino-internal-libs/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ board = teensy40
platform = teensy
framework = arduino
board = teensy41

[env:teensymm]
platform = teensy
framework = arduino
board = teensymm
7 changes: 4 additions & 3 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-teensy.git"
},
"version": "4.12.0",
"version": "4.13.0",
"frameworks": {
"arduino": {
"package": "framework-arduinoteensy",
Expand All @@ -35,7 +35,8 @@
"type": "toolchain",
"optional": false,
"owner": "platformio",
"version": "~1.50400.0"
"version": "~1.50400.0",
"optionalVersions": [">=1.60301.0,<1.80000.0"]
},
"toolchain-gccarmnoneeabi": {
"type": "toolchain",
Expand All @@ -47,7 +48,7 @@
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~1.153.0"
"version": "~1.154.0"
},
"framework-mbed": {
"type": "framework",
Expand Down
28 changes: 21 additions & 7 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from platform import system
import copy
import platform

from platformio.managers.platform import PlatformBase

Expand All @@ -30,7 +31,7 @@ def configure_default_packages(self, variables, targets):

if "mbed" in variables.get("pioframework", []):
self.packages["toolchain-gccarmnoneeabi"][
'version'] = ">=1.60301.0,<1.80000.0"
"version"] = ">=1.60301.0,<1.80000.0"

# configure J-LINK tool
jlink_conds = [
Expand Down Expand Up @@ -66,12 +67,12 @@ def _add_default_debug_tools(self, board):
upload_protocols = board.manifest.get("upload", {}).get(
"protocols", [])
if "tools" not in debug:
debug['tools'] = {}
debug["tools"] = {}

if "jlink" in upload_protocols and "jlink" not in debug['tools']:
if "jlink" in upload_protocols and "jlink" not in debug["tools"]:
assert debug.get("jlink_device"), (
"Missed J-Link Device ID for %s" % board.id)
debug['tools']['jlink'] = {
debug["tools"]["jlink"] = {
"server": {
"package": "tool-jlink",
"arguments": [
Expand All @@ -82,10 +83,23 @@ def _add_default_debug_tools(self, board):
"-port", "2331"
],
"executable": ("JLinkGDBServerCL.exe"
if system() == "Windows" else
if platform.system() == "Windows" else
"JLinkGDBServer")
}
}

board.manifest['debug'] = debug
board.manifest["debug"] = debug
return board

def configure_debug_options(self, initial_debug_options, ide_data):
debug_options = copy.deepcopy(initial_debug_options)
adapter_speed = initial_debug_options.get("speed")
if adapter_speed:
server_options = debug_options.get("server") or {}
server_executable = server_options.get("executable", "").lower()
if "jlink" in server_executable:
debug_options["server"]["arguments"].extend(
["-speed", adapter_speed]
)

return debug_options

0 comments on commit 036581a

Please sign in to comment.