Skip to content

Commit

Permalink
Allow use of Fysetc SoftwareSerialM (MarlinFirmware#14893)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot authored and thinkyhead committed Aug 10, 2019
1 parent d2d71ca commit 5d2519e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_STM32F1/SoftwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifdef __STM32F1__
#if defined(__STM32F1__) && !defined(HAVE_SW_SERIAL)

/**
* Empty class for Software Serial implementation (Custom RX/TX pins)
Expand Down
24 changes: 12 additions & 12 deletions buildroot/share/PlatformIO/scripts/fysetc_STM32F1.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
from os.path import join
from os.path import expandvars
Import("env", "projenv")

platform = env.PioPlatform()

# Relocate firmware from 0x08000000 to 0x08002000
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
#env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/fysetc_aio_ii.ld")

# Custom HEX from ELF
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
join("$BUILD_DIR","${PROGNAME}.elf"),
env.VerboseAction(" ".join([
"$OBJCOPY",
"-O",
"ihex",
'"$BUILD_DIR/${PROGNAME}.elf"',
'"$BUILD_DIR/${PROGNAME}.hex"'
]), "Building $TARGET"))
"$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf
"'" + join("$BUILD_DIR","${PROGNAME}.hex") + "'", # Note: $BUILD_DIR is a full path
]), "Building $TARGET"))

# please keep $SOURCE variable, it will be replaced with a path to firmware

Expand All @@ -28,12 +24,16 @@
#)

# In-line command with arguments
UPLOAD_TOOL="stm32flash"
platform = env.PioPlatform()
if platform.get_package_dir("tool-stm32duino") != None:
UPLOAD_TOOL=expandvars("'" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "'")

env.Replace(
UPLOADER=platform.get_package_dir("tool-stm32duino") + '/stm32flash/stm32flash',
UPLOADCMD='"${UPLOADER}" -v -i rts,-dtr,dtr,-rts -R -b 115200 -g 0x8000000 -w "${BUILD_DIR}/${PROGNAME}.hex" ${UPLOAD_PORT}'
UPLOADER=UPLOAD_TOOL,
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w '" + join("$BUILD_DIR","${PROGNAME}.hex") + "'")
)


# Python callback
#def on_upload(source, target, env):
# print source, target
Expand Down
3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,10 @@ monitor_speed = 250000
platform = ststm32
framework = arduino
board = genericSTM32F103RC
#board_build.core = maple
extra_scripts = buildroot/share/PlatformIO/scripts/fysetc_STM32F1.py
build_flags = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
${common.build_flags} -std=gnu++14
-DDEBUG_LEVEL=0
-DDEBUG_LEVEL=0 -DHAVE_SW_SERIAL
build_unflags = -std=gnu++11
lib_deps = ${common.lib_deps}
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
Expand Down

0 comments on commit 5d2519e

Please sign in to comment.