Skip to content

Add support for Teknic ClearCore #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions boards/clearcore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"build": {
"arduino": {
"ldscript": "flash_with_bootloader.ld"
},
"core": "clearcore",
"cpu": "cortex-m4",
"extra_flags": [
"-D __SAME53N19A__",
"-D __SAMD53__",
"-D ARDUINO_ARM_ClearCore",
"-D ARDUINO_ARCH_SAM",
"-D __ARM_FEATURE_DSP=1",
"-D __FPU_PRESENT",
"-D ARM_MATH_CM4",
"-D ENABLE_CACHE",
"-D VARIANT_QSPI_BAUD_DEFAULT=50000000"
],
"f_cpu": "120000000L",
"hwids": [
[
"0x2890",
"0x0022"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this on my hardware and the HWID needs to be adjusted to be 0x2890 0x8022, I think the zero was a typo. Specifying the COM port directly will skip that check and will let it keep working, though

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction, this needs to have BOTH HWID's, not changing the singular one. The bootloader, which can sometimes get stuck searching for an upload, uses the HWID you used. There are cases where PIO will get stuck and not be able to find the COM port when that happens, so both will be needed.

]
],
"mcu": "same53n19a",
"system": "samd",
"usb_product": "Teknic ClearCore",
"variant": "clearcore"
},
"debug": {
"jlink_device": "ATSAME53N19A",
"openocd_chipname": "at91same53n19",
"openocd_target": "atsame5x",
"svd_path": "ATSAME53N19A.svd"
},
"frameworks": [
"arduino"
],
"name": "ClearCore",
"upload": {
"disable_flushing": true,
"maximum_ram_size": 196608,
"maximum_size": 507904,
"native_usb": true,
"offset_address": "0x4000",
"protocol": "sam-ba",
"protocols": [
"sam-ba",
"jlink",
"atmel-ice"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true
},
"url": "https://www.teknic.com",
"vendor": "Teknic"
}
33 changes: 33 additions & 0 deletions builder/frameworks/arduino/arduino-samd.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@
]
)

if VENDOR_CORE == "clearcore":
env.Append(
CPPDEFINES=[
("USB_CONFIG_POWER", board.get("build.usb_power", 0))
],
)

#
# Vendor-specific configurations
#
Expand Down Expand Up @@ -170,6 +177,32 @@
os.path.join(FRAMEWORK_DIR, "cores", BUILD_CORE, "api", "deprecated-avr-comp")
]
)
elif VENDOR_CORE == "clearcore":
env.Prepend(
CPPPATH=[
os.path.join(FRAMEWORK_DIR, "variants", "clearcore", "ThirdParty", "SAME53", "CMSIS", "Device", "Include"),
]
)

env.Append(
CPPPATH=[
os.path.join(FRAMEWORK_DIR, "cores", "arduino", "api"),
os.path.join(FRAMEWORK_DIR, "cores", "arduino"),
os.path.join(FRAMEWORK_DIR, "Teknic", "LwIP", "LwIP", "port", "include"),
os.path.join(FRAMEWORK_DIR, "Teknic", "LwIP", "LwIP", "src", "include"),
os.path.join(FRAMEWORK_DIR, "Teknic", "libClearCore", "inc")
],

LIBPATH=[
os.path.join(FRAMEWORK_DIR, "Teknic", "libClearCore", "Release"),
os.path.join(FRAMEWORK_DIR, "Teknic", "LwIP", "Release")
],

LIBS=[
"ClearCore",
"LwIP"
]
)

#
# Target: Build Core Library
Expand Down
4 changes: 2 additions & 2 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def _jlink_cmd_script(env, source):
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS $SOURCES"
)
if board.get("build.core") in ("adafruit", "seeed", "sparkfun") and board.get(
"build.mcu").startswith(("samd51", "same51")):
if board.get("build.core") in ("adafruit", "seeed", "sparkfun", "clearcore") and board.get(
"build.mcu").startswith(("samd51", "same51", "same53")):
# special flags for the latest bossac tool
env.Append(
UPLOADERFLAGS=[
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 @@ -121,3 +121,8 @@ framework = arduino
platform = atmelsam
board = seeed_wio_lite_mg126
framework = arduino

[env:clearcore]
platform = atmelsam
board = clearcore
framework = arduino
Loading