Skip to content

Commit 9500762

Browse files
committed
- updated toolchains to newer compilers, aiming for a good Marlin FW future
- improved generic_create_variant.py to not mess with official board variant configurations (only touch if board_build.variant value is prefixed with MARLIN_)
1 parent 3be967b commit 9500762

File tree

8 files changed

+131
-58
lines changed

8 files changed

+131
-58
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"build": {
3+
"arduino":{
4+
"ldscript": "esp32_out.ld"
5+
},
6+
"core": "esp32",
7+
"extra_flags": "-DARDUINO_ESP32_DEV",
8+
"f_cpu": "240000000L",
9+
"f_flash": "40000000L",
10+
"flash_mode": "dio",
11+
"mcu": "esp32",
12+
"variant": "esp32"
13+
},
14+
"connectivity": [
15+
"wifi",
16+
"bluetooth",
17+
"ethernet",
18+
"can"
19+
],
20+
"debug": {
21+
"openocd_board": "esp-wroom-32.cfg"
22+
},
23+
"frameworks": [
24+
"arduino",
25+
"espidf"
26+
],
27+
"name": "MKS TinyBee V1.0",
28+
"upload": {
29+
"flash_size": "8MB",
30+
"maximum_ram_size": 524288,
31+
"maximum_size": 8388608,
32+
"require_upload_port": true,
33+
"speed": 460800,
34+
"offset_address": 65536
35+
},
36+
"url": "https://github.com/makerbase-mks/MKS-TinyBee",
37+
"vendor": "MKS Makerbase"
38+
}

buildroot/share/PlatformIO/scripts/generic_create_variant.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# will be picked up by PlatformIO just like any other variant.
77
#
88
import pioutil
9+
import re
10+
marlin_variant_pattern = re.compile("marlin_.*")
911
if pioutil.is_pio_build():
1012
import shutil,marlin
1113
from pathlib import Path
@@ -44,15 +46,20 @@
4446
variant = board.get("build.variant")
4547
#series = mcu_type[:7].upper() + "xx"
4648

47-
# Prepare a new empty folder at the destination
48-
variant_dir = FRAMEWORK_DIR / "variants" / variant
49-
if variant_dir.is_dir():
50-
shutil.rmtree(variant_dir)
51-
if not variant_dir.is_dir():
52-
variant_dir.mkdir()
49+
# Only prepare a new variant if the PlatformIO configuration provides it (board_build.variant).
50+
# This check is important so that we do not delete any official board config variants.
51+
if marlin_variant_pattern.match(str(variant).lower()):
52+
# Prepare a new empty folder at the destination
53+
variant_dir = FRAMEWORK_DIR / "variants" / variant
54+
if variant_dir.is_dir():
55+
shutil.rmtree(variant_dir)
56+
if not variant_dir.is_dir():
57+
variant_dir.mkdir()
5358

54-
# Source dir is a local variant sub-folder
55-
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
56-
assert source_dir.is_dir()
59+
# Source dir is a local variant sub-folder
60+
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
61+
assert source_dir.is_dir()
5762

58-
marlin.copytree(source_dir, variant_dir)
63+
print("Copying variant " + str(variant) + " to framework directory...")
64+
65+
marlin.copytree(source_dir, variant_dir)

ini/avr.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
# AVR (8-bit) Common Environment values
1414
#
1515
[common_avr8]
16-
platform = atmelavr@~3.4
16+
platform = atmelavr@~4.0.1
1717
build_flags = ${common.build_flags} -Wl,--relax
18+
build_src_flags = -std=gnu++1z
1819
board_build.f_cpu = 16000000L
1920
build_src_filter = ${common.default_src_filter} +<src/HAL/AVR>
2021

