2021-02-28 04:38:57 +00:00
|
|
|
#
|
2021-11-04 10:28:42 +00:00
|
|
|
# STM32F103RC_fysetc.py
|
2021-02-28 04:38:57 +00:00
|
|
|
#
|
2021-11-04 10:28:42 +00:00
|
|
|
import pioutil
|
|
|
|
if pioutil.is_pio_build():
|
2024-06-14 21:01:34 +00:00
|
|
|
from os.path import join, expandvars
|
|
|
|
env = pioutil.env
|
2019-06-26 05:40:29 +00:00
|
|
|
|
2022-10-12 22:52:56 +00:00
|
|
|
# Custom HEX from ELF
|
|
|
|
env.AddPostAction(
|
|
|
|
join("$BUILD_DIR", "${PROGNAME}.elf"),
|
|
|
|
env.VerboseAction(" ".join([
|
|
|
|
"$OBJCOPY", "-O ihex", "$TARGET",
|
|
|
|
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
|
|
|
|
]), "Building $TARGET"))
|
2019-06-26 05:40:29 +00:00
|
|
|
|
2022-10-12 22:52:56 +00:00
|
|
|
# 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") + "\"")
|
2019-08-10 06:45:36 +00:00
|
|
|
|
2022-10-12 22:52:56 +00:00
|
|
|
env.Replace(
|
|
|
|
UPLOADER=UPLOAD_TOOL,
|
|
|
|
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
|
|
|
|
)
|