Skip to content

Commit d89d729

Browse files
committed
Merge branch 'release/v15.1.0'
2 parents 4055fdc + f627ad9 commit d89d729

File tree

95 files changed

+1118
-1527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1118
-1527
lines changed

boards/disco_h735ig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"cpu": "cortex-m7",
44
"extra_flags": "-DSTM32H7xx -DSTM32H735xx",
55
"f_cpu": "550000000L",
6-
"mcu": "stm32h735igk6u",
6+
"mcu": "stm32h735igk6",
77
"product_line": "STM32H735xx",
88
"zephyr": {
99
"variant": "stm32h735g_disco"

boards/nucleo_l552ze_q.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"onboard_tools": [
2020
"stlink"
2121
],
22-
"openocd_board": "st_nucleo_l5.cfg",
22+
"openocd_board": "st_nucleo_l5",
2323
"openocd_target": "stm32l5x",
2424
"svd_path": "STM32L552.svd"
2525
},

boards/olimexino_stm32f3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cpu": "cortex-m3",
55
"extra_flags": "-DSTM32F303xC",
66
"f_cpu": "72000000L",
7-
"mcu": "stm32f303rct6tr",
7+
"mcu": "stm32f303rct6",
88
"variant": "STM32F3xx/F303R(B-C)T",
99
"product_line": "STM32F303xC"
1010
},

boards/prntr_v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"framework_extra_flags": {
88
"arduino": "-DVECT_TAB_OFFSET=0x8000 -DCUSTOM_PERIPHERAL_PINS"
99
},
10-
"mcu": "stm32f407re",
10+
"mcu": "stm32f407vet6",
1111
"product_line": "STM32F407xx",
1212
"variant": "STM32F4xx/F407V(E-G)T_F417V(E-G)T"
1313
},

boards/st3dp001_eval.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"framework_extra_flags": {
88
"arduino": "-DCUSTOM_PERIPHERAL_PINS"
99
},
10-
"mcu": "stm32f401vgt6",
10+
"mcu": "stm32f401vet6",
1111
"product_line": "STM32F401xE",
1212
"variant": "STM32F4xx/F401V(B-C-D-E)T"
1313
},

builder/frameworks/cmsis.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,10 @@ def prepare_startup_file(src_path):
131131
src_filter=[
132132
"-<*>",
133133
"+<%s>" % board.get("build.cmsis.system_file", "system_%sxx.c" % mcu[0:7]),
134-
"+<gcc/startup_%s.S>" % product_line.lower()]
134+
"+<gcc/%s>"
135+
% board.get(
136+
"build.cmsis.startup_file",
137+
"startup_%s.S" % product_line.lower()
138+
)
139+
]
135140
)

