🐛 Fix Maple / STM32 serial buffer (#22292)

This commit is contained in:
ldursw 2021-07-06 21:50:01 -03:00 committed by Scott Lahteine
parent cae391bb48
commit ed14d14819
4 changed files with 11 additions and 16 deletions

View file

@ -30,15 +30,3 @@ if env.MarlinFeatureIsEnabled("POSTMORTEM_DEBUGGING"):
print("Done patching exception handler") print("Done patching exception handler")
print("Libmaple modified and ready for post mortem debugging") 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)

View file

@ -13,11 +13,16 @@ Import("env")
# #
# The script will set the value as the default one (64 bytes) # The script will set the value as the default one (64 bytes)
# or the user-configured one, whichever is higher. # 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"] 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)) 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 = env.get('BUILD_FLAGS')
build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf) build_flags.append("-DSERIAL_RX_BUFFER_SIZE=" + rxBuf)
build_flags.append("-DSERIAL_TX_BUFFER_SIZE=" + txBuf) 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) env.Replace(BUILD_FLAGS=build_flags)

View file

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

View file

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