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

Fix serial buffer size for Maple and STSTM32 #22292

Merged
merged 1 commit into from
Jul 7, 2021
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
12 changes: 0 additions & 12 deletions buildroot/share/PlatformIO/scripts/fix_framework_weakness.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,3 @@ def _touch(path):
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 changes: 6 additions & 1 deletion buildroot/share/PlatformIO/scripts/stm32_serialbuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@
#
# 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 changes: 3 additions & 1 deletion ini/stm32f1-maple.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions ini/stm32f1.ini
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ 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.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
Expand All @@ -174,7 +174,7 @@ board_build.variant = MARLIN_F103Rx
board_build.offset = 0x7000
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
Expand Down