🔨 Consolidate STM32 extra_scripts (#22365)
This commit is contained in:
parent
a5459a68a6
commit
fef76a76a3
@ -10,7 +10,7 @@ Import("env")
|
||||
env.AddPostAction(
|
||||
join("$BUILD_DIR", "${PROGNAME}.elf"),
|
||||
env.VerboseAction(" ".join([
|
||||
"$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf
|
||||
"$OBJCOPY", "-O ihex", "$TARGET",
|
||||
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
|
||||
]), "Building $TARGET"))
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
#
|
||||
# buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
||||
#
|
||||
# Apply encryption and save as 'build.firmware' for these environments:
|
||||
# - env:mks_robin
|
||||
# - env:mks_robin_e3
|
||||
# - env:flsun_hispeedv1
|
||||
# - env:mks_robin_nano35
|
||||
#
|
||||
Import("env")
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
board = DefaultEnvironment().BoardConfig()
|
||||
|
||||
if 'encrypt' in board.get("build").keys():
|
||||
|
||||
import marlin
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
|
||||
def encrypt(source, target, env):
|
||||
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
|
||||
|
||||
marlin.add_post_action(encrypt);
|
||||
|
||||
else:
|
||||
|
||||
import sys
|
||||
print("You need to define output file via board_build.encrypt = 'filename' parameter", file=sys.stderr)
|
||||
env.Exit(1);
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# stm32_bootloader.py
|
||||
# offset_and_rename.py
|
||||
#
|
||||
# - If 'build.offset' is provided, either by JSON or by the environment...
|
||||
# - Set linker flag LD_FLASH_OFFSET and relocate the VTAB based on 'build.offset'.
|
||||
@ -36,6 +36,17 @@ if 'offset' in board_keys:
|
||||
if "-Wl,--defsym=LD_MAX_DATA_SIZE" in flag:
|
||||
env["LINKFLAGS"][i] = "-Wl,--defsym=LD_MAX_DATA_SIZE=" + str(maximum_ram_size - 40)
|
||||
|
||||
#
|
||||
# For build.encrypt rename and encode the firmware file.
|
||||
#
|
||||
if 'encrypt' in board_keys:
|
||||
|
||||
# Encrypt ${PROGNAME}.bin and save it with the name given in build.encrypt
|
||||
def encrypt(source, target, env):
|
||||
marlin.encrypt_mks(source, target, env, board.get("build.encrypt"))
|
||||
|
||||
marlin.add_post_action(encrypt);
|
||||
|
||||
#
|
||||
# For build.rename simply rename the firmware file.
|
||||
#
|
@ -53,8 +53,7 @@ board = megaatmega1280
|
||||
[mega_extended_optimized]
|
||||
extends = common_avr8
|
||||
board_build.variant = MARLIN_MEGA_EXTENDED
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${env:mega2560ext.extra_scripts}
|
||||
upload_speed = 57600
|
||||
build_flags = ${common.build_flags} -fno-tree-scev-cprop -fno-split-wide-types -Wl,--relax -mcall-prologues
|
||||
|
||||
|
@ -34,6 +34,11 @@ src_filter = ${common.default_src_filter} +<src/HAL/STM32> +<src/HAL/shared/b
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
|
||||
|
||||
[stm32f1_variant]
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/offset_and_rename.py
|
||||
|
||||
[common_STM32F103RC]
|
||||
platform = ${common_stm32.platform}
|
||||
extends = common_stm32
|
||||
@ -41,9 +46,7 @@ board = genericSTM32F103RC
|
||||
monitor_speed = 115200
|
||||
board_build.core = stm32
|
||||
board_build.variant = MARLIN_F103Rx
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# STM32F103RE
|
||||
@ -113,10 +116,7 @@ build_flags = ${common_stm32.build_flags}
|
||||
-DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
|
||||
build_unflags = ${common_stm32.build_unflags}
|
||||
-DUSBCON -DUSBD_USE_CDC
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
lib_deps =
|
||||
|
||||
#
|
||||
@ -134,7 +134,6 @@ board_build.encrypt = Robin_e3.bin
|
||||
board_upload.offset_address = 0x08005000
|
||||
debug_tool = stlink
|
||||
extra_scripts = ${common_STM32F103RC.extra_scripts}
|
||||
buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
||||
|
||||
#
|
||||
# Creality (STM32F103RET6)
|
||||
@ -150,10 +149,8 @@ board_build.variant = MARLIN_F103Rx
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/random-bin.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
|
||||
@ -174,9 +171,7 @@ board_build.variant = MARLIN_F103Rx
|
||||
board_build.offset = 0x7000
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_unflags = ${common_stm32.build_unflags}
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
|
||||
@ -207,10 +202,7 @@ board_build.offset = 0x7000
|
||||
board_build.encrypt = Robin_mini.bin
|
||||
board_upload.offset_address = 0x08007000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# MKS Robin Nano V1.2 and V2
|
||||
@ -228,10 +220,7 @@ board_upload.offset_address = 0x08007000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
buildroot/share/PlatformIO/scripts/mks_encrypt.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# Mingda MPX_ARM_MINI
|
||||
@ -245,9 +234,7 @@ board_build.variant = MARLIN_F103Zx
|
||||
board_build.offset = 0x10000
|
||||
build_flags = ${common_stm32.build_flags} -DENABLE_HWSERIAL3 -DTIMER_SERIAL=TIM5
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# Malyan M200 (STM32F103CB)
|
||||
@ -272,6 +259,4 @@ board_build.core = stm32
|
||||
board_build.variant = MARLIN_F103Rx
|
||||
board_build.offset = 0x5000
|
||||
board_upload.offset_address = 0x08005000
|
||||
extra_scripts = ${common_stm32.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f1_variant.extra_scripts}
|
||||
|
@ -29,6 +29,11 @@ board = armed_v1
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing
|
||||
|
||||
[stm32f4_variant]
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/offset_and_rename.py
|
||||
|
||||
#
|
||||
# STM32F401VE
|
||||
# 'STEVAL-3DP001V1' STM32F401VE board - https://www.st.com/en/evaluation-tools/steval-3dp001v1.html
|
||||
@ -40,8 +45,7 @@ board = marlin_STEVAL_STM32F401VE
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DARDUINO_STEVAL -DSTM32F401xE
|
||||
-DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# STM32F401RC
|
||||
@ -51,8 +55,7 @@ platform = ${common_stm32.platform}
|
||||
extends = common_stm32
|
||||
board = marlin_FYSETC_CHEETAH_V20
|
||||
build_flags = ${common_stm32.build_flags} -DSTM32F401xC -DVECT_TAB_OFFSET=0xC000
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# FLYF407ZG
|
||||
@ -65,8 +68,7 @@ board_build.variant = MARLIN_FLY_F407ZG
|
||||
upload_protocol = dfu
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DVECT_TAB_OFFSET=0x8000
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# FYSETC S6 (STM32F446RET6 ARM Cortex-M4)
|
||||
@ -77,8 +79,7 @@ extends = common_stm32
|
||||
platform_packages = tool-stm32duino
|
||||
board = marlin_fysetc_s6
|
||||
build_flags = ${common_stm32.build_flags} -DVECT_TAB_OFFSET=0x10000 -DHAL_PCD_MODULE_ENABLED
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
debug_tool = stlink
|
||||
upload_protocol = dfu
|
||||
upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE"
|
||||
@ -93,9 +94,7 @@ board = marlin_fysetc_s6_8000
|
||||
board_build.offset = 0x8000
|
||||
board_upload.offset_address = 0x08008000
|
||||
build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
upload_command = dfu-util -a 0 -s 0x08008000:leave -D "$SOURCE"
|
||||
|
||||
#
|
||||
@ -110,8 +109,7 @@ board = marlin_blackSTM32F407VET6
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DARDUINO_BLACK_F407VE
|
||||
-DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4)
|
||||
@ -126,15 +124,12 @@ board = marlin_STM32F407VGT6_CCM
|
||||
board_build.core = stm32
|
||||
board_build.variant = MARLIN_F4x7Vx
|
||||
board_build.encrypt = firmware.srec
|
||||
# Just openblt.py (not stm32_bootloader.py) generates the file
|
||||
board_build.offset = 0x10000
|
||||
board_upload.offset_address = 0x08010000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
buildroot/share/PlatformIO/scripts/openblt.py
|
||||
|
||||
#
|
||||
@ -146,8 +141,7 @@ extends = common_stm32
|
||||
board = marlin_BigTree_SKR_Pro
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
#upload_protocol = stlink
|
||||
#upload_command = "$PROJECT_PACKAGES_DIR/tool-stm32duino/stlink/ST-LINK_CLI.exe" -c SWD -P "$BUILD_DIR/firmware.bin" 0x8008000 -Rst -Run
|
||||
debug_tool = stlink
|
||||
@ -183,8 +177,7 @@ board_build.variant = MARLIN_BIGTREE_E3_RRF
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000
|
||||
-DSERIAL_RX_BUFFER_SIZE=255 -DSERIAL_TX_BUFFER_SIZE=255
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4)
|
||||
@ -193,8 +186,7 @@ extra_scripts = ${common.extra_scripts}
|
||||
platform = ${common_stm32.platform}
|
||||
extends = common_stm32
|
||||
board = marlin_BigTree_GTR_v1
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DSTM32F407IX -DVECT_TAB_OFFSET=0x8000
|
||||
|
||||
@ -221,8 +213,7 @@ build_flags = ${common_stm32.build_flags}
|
||||
-DHAVE_HWSERIAL3
|
||||
-DPIN_SERIAL2_RX=PD_6
|
||||
-DPIN_SERIAL2_TX=PD_5
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# BigTreeTech SKR V2.0 (STM32F407VGT6 ARM Cortex-M4) with USB Flash Drive Support
|
||||
@ -236,10 +227,8 @@ board_build.core = stm32
|
||||
board_build.variant = MARLIN_F4x7Vx
|
||||
board_build.offset = 0x8000
|
||||
board_upload.offset_address = 0x08008000
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
build_flags = ${stm_flash_drive.build_flags}
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
build_flags = ${stm_flash_drive.build_flags}
|
||||
-DUSE_USBHOST_HS -DUSE_USB_HS_IN_FS -DUSBD_IRQ_PRIO=5 -DUSBD_IRQ_SUBPRIO=6
|
||||
-DHSE_VALUE=8000000U -DHAL_SD_MODULE_ENABLED
|
||||
|
||||
@ -260,8 +249,7 @@ build_flags = ${env:BIGTREE_SKR_2.build_flags} -DUSBD_USE_CDC_MSC
|
||||
platform = ${common_stm32.platform}
|
||||
extends = common_stm32
|
||||
board = marlin_BigTree_Octopus_v1
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DSTM32F446_5VX -DVECT_TAB_OFFSET=0x8000 -DUSE_USB_HS_IN_FS
|
||||
|
||||
@ -286,9 +274,7 @@ board = marlin_STM32F407ZGT6
|
||||
board_build.variant = MARLIN_LERDGE
|
||||
board_build.offset = 0x10000
|
||||
board_build.encrypt = firmware.bin
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
buildroot/share/PlatformIO/scripts/lerdge.py
|
||||
build_flags = ${common_stm32.build_flags}
|
||||
-DSTM32F4 -DSTM32F4xx -DTARGET_STM32F4
|
||||
@ -366,9 +352,7 @@ monitor_speed = 500000
|
||||
board_build.core = stm32
|
||||
board_build.variant = MARLIN_F446VE
|
||||
board_build.offset = 0x0000
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# MKS Robin Pro V2
|
||||
@ -386,9 +370,7 @@ board_upload.offset_address = 0x08000000
|
||||
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# This SPI is used by Robin Nano V3
|
||||
@ -412,9 +394,7 @@ board_upload.offset_address = 0x0800C000
|
||||
build_unflags = ${common_stm32.build_unflags}
|
||||
debug_tool = jlink
|
||||
upload_protocol = jlink
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
|
||||
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
|
||||
extra_scripts = ${stm32f4_variant.extra_scripts}
|
||||
|
||||
#
|
||||
# MKS Robin Nano V3 with USB Flash Drive Support
|
||||
|
Loading…
Reference in New Issue
Block a user