Skip to content

Commit

Permalink
🔨 Fix OpenBLT encode; no-bootloader envs (#24446)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilGremlin authored Jul 4, 2022
1 parent 954b449 commit e94fa7d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
6 changes: 3 additions & 3 deletions Marlin/src/pins/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,15 @@
#elif MB(MKS_ROBIN_NANO_V3_1)
#include "stm32f4/pins_MKS_ROBIN_NANO_V3.h" // STM32F4 env:mks_robin_nano_v3_1 env:mks_robin_nano_v3_1_usb_flash_drive env:mks_robin_nano_v3_1_usb_flash_drive_msc
#elif MB(ANET_ET4)
#include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_OpenBLT
#include "stm32f4/pins_ANET_ET4.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT
#elif MB(ANET_ET4P)
#include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_OpenBLT
#include "stm32f4/pins_ANET_ET4P.h" // STM32F4 env:Anet_ET4_no_bootloader env:Anet_ET4_OpenBLT
#elif MB(FYSETC_CHEETAH_V20)
#include "stm32f4/pins_FYSETC_CHEETAH_V20.h" // STM32F4 env:FYSETC_CHEETAH_V20
#elif MB(MKS_MONSTER8)
#include "stm32f4/pins_MKS_MONSTER8.h" // STM32F4 env:mks_monster8 env:mks_monster8_usb_flash_drive env:mks_monster8_usb_flash_drive_msc
#elif MB(TH3D_EZBOARD_V2)
#include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2
#include "stm32f4/pins_TH3D_EZBOARD_V2.h" // STM32F4 env:TH3D_EZBoard_V2_no_bootloader env:TH3D_EZBoard_V2_OpenBLT
#elif MB(OPULO_LUMEN_REV3)
#include "stm32f4/pins_OPULO_LUMEN_REV3.h" // STM32F4 env:Opulo_Lumen_REV3
#elif MB(MKS_ROBIN_NANO_V1_3_F4)
Expand Down
6 changes: 3 additions & 3 deletions buildroot/share/PlatformIO/scripts/openblt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

board = env.BoardConfig()
board_keys = board.get("build").keys()
if 'encrypt' in board_keys:
if 'encode' in board_keys:
env.AddPostAction(
join("$BUILD_DIR", "${PROGNAME}.bin"),
env.VerboseAction(" ".join([
"$OBJCOPY", "-O", "srec",
"\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encrypt")) + "\""
]), "Building $TARGET")
"\"$BUILD_DIR/${PROGNAME}.elf\"", "\"" + join("$BUILD_DIR", board.get("build.encode")) + "\""
]), "Building " + board.get("build.encode"))
)
46 changes: 34 additions & 12 deletions ini/stm32f4.ini
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,34 @@ extra_scripts = ${stm32_variant.extra_scripts}

#
# Anet ET4-MB_V1.x/ET4P-MB_V1.x (STM32F407VGT6 ARM Cortex-M4)
# For use with with davidtgbe's OpenBLT bootloader https://github.com/davidtgbe/openblt/releases
# Comment out board_build.offset = 0x10000 if you don't plan to use OpenBLT/flashing directly to 0x08000000.
#
[env:Anet_ET4_OpenBLT]
[Anet_ET4]
extends = stm32_variant
board = marlin_STM32F407VGT6_CCM
board_build.variant = MARLIN_F4x7Vx
board_build.encrypt_mks = firmware.srec
board_build.offset = 0x10000
board_upload.offset_address = 0x08010000
build_flags = ${stm32_variant.build_flags}
-DHAL_SD_MODULE_ENABLED -DHAL_SRAM_MODULE_ENABLED
build_unflags = ${stm32_variant.build_unflags}
-DUSBCON -DUSBD_USE_CDC -DUSBD_VID=0x0483

#
# Anet ET4 directly flashed via ST-Link
#
[env:Anet_ET4_no_bootloader]
extends = Anet_ET4
debug_tool = stlink
upload_protocol = stlink

#
# Anet ET4 with OpenBLT from https://github.com/davidtgbe/openblt/releases
#
[env:Anet_ET4_OpenBLT]
extends = Anet_ET4
board_build.encode = firmware.srec
board_build.offset = 0x10000
board_upload.offset_address = 0x08010000
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/openblt.py
debug_tool = jlink
upload_protocol = jlink

#
# BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4)
Expand Down Expand Up @@ -546,16 +556,28 @@ build_unflags = -DUSBD_USE_CDC
#
# TH3D EZBoard v2.0 (STM32F405RGT6 ARM Cortex-M4)
#
[env:TH3D_EZBoard_V2]
[TH3D_EZBoard_V2]
extends = stm32_variant
board = genericSTM32F405RG
board_build.variant = MARLIN_TH3D_EZBOARD_V2
board_build.encrypt_mks = firmware.bin
board_build.offset = 0xC000
board_upload.offset_address = 0x0800C000
build_flags = ${stm32_variant.build_flags} -DHSE_VALUE=12000000U -O0

#
# TH3D EZBoard v2.0 directly flashed via ST-Link
#
[env:TH3D_EZBoard_V2_no_bootloader]
extends = TH3D_EZBoard_V2
debug_tool = stlink
upload_protocol = stlink

#
# TH3D EZBoard v2.0 with OpenBLT from https://github.com/rhapsodyv/OpenBLT-STM32
#
[env:TH3D_EZBoard_V2_OpenBLT]
extends = TH3D_EZBoard_V2
board_build.encode = firmware.bin
board_build.offset = 0xC000
board_upload.offset_address = 0x0800C000
extra_scripts = ${stm32_variant.extra_scripts}
buildroot/share/PlatformIO/scripts/openblt.py

Expand Down

0 comments on commit e94fa7d

Please sign in to comment.