builder/frameworks/stm32cube.py

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
http://www.st.com/en/embedded-software/stm32cube-embedded-software.html?querycriteria=productId=LN1897
2323
"""
2424

25-
import glob
2625
import os
2726
import shutil
2827
import string
2928
import sys
29+
import re
3030

31-
from SCons.Script import DefaultEnvironment
31+
from SCons.Script import ARGUMENTS, DefaultEnvironment
3232

3333
from platformio.builder.tools.piolib import PlatformIOLibBuilder
3434

@@ -72,25 +72,50 @@ def generate_ldscript(default_ldscript_path):
7272
fp.write(content)
7373

7474

75-
def get_linker_script(board_mcu):
76-
ldscript_match = glob.glob(
77-
os.path.join(
78-
LDSCRIPTS_DIR, board_mcu[0:7], board_mcu[0:11].upper() + "*_FLASH.ld"
79-
)
80-
)
75+
def get_linker_script(board_mcu, board_cpu):
76+
def _glob_re(pattern, ldscripts):
77+
re_c = re.compile(pattern)
78+
return list(filter(re_c.match, ldscripts))
8179

82-
if ldscript_match and os.path.isfile(ldscript_match[0]):
83-
return ldscript_match[0]
80+
if len(board_mcu) > 12:
81+
board_mcu = board_mcu[:12] + "X" + board_mcu[13:]
8482

85-
default_ldscript = os.path.join(
86-
LDSCRIPTS_DIR, board_mcu[0:7], board_mcu[0:11].upper() + "_DEFAULT.ld"
83+
family_ldscripts_dir = os.path.join(LDSCRIPTS_DIR, board_mcu[0:7])
84+
85+
ldscript_matches = _glob_re(
86+
"^%s.*_FLASH\\.ld$" % board_mcu.upper(),
87+
os.listdir(family_ldscripts_dir),
8788
)
8889

90+
if ldscript_matches:
91+
ldscript_file = ldscript_matches[0]
92+
if len(ldscript_matches) > 1:
93+
# Precise match with the CPU in filename has the highest priority
94+
board_cpu = board_cpu.replace("cortex-", "").upper()
95+
for match in ldscript_matches:
96+
if board_cpu in match:
97+
ldscript_file = match
98+
break
99+
100+
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
101+
print(
102+
"Found suitable linker scripts: ["
103+
+ ", ".join(ldscript_matches)
104+
+ "], %s will be used!" % ldscript_file
105+
)
106+
107+
return os.path.join(family_ldscripts_dir, ldscript_file)
108+
109+
# Fall back to an auto-generated linker script
89110
print(
90111
"Warning! Cannot find a linker script for the required board! "
91112
"An auto-generated script will be used to link firmware!"
92113
)
93114

115+
default_ldscript = os.path.join(
116+
LDSCRIPTS_DIR, board_mcu[0:7], board_mcu[0:11].upper() + "_DEFAULT.ld"
117+
)
118+
94119
if not os.path.isfile(default_ldscript):
95120
generate_ldscript(default_ldscript)
96121

@@ -252,7 +277,7 @@ def process_dsp_lib():
252277
],
253278

254279
LIBPATH=[
255-
os.path.join(FRAMEWORK_DIR, "platformio", "ldscripts"),
280+
os.path.join(LDSCRIPTS_DIR, MCU_FAMILY),
256281
],
257282

258283
LIBS=["c", "gcc", "m", "stdc++", "nosys"],
@@ -262,7 +287,8 @@ def process_dsp_lib():
262287
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])
263288

264289
if not board.get("build.ldscript", ""):
265-
env.Replace(LDSCRIPT_PATH=get_linker_script(board.get("build.mcu", "")))
290+
env.Replace(LDSCRIPT_PATH=get_linker_script(
291+
board.get("build.mcu", ""), board.get("build.cpu", "")))
266292

267293
#
268294
# Process BSP components

examples/arduino-blink/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
How to build PlatformIO based project
2+
=====================================
3+
4+
1. [Install PlatformIO Core](http://docs.platformio.org/page/core.html)
5+
2. Download [development platform with examples](https://github.com/platformio/platform-ststm32/archive/develop.zip)
6+
3. Extract ZIP archive
7+
4. Run these commands:
8+
9+
```shell
10+
# Change directory to example
11+
$ cd platform-ststm32/examples/arduino-blink
12+
13+
# Build project
14+
$ pio run
15+
16+
# Upload firmware
17+
$ pio run --target upload
18+
19+
# Build specific environment
20+
$ pio run -e maple
21+
22+
# Upload firmware for the specific environment
23+
$ pio run -e maple --target upload
24+
25+
# Clean build files
26+
$ pio run --target clean
27+
```

examples/arduino-blink/README.rst

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
How to build PlatformIO based project
2+
=====================================
3+
4+
1. [Install PlatformIO Core](http://docs.platformio.org/page/core.html)
5+
2. Download [development platform with examples](https://github.com/platformio/platform-ststm32/archive/develop.zip)
6+
3. Extract ZIP archive
7+
4. Run these commands:
8+
9+
```shell
10+
# Change directory to example
11+
$ cd platform-ststm32/examples/arduino-external-libs
12+
13+
# Build project
14+
$ pio run
15+
16+
# Upload firmware
17+
$ pio run --target upload
18+
19+
# Build specific environment
20+
$ pio run -e maple
21+
22+
# Upload firmware for the specific environment
23+
$ pio run -e maple --target upload
24+
25+
# Clean build files
26+
$ pio run --target clean
27+
```

0 commit comments

Comments
 (0)