From 472c5ca44133549d4398a96b1396d91749a454da Mon Sep 17 00:00:00 2001 From: valeros Date: Thu, 3 Jun 2021 16:36:02 +0300 Subject: [PATCH 1/7] Do not use the standard system startup files for SPL // Resolve #524 --- builder/frameworks/spl.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/builder/frameworks/spl.py b/builder/frameworks/spl.py index f5b8f39e..4348d9f8 100644 --- a/builder/frameworks/spl.py +++ b/builder/frameworks/spl.py @@ -62,9 +62,9 @@ def get_linker_script(mcu): with open(template_file) as fp: data = Template(fp.read()) content = data.substitute( - stack=hex(0x20000000 + ram), # 0x20000000 - start address for RAM - ram=str(int(ram/1024)) + "K", - flash=str(int(flash/1024)) + "K" + stack=hex(0x20000000 + ram), # 0x20000000 - start address for RAM + ram=str(int(ram / 1024)) + "K", + flash=str(int(flash / 1024)) + "K" ) with open(default_ldscript, "w") as fp: @@ -72,6 +72,7 @@ def get_linker_script(mcu): return default_ldscript + env.Append( CPPPATH=[ join(FRAMEWORK_DIR, board.get("build.core"), @@ -82,6 +83,9 @@ def get_linker_script(mcu): "variants", board.get("build.mcu")[0:7], "inc"), join(FRAMEWORK_DIR, board.get("build.core"), "spl", "variants", board.get("build.mcu")[0:7], "src") + ], + LINKFLAGS=[ + "-nostartfiles" ] ) From f7f9ae6625d2102fa8050a54b99ceaaea449d7d3 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 7 Jun 2021 15:08:55 +0300 Subject: [PATCH 2/7] Properly handle possible foreign files for STM32Cube // Resolve #531 --- builder/frameworks/stm32cube.py | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/builder/frameworks/stm32cube.py b/builder/frameworks/stm32cube.py index 267e06e8..22407e6e 100644 --- a/builder/frameworks/stm32cube.py +++ b/builder/frameworks/stm32cube.py @@ -137,6 +137,8 @@ def generate_hal_config_file(): def build_custom_lib(lib_path, lib_manifest=None): + if not os.path.isdir(lib_path): + return if board.get("build.stm32cube.disable_embedded_libs", "no") == "yes": return if lib_path: @@ -255,8 +257,9 @@ def build_usb_libs(usb_libs_root): bsp_dir = os.path.join(FRAMEWORK_DIR, "Drivers", "BSP") components_dir = os.path.join(bsp_dir, "Components") -for component in os.listdir(components_dir): - build_custom_lib(os.path.join(components_dir, component)) +if os.path.isdir(components_dir): + for component in os.listdir(components_dir): + build_custom_lib(os.path.join(components_dir, component)) if os.path.isdir(os.path.join(bsp_dir, "Adafruit_Shield")): build_custom_lib(os.path.join(bsp_dir, "Adafruit_Shield")) @@ -266,19 +269,25 @@ def build_usb_libs(usb_libs_root): # utils_dir = os.path.join(FRAMEWORK_DIR, "Utilities") -for util in os.listdir(utils_dir): - util_dir = os.path.join(utils_dir, util) - # Some of utilities is not meant to be built - if not any(f.endswith((".c", ".h")) for f in os.listdir(util_dir)): - continue - build_custom_lib( - os.path.join(utils_dir, util), - { - "name": "Util-%s" % util, - "dependencies": [{"name": "FrameworkVariantBSP"}], - "build": {"flags": ["-I $PROJECT_SRC_DIR", "-I $PROJECT_INCLUDE_DIR"], "libLDFMode": "deep"}, - }, - ) +if os.path.isdir(utils_dir): + for util in os.listdir(utils_dir): + util_dir = os.path.join(utils_dir, util) + # Some of utilities is not meant to be built + if not os.path.isdir(util_dir) or not any( + f.endswith((".c", ".h")) for f in os.listdir(util_dir) + ): + continue + build_custom_lib( + os.path.join(utils_dir, util), + { + "name": "Util-%s" % util, + "dependencies": [{"name": "FrameworkVariantBSP"}], + "build": { + "flags": ["-I $PROJECT_SRC_DIR", "-I $PROJECT_INCLUDE_DIR"], + "libLDFMode": "deep", + }, + }, + ) # # USB libraries from ST From 62cae8a55ccb48ed06bc2edc87ca25f9350399c9 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 7 Jun 2021 15:47:00 +0300 Subject: [PATCH 3/7] Sync libOpenCM3 build script --- builder/frameworks/libopencm3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/frameworks/libopencm3 b/builder/frameworks/libopencm3 index c5bf0215..462313f5 160000 --- a/builder/frameworks/libopencm3 +++ b/builder/frameworks/libopencm3 @@ -1 +1 @@ -Subproject commit c5bf02154273cf2f6b45ddf393480db55b965bb1 +Subproject commit 462313f515386fbfd2dbed094f3b9de776413bba From 38e325b59c165c954f6f69c70e0299d36f3b9225 Mon Sep 17 00:00:00 2001 From: valeros Date: Mon, 21 Jun 2021 23:58:12 +0300 Subject: [PATCH 4/7] Sync RAM sizes for Arduino-enabled L4-based boards // Resolve #537 STM32L4 targets may have several separate blocks of SRAM, for example STM32L476RGT6 has two blocks (96KB + 32KB) To properly configure Arduino framework we need pass the size of the first bank SRAM1 via the LD_MAX_DATA_SIZE define. --- boards/disco_l475vg_iot01a.json | 2 +- boards/nucleo_l452re.json | 4 ++-- boards/nucleo_l476rg.json | 2 +- boards/nucleo_l496zg.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boards/disco_l475vg_iot01a.json b/boards/disco_l475vg_iot01a.json index 67d3c5c5..d84d1729 100644 --- a/boards/disco_l475vg_iot01a.json +++ b/boards/disco_l475vg_iot01a.json @@ -40,7 +40,7 @@ ], "name": "ST B-L475E-IOT01A Discovery kit", "upload": { - "maximum_ram_size": 131072, + "maximum_ram_size": 98304, "maximum_size": 1048576, "protocol": "stlink", "protocols": [ diff --git a/boards/nucleo_l452re.json b/boards/nucleo_l452re.json index 96ce83c5..d7f9b7a5 100644 --- a/boards/nucleo_l452re.json +++ b/boards/nucleo_l452re.json @@ -31,8 +31,8 @@ ], "name": "ST Nucleo L452RE", "upload": { - "maximum_ram_size": 65536, - "maximum_size": 262144, + "maximum_ram_size": 163840, + "maximum_size": 524288, "protocol": "stlink", "protocols": [ "jlink", diff --git a/boards/nucleo_l476rg.json b/boards/nucleo_l476rg.json index 8b2fa1fb..d1f1078f 100644 --- a/boards/nucleo_l476rg.json +++ b/boards/nucleo_l476rg.json @@ -33,7 +33,7 @@ ], "name": "ST Nucleo L476RG", "upload": { - "maximum_ram_size": 131072, + "maximum_ram_size": 98304, "maximum_size": 1048576, "protocol": "stlink", "protocols": [ diff --git a/boards/nucleo_l496zg.json b/boards/nucleo_l496zg.json index ef5590d1..f7809c69 100644 --- a/boards/nucleo_l496zg.json +++ b/boards/nucleo_l496zg.json @@ -33,7 +33,7 @@ ], "name": "ST Nucleo L496ZG", "upload": { - "maximum_ram_size": 131072, + "maximum_ram_size": 327680, "maximum_size": 1048576, "protocol": "stlink", "protocols": [ From 4863d896653539f8d8fb188f0d5a0f5551775c5c Mon Sep 17 00:00:00 2001 From: valeros Date: Thu, 24 Jun 2021 21:09:39 +0300 Subject: [PATCH 5/7] Fix OpenOCD target for vccgnd_f407zg_mini Resolve #535 --- boards/vccgnd_f407zg_mini.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/vccgnd_f407zg_mini.json b/boards/vccgnd_f407zg_mini.json index 500b7b36..fdc08186 100644 --- a/boards/vccgnd_f407zg_mini.json +++ b/boards/vccgnd_f407zg_mini.json @@ -13,7 +13,7 @@ }, "debug": { "jlink_device": "STM32F407ZG", - "openocd_target": "stm32f1x", + "openocd_target": "stm32f4x", "svd_path": "STM32F407xx.svd" }, "frameworks": [ From e37e1e090f9929eaff9bf0d5fc5ebbb4942fbdbd Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 29 Jun 2021 19:51:57 +0300 Subject: [PATCH 6/7] Add default safe empty value for the debug_speed options --- builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/main.py b/builder/main.py index e36e5246..26458c37 100644 --- a/builder/main.py +++ b/builder/main.py @@ -305,7 +305,7 @@ def __configure_upload_port(env): ] openocd_args.extend( debug_tools.get(upload_protocol).get("server").get("arguments", [])) - if env.GetProjectOption("debug_speed"): + if env.GetProjectOption("debug_speed", ""): openocd_args.extend( ["-c", "adapter speed %s" % env.GetProjectOption("debug_speed")] ) From 7340c3e012c2d9bb70f87349416c347cfef06486 Mon Sep 17 00:00:00 2001 From: valeros Date: Tue, 29 Jun 2021 19:56:09 +0300 Subject: [PATCH 7/7] Bump version to 14.0.1 --- platform.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform.json b/platform.json index d16c2b69..0c60ae45 100644 --- a/platform.json +++ b/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/platformio/platform-ststm32.git" }, - "version": "14.0.0", + "version": "14.0.1", "frameworks": { "mbed": { "package": "framework-mbed",