Browse Source

🐛 Fix Maple / STM32 serial buffer (#22292)

vanilla_fb_2.0.x
ldursw 4 years ago
committed by Scott Lahteine
parent
commit
ed14d14819
  1. 12
      buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
  2. 7
      buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
  3. 4
      ini/stm32f1-maple.ini
  4. 4
      ini/stm32f1.ini

12
buildroot/share/PlatformIO/scripts/fix_framework_weakness.py

@ -30,15 +30,3 @@ if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
print("Done patching exception handler")
print("Libmaple modified and ready for post mortem debugging")
mf = env["MARLIN_FEATURES"]
rxBuf = mf["RX_BUFFER_SIZE"] if "RX_BUFFER_SIZE" in mf else "0"
txBuf = mf["TX_BUFFER_SIZE"] if "TX_BUFFER_SIZE" in mf else "0"
if int(rxBuf) < 64:
rxBuf = "64"
if int(txBuf) < 64:
txBuf = "64"
build_flags = env.get('BUILD_FLAGS')
build_flags.append("-DUSART_RX_BUF_SIZE=" + rxBuf + " -DUSART_TX_BUF_SIZE=" + txBuf)
env.Replace(BUILD_FLAGS=build_flags)

7
buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py

@ -13,11 +13,16 @@ Import("env")
#
# The script will set the value as the default one (64 bytes)
# or the user-configured one, whichever is higher.
#
# Marlin has 128 and 32 as default values for RX_BUFFER_SIZE and
# TX_BUFFER_SIZE respectively. We use the highest value.
mf = env["MARLIN_FEATURES"]
rxBuf = str(max(64, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
rxBuf = str(max(128, int(mf["RX_BUFFER_SIZE"]) if "RX_BUFFER_SIZE" in mf else 0))
txBuf = str(max(64, int(mf["TX_BUFFER_SIZE"]) if "TX_BUFFER_SIZE" in mf else 0))
build_flags = env.get('BUILD_FLAGS')
build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf)
build_flags.append("-DUSART_RX_BUF_SIZE=" + rxBuf)
build_flags.append("-DUSART_TX_BUF_SIZE=" + txBuf)
env.Replace(BUILD_FLAGS=build_flags)

4
ini/stm32f1-maple.ini

@ -36,6 +36,7 @@ lib_deps = ${common.lib_deps}
platform_packages = tool-stm32duino
extra_scripts = ${common.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
pre:buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
#
# STM32F103RC
@ -325,7 +326,8 @@ lib_ignore = ${common_stm32f1.lib_ignore}
platform = ${common_stm32f1.platform}
extends = common_stm32f1
board = marlin_CHITU_F103
extra_scripts = pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
extra_scripts = ${common_stm32f1.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/common-dependencies.py
pre:buildroot/share/PlatformIO/scripts/STM32F1_create_variant.py
buildroot/share/PlatformIO/scripts/chitu_crypt.py
build_flags = ${common_stm32f1.build_flags}

4
ini/stm32f1.ini

@ -153,7 +153,7 @@ board_build.offset = 0x7000
board_build.ldscript = ldscript.ld
board_upload.offset_address = 0x08007000
build_unflags = ${common_stm32.build_unflags} -DUSBCON -DUSBD_USE_CDC
extra_scripts = ${common.extra_scripts}
extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
pre:buildroot/share/PlatformIO/scripts/random-bin.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
@ -178,7 +178,7 @@ board_build.offset = 0x7000
board_build.ldscript = ldscript.ld
board_upload.offset_address = 0x08007000
build_unflags = ${common_stm32.build_unflags}
extra_scripts = ${common.extra_scripts}
extra_scripts = ${common_stm32.extra_scripts}
pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
buildroot/share/PlatformIO/scripts/stm32_bootloader.py
debug_tool = jlink

Loading…
Cancel
Save