Skip to content

Commit ee513f2

Browse files
committed
Merge branch 'release/v4.3.0'
2 parents ba4bcd7 + 171c2f2 commit ee513f2

22 files changed

Lines changed: 140 additions & 56 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ env:
2525
- PLATFORMIO_PROJECT_DIR=examples/spl-blink
2626
- PLATFORMIO_PROJECT_DIR=examples/stm32cube-hal-blink
2727
- PLATFORMIO_PROJECT_DIR=examples/stm32cube-ll-blink
28+
- PLATFORMIO_PROJECT_DIR=tests/mbed-filesystem
2829

2930
install:
3031
- pip install -U https://github.com/platformio/platformio/archive/develop.zip

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ environment:
2424
- PLATFORMIO_PROJECT_DIR: "examples/spl-blink"
2525
- PLATFORMIO_PROJECT_DIR: "examples/stm32cube-hal-blink"
2626
- PLATFORMIO_PROJECT_DIR: "examples/stm32cube-ll-blink"
27+
- PLATFORMIO_PROJECT_DIR: "tests/mbed-filesystem"
2728

2829
install:
2930
- cmd: git submodule update --init --recursive

boards/disco_f407vg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"svd_path": "STM32F40x.svd"
2121
},
2222
"frameworks": [
23+
"arduino",
2324
"mbed",
2425
"cmsis",
2526
"spl",

boards/genericSTM32F407VET6.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
"build": {
33
"core": "stm32",
44
"cpu": "cortex-m4",
5-
"extra_flags": "-mthumb -DSTM32F4 -DSTM32_HIGH_DENSITY",
5+
"extra_flags": "-DSTM32F407xx",
66
"f_cpu": "168000000L",
77
"hwids": [
8+
[
9+
"0x1EAF",
10+
"0x0003"
11+
],
812
[
913
"0x0483",
1014
"0x3748"
1115
]
1216
],
13-
"ldscript": "jtag.ld",
17+
"ldscript": "stm32f407xe.ld",
1418
"mcu": "stm32f407vet6",
1519
"variant": "stm32f4"
1620
},
@@ -37,16 +41,22 @@
3741
}
3842
},
3943
"frameworks": [
40-
"arduino"
44+
"arduino",
45+
"stm32cube"
4146
],
4247
"name": "STM32F407VE (192k RAM. 512k Flash)",
4348
"upload": {
49+
"disable_flushing": false,
4450
"maximum_ram_size": 131072,
4551
"maximum_size": 514288,
4652
"protocol": "stlink",
4753
"protocols": [
48-
"stlink"
49-
]
54+
"stlink",
55+
"dfu"
56+
],
57+
"require_upload_port": true,
58+
"use_1200bps_touch": false,
59+
"wait_for_upload_port": false
5060
},
5161
"url": "http://www.st.com/en/microcontrollers/stm32f407ve.html",
5262
"vendor": "Generic"

builder/frameworks/arduino/maple/stm32f4.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,48 +35,53 @@
3535
assert isdir(FRAMEWORK_DIR)
3636

3737
# default configuration values
38+
vector = int(board.get("build.vec_tab_addr", "0x8000000"), 16)
3839
error_led_port = "GPIOA"
3940
error_led_pin = 7
41+
ldscript = "jtag.ld"
42+
board_type = "discovery_f4"
4043

4144
# remap board configuration values
4245
mcu_type = board.get("build.mcu")[:-2]
43-
if "stm32f407ve" in mcu_type:
44-
ldscript = "jtag.ld"
46+
if "f407ve" in mcu_type:
4547
variant = "generic_f407v"
46-
48+
board_type = "generic_f407v"
49+
elif "f407vg" in mcu_type:
50+
error_led_port = "GPIOD"
51+
error_led_pin = 14
52+
variant = "discovery_f407"
4753

4854
# upload related configuration remap
49-
# for all generic boards
5055
upload_protocol = env.subst("$UPLOAD_PROTOCOL")
5156