@@ -53,7 +54,7 @@ extends = common_avr8
5354
board_build.variant = MARLIN_MEGA_EXTENDED
5455
extra_scripts = ${env:mega2560ext.extra_scripts}
5556
upload_speed = 57600
56-
build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
57+
build_flags = ${common_avr8.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -mcall-prologues
5758

5859
#
5960
# MightyBoard ATmega1280
@@ -103,7 +104,7 @@ board_upload.maximum_size = 126976
103104
#
104105

105106
[tuned_1284p]
106-
build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
107+
build_flags = ${common_avr8.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -mcall-prologues
107108

108109
[env:sanguino1284p_optimized]
109110
extends = env:sanguino1284p

ini/esp32.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,16 @@ monitor_speed = 115200
3939

4040
[env:mks_tinybee]
4141
extends = env:esp32
42+
board = marlin_MKS_TinyBee
43+
# New espressif32 packages actually REQUIRE a valid, correctly-specified board definition file.
44+
# You can put the board definition file inside of the buildroot\share\PlatformIO\boards folder (please name it prefixed with marlin stuff).
45+
# Old revisions (pre 5.0.0) actually allowed auto-detection of the flash size (support for that has since been removed).
46+
47+
platform_packages = [email protected]
48+
#, framework-arduinoespressif32@https://github.com/quiret/Arduino-ESP32-1.0.6.git
49+
# (https://github.com/espressif/arduino-esp32/pull/7744)
50+
board_build.arduino.upstream_packages = no
51+
# These build flags fix bugs in the packages.
52+
build_flags = ${env:esp32.build_flags} -Wno-attributes -D_POSIX_TIMEOUTS=-1 -D'__alloc_size2(x,y)=__attribute__((alloc_size(x,y)))' -D'__alloc_align(y)=' -D'__result_use_check=__attribute__((warn_unused_result))' -D'__alloc_size(x)=__attribute__((alloc_size(x)))'
4253
board_build.partitions = default_8MB.csv
54+
build_src_flags = -O3 -std=gnu++2a -Wno-volatile -D_BITMANAGE_ALWAYS_INLINE

ini/lpc176x.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
[common_LPC]
1616
platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip
17-
platform_packages = framework-arduino-lpc176x@^0.2.8
17+
platform_packages = framework-arduino-lpc176x@^0.2.9, [email protected]
1818
board = nxp_lpc1768
1919
lib_ldf_mode = off
2020
lib_compat_mode = strict
@@ -29,6 +29,7 @@ build_flags = ${common.build_flags} -DU8G_HAL_LINKS -IMarlin/src/HAL/LPC17
2929
# debug options for backtrace
3030
#-funwind-tables
3131
#-mpoke-function-name
32+
build_src_flags = -std=gnu++20 -Wno-volatile
3233

3334
#
3435
# NXP LPC176x ARM Cortex-M3

ini/stm32-common.ini

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#
1010
####################################
1111

12+
# For Compatibility. Should be set to version that is last known to work across all boards.
1213
[common_stm32]
1314
platform = ststm32@~12.1
1415
board_build.core = stm32
@@ -22,6 +23,15 @@ build_src_filter = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/share
2223
extra_scripts = ${common.extra_scripts}
2324
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
2425

26+
# For the latest stuff. Latest as in: we test and then bump the version.
27+
# Please test before upgrading.
28+
[common_stm32_latest]
29+
extends = common_stm32
30+
platform = ststm32@~15.4.1
31+
build_flags = ${common_stm32.build_flags}
32+
-std=gnu++2a
33+
build_unflags = -std=gnu++14
34+
2535
#
2636
# STM32 board based on a variant.
2737
#
@@ -31,6 +41,10 @@ extra_scripts = ${common_stm32.extra_scripts}
3141
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
3242
buildroot/share/PlatformIO/scripts/offset_and_rename.py
3343

44+
[stm32_variant_latest]
45+
extends = common_stm32_latest
46+
extra_scripts = ${stm32_variant.extra_scripts}
47+
3448
#
3549
# USB Flash Drive mix-ins for STM32
3650
#

ini/stm32f1-maple.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# HAL/STM32F1 Common Environment values
2424
#
2525
[STM32F1_maple]
26-
platform = ststm32@~12.1
26+
platform = ststm32@~15.4.1
2727
board_build.core = maple
2828
build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py
2929
${common.build_flags} -DARDUINO_ARCH_STM32 -DMAPLE_STM32F1
@@ -32,7 +32,7 @@ build_src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
3232
lib_ignore = SPI, FreeRTOS701, FreeRTOS821
3333
lib_deps = ${common.lib_deps}
3434
SoftwareSerialM
35-
platform_packages = tool-stm32duino
35+
platform_packages = tool-stm32duino, [email protected]
3636
extra_scripts = ${common.extra_scripts}
3737
pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
3838
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py

0 commit comments

Comments
 (0)