Skip to content

Commit

Permalink
Merge branch 'release/v12.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Mar 29, 2021
2 parents bc50032 + bdb0978 commit c56c978
Show file tree
Hide file tree
Showing 31 changed files with 751 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
- "examples/arduino-blink"
- "examples/arduino-external-libs"
- "examples/arduino-internal-libs"
- "examples/arduino-mbed-doom"
- "examples/arduino-mbed-rpc"
- "examples/arduino-mxchip-azureiot"
- "examples/arduino-mxchip-filesystem"
- "examples/arduino-mxchip-sensors"
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "builder/frameworks/libopencm3"]
path = builder/frameworks/libopencm3
url = https://github.com/platformio/builder-framework-libopencm3.git
[submodule "builder/frameworks/arduino/mbed-core"]
path = builder/frameworks/arduino/mbed-core
url = https://github.com/platformio/builder-framework-arduino-core-mbed.git
4 changes: 2 additions & 2 deletions boards/genericSTM32F407VGT6.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"stm32cube",
"libopencm3"
],
"name": "STM32F407VG (192k RAM. 1024k Flash)",
"name": "STM32F407VG (128k RAM. 1024k Flash)",
"upload": {
"disable_flushing": false,
"maximum_ram_size": 196608,
"maximum_ram_size": 131072,
"maximum_size": 1048576,
"protocol": "stlink",
"protocols": [
Expand Down
2 changes: 1 addition & 1 deletion boards/nucleo_f413zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"openocd_board": "st_nucleo_f4",
"openocd_target": "stm32f4x",
"svd_path": "STM32F41x.svd"
"svd_path": "STM32F413.svd"
},
"frameworks": [
"cmsis",
Expand Down
9 changes: 8 additions & 1 deletion boards/nucleo_g071rb.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"variant": "NUCLEO_G071RB"
},
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G071RB",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g0x",
"svd_path": "STM32G071.svd"
},
Expand All @@ -27,8 +33,9 @@
"upload": {
"maximum_ram_size": 36864,
"maximum_size": 131072,
"protocol": "mbed",
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
Expand Down
9 changes: 8 additions & 1 deletion boards/nucleo_g431kb.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G431KB",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g4x",
"svd_path": "STM32G431xx.svd"
},
Expand All @@ -26,8 +32,9 @@
"upload": {
"maximum_ram_size": 32768,
"maximum_size": 131072,
"protocol": "mbed",
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
Expand Down
9 changes: 8 additions & 1 deletion boards/nucleo_g431rb.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G431RB",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g4x",
"svd_path": "STM32G431xx.svd"
},
Expand All @@ -27,8 +33,9 @@
"upload": {
"maximum_ram_size": 32768,
"maximum_size": 131072,
"protocol": "mbed",
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
Expand Down
9 changes: 8 additions & 1 deletion boards/nucleo_g474re.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"can"
],
"debug": {
"default_tools": [
"stlink"
],
"jlink_device": "STM32G474RE",
"onboard_tools": [
"stlink"
],
"openocd_target": "stm32g4x",
"svd_path": "STM32G474xx.svd"
},
Expand All @@ -28,8 +34,9 @@
"upload": {
"maximum_ram_size": 131072,
"maximum_size": 524288,
"protocol": "mbed",
"protocol": "stlink",
"protocols": [
"stlink",
"jlink",
"cmsis-dap",
"blackmagic",
Expand Down
58 changes: 58 additions & 0 deletions boards/portenta_h7_m4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"build": {
"arduino":{
"ldscript": "linker_script.ld"
},
"extra_flags": "-DARDUINO_PORTENTA_H7_M4",
"core": "arduino",
"cpu": "cortex-m4",
"f_cpu": "480000000L",
"mcu": "stm32h747xih6",
"variant": "PORTENTA_H7_M4",
"product_line": "STM32H747xx",
"hwids": [
[
"0x2341",
"0x035b"
],
[
"0x2341",
"0x025b"
],
[
"0x2341",
"0x045b"
]
]
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"jlink_device": "STM32H747XI_M4",
"openocd_target": "stm32h7x_dual_bank"
},
"frameworks": [
"arduino"
],
"name": "Arduino Portenta H7 (M4 core)",
"upload": {
"maximum_ram_size": 294248,
"maximum_size": 1048576,
"protocol": "dfu",
"protocols": [
"cmsis-dap",
"dfu",
"jlink",
"stlink",
"mbed"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"offset_address": "0x08100000"
},
"url": "https://www.arduino.cc/pro/hardware/product/portenta-h7",
"vendor": "Arduino"
}
58 changes: 58 additions & 0 deletions boards/portenta_h7_m7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"build": {
"arduino":{
"ldscript": "linker_script.ld"
},
"extra_flags": "-DARDUINO_PORTENTA_H7_M7",
"core": "arduino",
"cpu": "cortex-m7",
"f_cpu": "480000000L",
"mcu": "stm32h747xih6",
"variant": "PORTENTA_H7_M7",
"product_line": "STM32H747xx",
"hwids": [
[
"0x2341",
"0x035b"
],
[
"0x2341",
"0x025b"
],
[
"0x2341",
"0x045b"
]
]
},
"connectivity": [
"bluetooth",
"wifi"
],
"debug": {
"jlink_device": "STM32H747XI_M7",
"openocd_target": "stm32h7x_dual_bank"
},
"frameworks": [
"arduino"
],
"name": "Arduino Portenta H7 (M7 core)",
"upload": {
"maximum_ram_size": 523624,
"maximum_size": 786432,
"protocol": "dfu",
"protocols": [
"cmsis-dap",
"dfu",
"jlink",
"stlink",
"mbed"
],
"require_upload_port": true,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"offset_address": "0x08040000"
},
"url": "https://www.arduino.cc/pro/hardware/product/portenta-h7",
"vendor": "Arduino"
}
1 change: 1 addition & 0 deletions builder/frameworks/arduino/mbed-core
Submodule mbed-core added at 67dcd5
31 changes: 16 additions & 15 deletions builder/frameworks/stm32cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,23 @@ def generate_hal_config_file():
"Inc",
)