57+
if upload_protocol == "dfu":
58+
vector = 0x8004000
59+
if "f407v" in mcu_type:
60+
ldscript = "bootloader_8004000.ld"
61+
5262
env.Append(
53-
CFLAGS=[
54-
"-std=gnu11"
55-
],
63+
CFLAGS=["-std=gnu11"],
64+
65+
CXXFLAGS=["-std=gnu++11"],
5666

5767
CCFLAGS=[
5868
"-MMD",
59-
"--param",
60-
"max-inline-insns-single=500"
61-
],
62-
63-
CXXFLAGS=[
64-
"-std=gnu++11"
69+
"--param", "max-inline-insns-single=500",
6570
],
6671

6772
CPPDEFINES=[
6873
("DEBUG_LEVEL", "DEBUG_NONE"),
69-
("BOARD_%s" % variant),
74+
("BOARD_%s" % board_type),
7075
("ERROR_LED_PORT", error_led_port),
7176
("ERROR_LED_PIN", error_led_pin),
7277
("ARDUINO", 10610),
7378
("ARDUINO_%s" % variant.upper()),
7479
("ARDUINO_ARCH_STM32F4"),
7580
("VECT_TAB_FLASH"),
76-
("USER_ADDR_ROM=0x08000000"),
81+
("USER_ADDR_ROM", vector),
7782
("__STM32F4__"),
78-
("MCU_%s" % mcu_type.upper()),
79-
("SERIAL_USB") # this is so that usb serial is connected when the board boots, use USB_MSC for having USB Mass Storage (MSC) instead
83+
("STM32_HIGH_DENSITY"),
84+
("USB_NC")
8085
],
8186

8287
CPPPATH=[
@@ -88,9 +93,7 @@
8893
join(FRAMEWORK_DIR, "system", "libmaple"),
8994
],
9095

91-
LIBPATH=[join(FRAMEWORK_DIR, "variants", variant, "ld")],
92-
93-
LIBS=["c"]
96+
LIBPATH=[join(FRAMEWORK_DIR, "variants", variant, "ld")]
9497
)
9598

9699
# remap ldscript
@@ -102,10 +105,14 @@
102105
env['LINKFLAGS'].remove(item)
103106

104107
# remove unused libraries
105-
for item in ("stdc++", "nosys"):
108+
for item in ("c", "stdc++", "nosys"):
106109
if item in env['LIBS']:
107110
env['LIBS'].remove(item)
108111

112+
# remove USB inactive serial flag if other flags are used
113+
if "SERIAL_USB" in env['CPPDEFINES'] or "USB_MSC" in env['CPPDEFINES']:
114+
env['CPPDEFINES'].remove("USB_NC")
115+
109116
#
110117
# Lookup for specific core's libraries
111118
#

builder/frameworks/mbed

