Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Mar 16, 2022
2 parents 9547acb + ffc269a commit 8ef971e
Show file tree
Hide file tree
Showing 21 changed files with 404 additions and 383 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, windows-latest, macos-latest]
os: [ubuntu-18.04, windows-latest, macos-latest]
python-version: [3.7]
example:
- "examples/arduino-adc"
Expand Down
27 changes: 27 additions & 0 deletions boards/cubecell_board_pro.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"build": {
"arduino": {
"lorawan": {
"class": "CLASS_B"
}
},
"core": "asr6601",
"cpu": "cortex-m4",
"extra_flags": "-DCubeCell_BoardPRO",
"f_cpu": "48000000L",
"mcu": "asr6601",
"variant": "CubeCell-Board-PRO"
},
"frameworks": [
"arduino"
],
"name": "Heltec CubeCell-Board PRO (HTCC-AB03)",
"upload": {
"maximum_ram_size": 229376,
"maximum_size": 229376,
"protocol": "serial",
"require_upload_port": true
},
"url": "https://heltec.org/proudct_center",
"vendor": "Heltec"
}
2 changes: 1 addition & 1 deletion boards/cubecell_capsule_solar_sensor.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cpu": "cortex-m0plus",
"extra_flags": "-DCubeCell_Capsule",
"f_cpu": "48000000L",
"mcu": "asr6502",
"mcu": "asr6051",
"variant": "CubeCell-Capsule"
},
"frameworks": [
Expand Down
190 changes: 114 additions & 76 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,28 @@
platform = env.PioPlatform()
board = env.BoardConfig()
core = board.get("build.core")
mcu = board.get("build.mcu", "")
is_asr6601 = mcu.startswith("asr6601")
arch = "asr6601" if is_asr6601 else "asr650x"

FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoasrmicro650x")
FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoasrmicro")
CORE_DIR = os.path.join(FRAMEWORK_DIR, "cores", core)
assert os.path.isdir(FRAMEWORK_DIR)

env.Append(
CPPDEFINES=[
("ARDUINO", 10813),
"ARDUINO_ARCH_ASR650X",
"__%s__" % board.get("build.mcu").upper(),
"__asr650x__",
("ARDUINO", 10815),
"ARDUINO_ARCH_%s" % arch.upper(),
"__%s__" % mcu.upper(),
"__%s__" % arch,
("CONFIG_MANUFACTURER", '\\"ASR\\"'),
("CONFIG_DEVICE_MODEL", '\\"6501\\"'),
("CONFIG_DEVICE_MODEL", '\\"%s\\"' % mcu),
("CONFIG_VERSION", '\\"v4.0\\"'),
("CY_CORE_ID", 0),
"CONFIG_LORA_USE_TCXO",
("F_CPU", "$BOARD_F_CPU"),
"SOFT_SE",
],

CCFLAGS=[
"-w",
"-Wall",
Expand All @@ -68,12 +71,10 @@
"-fno-builtin-snprintf",
"-Wno-strict-aliasing",
],

CXXFLAGS=[
"-fno-exceptions",
"-fno-rtti",
],

LINKFLAGS=[
"-Os",
"-Wl,--gc-sections",
Expand All @@ -85,53 +86,74 @@
"-mthumb",
"-mthumb-interwork",
"-specs=nano.specs",
"-ffat-lto-objects"
],

CPPPATH=[
os.path.join(FRAMEWORK_DIR, "cores", core),
os.path.join(FRAMEWORK_DIR, "cores", core, "board"),
os.path.join(FRAMEWORK_DIR, "cores", core, "board", "src"),
os.path.join(FRAMEWORK_DIR, "cores", core, "board", "inc"),
os.path.join(FRAMEWORK_DIR, "cores", core, "device", "sx126x"),
os.path.join(FRAMEWORK_DIR, "cores", core, "lora"),
os.path.join(FRAMEWORK_DIR, "cores", core, "lora", "radio"),
os.path.join(FRAMEWORK_DIR, "cores", core, "lora", "system"),
os.path.join(FRAMEWORK_DIR, "cores", core, "lora", "system", "crypto"),
os.path.join(FRAMEWORK_DIR, "cores", core, "port"),
os.path.join(FRAMEWORK_DIR, "cores", core, "port", "include"),
os.path.join(FRAMEWORK_DIR, "cores", core, "projects"),
os.path.join(FRAMEWORK_DIR, "cores", core, "projects", "PSoC4"),
os.path.join(FRAMEWORK_DIR, "cores", core, "cores"),
os.path.join(FRAMEWORK_DIR, "cores", core, "Serial"),
os.path.join(FRAMEWORK_DIR, "cores", core, "Wire"),
os.path.join(FRAMEWORK_DIR, "cores", core, "SPI"),
],

LIBS=[
"stdc++",
"m"
"-specs=nosys.specs",
"-ffat-lto-objects",
],

LIBSOURCE_DIRS=[
os.path.join(FRAMEWORK_DIR, "libraries")
]
LIBS=["stdc++", "m"],
LIBSOURCE_DIRS=[os.path.join(FRAMEWORK_DIR, "libraries")],
)

env.Prepend(
ASFLAGS=env.get("CCFLAGS", [])[:],
_LIBFLAGS='"%s" ' % os.path.join(
FRAMEWORK_DIR, "cores", core, "projects", "CubeCellLib.a")
_LIBFLAGS='"%s" '
% (
os.path.join(CORE_DIR, "asr6601.a")
if is_asr6601
else os.path.join(CORE_DIR, "projects", "CubeCellLib.a")
),
)

if is_asr6601:
env.Append(
CPPPATH=[
CORE_DIR,
os.path.join(CORE_DIR, "drivers", "peripheral", "inc"),
os.path.join(CORE_DIR, "drivers", "crypto", "inc"),
os.path.join(CORE_DIR, "platform", "CMSIS"),
os.path.join(CORE_DIR, "platform", "system"),
os.path.join(CORE_DIR, "lora", "driver"),
os.path.join(CORE_DIR, "lora", "radio"),
os.path.join(CORE_DIR, "lora"),
os.path.join(CORE_DIR, "lora", "radio", "sx126x"),
os.path.join(CORE_DIR, "lora", "system"),
os.path.join(CORE_DIR, "lora", "system", "crypto"),
os.path.join(CORE_DIR, "base"),
os.path.join(CORE_DIR, "peripheral"),
],
)
else:
env.Append(
CPPPATH=[
CORE_DIR,
os.path.join(CORE_DIR, "board"),
os.path.join(CORE_DIR, "board", "src"),
os.path.join(CORE_DIR, "board", "inc"),
os.path.join(CORE_DIR, "device", "sx126x"),
os.path.join(CORE_DIR, "lora"),
os.path.join(CORE_DIR, "lora", "system"),
os.path.join(CORE_DIR, "lora", "system", "crypto"),
os.path.join(CORE_DIR, "port"),
os.path.join(CORE_DIR, "port", "include"),
os.path.join(CORE_DIR, "projects"),
os.path.join(CORE_DIR, "projects", "PSoC4"),
os.path.join(CORE_DIR, "cores"),
os.path.join(CORE_DIR, "Serial"),
os.path.join(CORE_DIR, "Wire"),
os.path.join(CORE_DIR, "SPI"),
],
)


if not board.get("build.ldscript", ""):
env.Append(
LIBPATH=[
os.path.join(FRAMEWORK_DIR, "cores", core, "projects", "PSoC4"),
CORE_DIR if is_asr6601 else os.path.join(CORE_DIR, "projects", "PSoC4"),
]
)
env.Replace(
LDSCRIPT_PATH=board.get("build.arduino.ldscript", "cm0plusgcc.ld")
LDSCRIPT_PATH=board.get(
"build.arduino.ldscript", "gcc.ld" if is_asr6601 else "cm0plusgcc.ld"
)
)

#
Expand All @@ -147,19 +169,32 @@
"REGION_%s" % region,
("ACTIVE_REGION", "LORAMAC_REGION_%s" % region),
("LORAWAN_CLASS", lorawan_config.get("class", "CLASS_A")),
("LORAWAN_NETMODE", "true" if lorawan_config.get(
"netmode", "OTAA") == "OTAA" else "false"),
(
"LORAWAN_NETMODE",
"true" if lorawan_config.get("netmode", "OTAA") == "OTAA" else "false",
),
("LORAWAN_ADR", "true" if lorawan_config.get("adr", "ON") == "ON" else "false"),
("LORAWAN_UPLINKMODE", "true" if lorawan_config.get(
"uplinkmode", "CONFIRMED") == "CONFIRMED" else "false"),
("LORAWAN_NET_RESERVE", "true" if lorawan_config.get(
"net_reserve", "OFF") == "ON" else "false"),
(
"LORAWAN_UPLINKMODE",
"true"
if lorawan_config.get("uplinkmode", "CONFIRMED") == "CONFIRMED"
else "false",
),
(
"LORAWAN_NET_RESERVE",
"true" if lorawan_config.get("net_reserve", "OFF") == "ON" else "false",
),
("AT_SUPPORT", 1 if lorawan_config.get("at_support", "ON") == "ON" else 0),
("LORAWAN_DEVEUI_AUTO", 0 if lorawan_config.get("deveui", "CUSTOM") == "CUSTOM" else 1),
("LoraWan_RGB", 1 if lorawan_config.get(
"rgb", "ACTIVE") == "ACTIVE" else 0),
("LoRaWAN_DEBUG_LEVEL", 2 if debug_level == "FREQ_AND_DIO" else (
1 if debug_level == "FREQ" else 0))
(
"LORAWAN_DEVEUI_AUTO",
0 if lorawan_config.get("deveui", "CUSTOM") == "CUSTOM" else 1,
),
("LoraWan_RGB", 1 if lorawan_config.get("rgb", "ACTIVE") == "ACTIVE" else 0),
("LORAWAN_PREAMBLE_LENGTH", lorawan_config.get("preamble_length", 8)),
(
"LoRaWAN_DEBUG_LEVEL",
2 if debug_level == "FREQ_AND_DIO" else (1 if debug_level == "FREQ" else 0),
),
]
)