if os.path.isfile(os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h")):
return
conf_h_path = os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h")
template_h_path = os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h")

if not os.path.isfile(
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h")
):
sys.stderr.write(
"Error: Cannot find peripheral template file to configure framework!\n"
)
env.Exit(1)
if board.get("build.stm32cube.custom_config_header", "no") == "yes":
if os.path.isfile(conf_h_path):
os.remove(conf_h_path)
else:
if os.path.isfile(conf_h_path):
return

shutil.copy(
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf_template.h"),
os.path.join(config_path, MCU_FAMILY + "xx_hal_conf.h"),
)
if not os.path.isfile(template_h_path):
sys.stderr.write(
"Error: Cannot find peripheral template file to configure framework!\n"
)
env.Exit(1)

shutil.copy(template_h_path, conf_h_path)


def build_custom_lib(lib_path, lib_manifest=None):
Expand Down Expand Up @@ -316,8 +318,7 @@ def build_usb_libs(usb_libs_root):
#

# Generate a default stm32xxx_hal_conf.h
if board.get("build.stm32cube.custom_config_header", "no") == "no":
generate_hal_config_file()
generate_hal_config_file()

env.BuildSources(
os.path.join("$BUILD_DIR", "FrameworkHALDriver"),
Expand Down
67 changes: 48 additions & 19 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,27 @@
from SCons.Script import (ARGUMENTS, COMMAND_LINE_TARGETS, AlwaysBuild,
Builder, Default, DefaultEnvironment)

from platformio.util import get_serial_ports


def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
env.AutodetectUploadPort()

upload_options = {}
if "BOARD" in env:
upload_options = env.BoardConfig().get("upload", {})

if not bool(upload_options.get("disable_flushing", False)):
env.FlushSerialBuffer("$UPLOAD_PORT")

before_ports = get_serial_ports()

if bool(upload_options.get("use_1200bps_touch", False)):
env.TouchSerialPort("$UPLOAD_PORT", 1200)

if bool(upload_options.get("wait_for_upload_port", False)):
env.Replace(UPLOAD_PORT=env.WaitForNewSerialPort(before_ports))


env = DefaultEnvironment()
env.SConscript("compat.py", exports="env")
Expand Down Expand Up @@ -98,6 +119,7 @@
else:
target_elf = env.BuildProgram()
target_firm = env.ElfToBin(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 @@ -197,25 +219,32 @@ def _jlink_cmd_script(env, source):

upload_actions = [env.VerboseAction("$UPLOADCMD", "Uploading $SOURCE")]

if board.get("build.mcu").startswith("stm32f103") and "arduino" in env.get(
"PIOFRAMEWORK"):
# F103 series doesn't have embedded DFU over USB
# stm32duino bootloader (v1, v2) is used instead
def __configure_upload_port(env):
return basename(env.subst("$UPLOAD_PORT"))

_upload_tool = "maple_upload"
_upload_flags = [
"${__configure_upload_port(__env__)}",
board.get("upload.boot_version", 2),
"%s:%s" % (vid[2:], pid[2:])
]

env.Replace(__configure_upload_port=__configure_upload_port)

upload_actions.insert(
0, env.VerboseAction(env.AutodetectUploadPort,
"Looking for upload port..."))
if "arduino" in env.get("PIOFRAMEWORK"):
if env.subst("$BOARD").startswith("portenta"):
upload_actions.insert(
0,
env.VerboseAction(
env.AutodetectUploadPort, "Looking for upload port..."
),
)
elif board.get("build.mcu").startswith("stm32f103"):
# F103 series doesn't have embedded DFU over USB
# stm32duino bootloader (v1, v2) is used instead
def __configure_upload_port(env):
return basename(env.subst("$UPLOAD_PORT"))

_upload_tool = "maple_upload"
_upload_flags = [
"${__configure_upload_port(__env__)}",
board.get("upload.boot_version", 2),
"%s:%s" % (vid[2:], pid[2:])
]

env.Replace(__configure_upload_port=__configure_upload_port)

upload_actions.insert(
0, env.VerboseAction(env.AutodetectUploadPort,
"Looking for upload port..."))

if "dfu-util" in _upload_tool:
# Add special DFU header to the binary image
Expand Down
1 change: 1 addition & 0 deletions examples/arduino-mbed-doom/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.pio
Loading

0 comments on commit c56c978

Please sign in to comment.