builder/frameworks/spl.py

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"""
2525

2626
from os.path import isdir, isfile, join
27+
from string import Template
2728

2829
from SCons.Script import DefaultEnvironment
2930

@@ -33,6 +34,40 @@
3334
FRAMEWORK_DIR = platform.get_package_dir("framework-spl")
3435
assert isdir(FRAMEWORK_DIR)
3536

37+
def get_linker_script(mcu):
38+
ldscript = join(FRAMEWORK_DIR, "platformio",
39+
"ldscripts", mcu[0:11].upper() + "_FLASH.ld")
40+
41+
if isfile(ldscript):
42+
return ldscript
43+
44+
default_ldscript = join(FRAMEWORK_DIR, "platformio",
45+
"ldscripts", mcu[0:11].upper() + "_DEFAULT.ld")
46+
47+
print("Warning! Cannot find a linker script for the required board! "
48+
"Firmware will be linked with a default linker script!")
49+
50+
if isfile(default_ldscript):
51+
return default_ldscript
52+
53+
ram = env.BoardConfig().get("upload.maximum_ram_size", 0)
54+
flash = env.BoardConfig().get("upload.maximum_size", 0)
55+
template_file = join(FRAMEWORK_DIR, "platformio",
56+
"ldscripts", "tpl", "linker.tpl")
57+
content = ""
58+
with open(template_file) as fp:
59+
data = Template(fp.read())
60+
content = data.substitute(
61+
stack=hex(0x20000000 + ram), # 0x20000000 - start address for RAM
62+
ram=str(int(ram/1024)) + "K",
63+
flash=str(int(flash/1024)) + "K"
64+
)
65+
66+
with open(default_ldscript, "w") as fp:
67+
fp.write(content)
68+
69+
return default_ldscript
70+
3671
env.Append(
3772
CPPPATH=[
3873
join(FRAMEWORK_DIR, env.BoardConfig().get("build.core"),
@@ -52,26 +87,14 @@
5287
]
5388
)
5489

90+
env.Replace(
91+
LDSCRIPT_PATH=get_linker_script(env.BoardConfig().get("build.mcu"))
92+
)
93+
5594
#
5695
# Target: Build SPL Library
5796
#
5897

59-
# use mbed ldscript with bootloader section
60-
ldscript = env.BoardConfig().get("build.ldscript")
61-
if not isfile(join(platform.get_dir(), "ldscripts", ldscript)):
62-
if "mbed" in env.BoardConfig().get("frameworks", []):
63-
env.Append(
64-
LINKFLAGS=[
65-
'-Wl,-T"%s"' %
66-
join(
67-
platform.get_package_dir("framework-mbed"), "targets",
68-
"TARGET_STM", "TARGET_%s" % env.BoardConfig().get("build.variant")[:7],
69-
"TARGET_%s" % env.subst("$BOARD").upper(), "device",
70-
"TOOLCHAIN_GCC_ARM", "%s.ld" % ldscript.upper()[:-3]
71-
)
72-
]
73-
)
74-
7598
extra_flags = env.BoardConfig().get("build.extra_flags", "")
7699
src_filter_patterns = ["+<*>"]
77100
if "STM32F40_41xxx" in extra_flags:

builder/frameworks/stm32cube.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"stm32f103r8": "startup_stm32f103xb.s",
4545
"stm32f103rc": "startup_stm32f103xb.s",
4646
"stm32f103vc": "startup_stm32f103xe.s",
47-
"stm32f103ve": "startup_stm32f103xe.s"
47+
"stm32f103ve": "startup_stm32f103xe.s",
48+
"stm32f407ve": "startup_stm32f407xx.s"
4849
}
4950

5051

builder/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@
6464

6565
LIBS=["c", "gcc", "m", "stdc++", "nosys"],
6666

67+
SIZEPROGREGEXP=r"^(?:\.text|\.data|\.rodata|\.text.align|\.ARM.exidx)\s+(\d+).*",
68+
SIZEDATAREGEXP=r"^(?:\.data|\.bss|\.noinit)\s+(\d+).*",
69+
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
6770
SIZEPRINTCMD='$SIZETOOL -B -d $SOURCES',
6871

6972
PROGSUFFIX=".elf"
@@ -196,7 +199,7 @@ def __configure_upload_port(env):
196199
__configure_upload_port=__configure_upload_port,
197200
UPLOADER=_upload_tool,
198201
UPLOADERFLAGS=["${__configure_upload_port(__env__)}"] + _upload_flags,
199-
UPLOADCMD="$UPLOADER $UPLOADERFLAGS $PROJECT_DIR/$SOURCES"
202+
UPLOADCMD='$UPLOADER $UPLOADERFLAGS "$PROJECT_DIR/$SOURCES"'
200203
)
201204
upload_actions = [
202205
env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."),

examples/arduino-blink/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ platform = ststm32
1717
framework = arduino
1818
board = maple
1919

20-
[env:genericSTM32F103RB]
20+
[env:generic STM32F103RB]
2121
platform = ststm32
2222
framework = arduino
2323
board = genericSTM32F103RB

0 commit comments

Comments
 (0)