Expand All @@ -169,28 +204,31 @@

libs = []

if "build.variant" in env.BoardConfig():
variants_dir = os.path.join(
"$PROJECT_DIR", board.get("build.variants_dir")) if board.get(
"build.variants_dir", "") else os.path.join(FRAMEWORK_DIR, "variants")
env.Append(
CPPPATH=[
os.path.join(variants_dir, board.get("build.variant"))
]
if "build.variant" in board:
variants_dir = (
os.path.join("$PROJECT_DIR", board.get("build.variants_dir"))
if board.get("build.variants_dir", "")
else os.path.join(FRAMEWORK_DIR, "variants")
)
libs.append(env.BuildLibrary(
os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"),
os.path.join(variants_dir, board.get("build.variant"))
))

libs.append(env.BuildLibrary(
os.path.join("$BUILD_DIR", "FrameworkArduino"),
os.path.join(FRAMEWORK_DIR, "cores", core),
src_filter=[
"+<*>",
"-<projects/PSoC4/CyBootAsmIar.s>",
"-<projects/PSoC4/CyBootAsmRv.s>"
]
))
env.Append(CPPPATH=[os.path.join(variants_dir, board.get("build.variant"))])
libs.append(
env.BuildLibrary(
os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"),
os.path.join(variants_dir, board.get("build.variant")),
)
)

libs.append(
env.BuildLibrary(
os.path.join("$BUILD_DIR", "FrameworkArduino"),
CORE_DIR,
# Only applicable to ASR6501
src_filter=[
"+<*>",
"-<projects/PSoC4/CyBootAsmIar.s>",
"-<projects/PSoC4/CyBootAsmRv.s>",
],
)
)

env.Prepend(LIBS=libs)
Loading

0 comments on commit 8ef971e

Please sign in to comment.