Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate STM32 extra_scripts #22365

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,17 @@
#elif MB(MKS_ROBIN)
#include "stm32f1/pins_MKS_ROBIN.h" // STM32F1 env:mks_robin env:mks_robin_maple
#elif MB(MKS_ROBIN_MINI)
#include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini
#include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini env:mks_robin_mini_maple
#elif MB(MKS_ROBIN_NANO)
#include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano35 env:mks_robin_nano35_maple
#elif MB(MKS_ROBIN_NANO_V2)
#include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano35 env:mks_robin_nano35_maple
#elif MB(MKS_ROBIN_LITE)
#include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite
#include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite env:mks_robin_lite_maple
#elif MB(MKS_ROBIN_LITE3)
#include "stm32f1/pins_MKS_ROBIN_LITE3.h" // STM32F1 env:mks_robin_lite3
#include "stm32f1/pins_MKS_ROBIN_LITE3.h" // STM32F1 env:mks_robin_lite3 env:mks_robin_lite3_maple
#elif MB(MKS_ROBIN_PRO)
#include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro
#include "stm32f1/pins_MKS_ROBIN_PRO.h" // STM32F1 env:mks_robin_pro env:mks_robin_pro_maple
#elif MB(MKS_ROBIN_E3)
#include "stm32f1/pins_MKS_ROBIN_E3.h" // STM32F1 env:mks_robin_e3 env:mks_robin_e3_maple
#elif MB(MKS_ROBIN_E3_V1_1)
Expand All @@ -506,7 +506,7 @@
#elif MB(MKS_ROBIN_E3D_V1_1)
#include "stm32f1/pins_MKS_ROBIN_E3D_V1_1.h" // STM32F1 env:mks_robin_e3
#elif MB(MKS_ROBIN_E3P)
#include "stm32f1/pins_MKS_ROBIN_E3P.h" // STM32F1 env:mks_robin_e3p
#include "stm32f1/pins_MKS_ROBIN_E3P.h" // STM32F1 env:mks_robin_e3p env:mks_robin_e3p_maple
#elif MB(BTT_SKR_MINI_V1_1)
#include "stm32f1/pins_BTT_SKR_MINI_V1_1.h" // STM32F1 env:STM32F103RC_btt env:STM32F103RC_btt_USB env:STM32F103RC_btt_maple env:STM32F103RC_btt_USB_maple
#elif MB(BTT_SKR_MINI_E3_V1_0)
Expand All @@ -522,21 +522,21 @@
#elif MB(BTT_SKR_CR6)
#include "stm32f1/pins_BTT_SKR_CR6.h" // STM32F1 env:STM32F103RE_btt env:STM32F103RE_btt_USB env:STM32F103RE_btt_maple env:STM32F103RE_btt_USB_maple
#elif MB(JGAURORA_A5S_A1)
#include "stm32f1/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1
#include "stm32f1/pins_JGAURORA_A5S_A1.h" // STM32F1 env:jgaurora_a5s_a1 env:jgaurora_a5s_a1_maple
#elif MB(FYSETC_AIO_II)
#include "stm32f1/pins_FYSETC_AIO_II.h" // STM32F1 env:STM32F103RC_fysetc
#include "stm32f1/pins_FYSETC_AIO_II.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple
#elif MB(FYSETC_CHEETAH)
#include "stm32f1/pins_FYSETC_CHEETAH.h" // STM32F1 env:STM32F103RC_fysetc
#include "stm32f1/pins_FYSETC_CHEETAH.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple
#elif MB(FYSETC_CHEETAH_V12)
#include "stm32f1/pins_FYSETC_CHEETAH_V12.h" // STM32F1 env:STM32F103RC_fysetc
#include "stm32f1/pins_FYSETC_CHEETAH_V12.h" // STM32F1 env:STM32F103RC_fysetc env:STM32F103RC_fysetc_maple
#elif MB(LONGER3D_LK)
#include "stm32f1/pins_LONGER3D_LK.h" // STM32F1 env:STM32F103VE_longer
#include "stm32f1/pins_LONGER3D_LK.h" // STM32F1 env:STM32F103VE_longer env:STM32F103VE_longer_maple
#elif MB(CCROBOT_MEEB_3DP)
#include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb
#elif MB(CHITU3D_V5)
#include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_v5_gpio_init
#include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple env:chitu_v5_gpio_init env:chitu_v5_gpio_init_maple
#elif MB(CHITU3D_V6)
#include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103
#include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103 env:chitu_f103_maple
#elif MB(CREALITY_V4)
#include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple
#elif MB(CREALITY_V4210)
Expand All @@ -550,7 +550,7 @@
#elif MB(CREALITY_V453)
#include "stm32f1/pins_CREALITY_V453.h" // STM32F1 env:STM32F103RET6_creality env:STM32F103RET6_creality_maple
#elif MB(TRIGORILLA_PRO)
#include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro
#include "stm32f1/pins_TRIGORILLA_PRO.h" // STM32F1 env:trigorilla_pro env:trigorilla_pro_maple
#elif MB(FLY_MINI)
#include "stm32f1/pins_FLY_MINI.h" // STM32F1 env:FLY_MINI env:FLY_MINI_maple
#elif MB(FLSUN_HISPEED)
Expand Down
2 changes: 2 additions & 0 deletions Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@
#define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5

#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN
#endif

#if ENABLED(TFT_LVGL_UI)
Expand Down
2 changes: 1 addition & 1 deletion buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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"))

Expand Down
29 changes: 0 additions & 29 deletions buildroot/share/PlatformIO/scripts/mks_encrypt.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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'.
Expand Down Expand Up @@ -36,6 +36,17 @@
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.
#
Expand Down
3 changes: 1 addition & 2 deletions ini/avr.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ini/stm32f1-maple.ini
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ build_unflags = ${common_stm32f1.build_unflags}
#
[env:chitu_v5_gpio_init]
platform = ${common_stm32f1.platform}
extends = env:chitu_f103
build_flags = ${env:chitu_f103.build_flags} -DCHITU_V5_Z_MIN_BUGFIX
extends = env:chitu_f103_maple
build_flags = ${env:chitu_f103_maple.build_flags} -DCHITU_V5_Z_MIN_BUGFIX

#
# FLYmaker FLY Mini (STM32F103RCT6)
Expand Down
41 changes: 13 additions & 28 deletions ini/stm32f1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ 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
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
Expand Down Expand Up @@ -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 =

#
Expand All @@ -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)
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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}
Loading