2021-02-28 04:38:57 +00:00
|
|
|
#
|
2021-04-27 09:49:21 +00:00
|
|
|
# buildroot/share/PlatformIO/scripts/STM32F103RC_fysetc.py
|
2021-02-28 04:38:57 +00:00
|
|
|
#
|
2019-06-26 05:40:29 +00:00
|
|
|
from os.path import join
|
2019-08-10 06:45:36 +00:00
|
|
|
from os.path import expandvars
|
2020-06-03 02:04:22 +00:00
|
|
|
Import("env")
|
2019-06-26 05:40:29 +00:00
|
|
|
|
|
|
|
# Custom HEX from ELF
|
|
|
|
env.AddPostAction(
|
2021-06-13 20:43:33 +00:00
|
|
|
join("$BUILD_DIR", "${PROGNAME}.elf"),
|
2019-06-26 05:40:29 +00:00
|
|
|
env.VerboseAction(" ".join([
|
2021-07-15 00:44:51 +00:00
|
|
|
"$OBJCOPY", "-O ihex", "$TARGET",
|
2021-06-13 20:43:33 +00:00
|
|
|
"\"" + join("$BUILD_DIR", "${PROGNAME}.hex") + "\"", # Note: $BUILD_DIR is a full path
|
2019-08-10 06:45:36 +00:00
|
|
|
]), "Building $TARGET"))
|
2019-06-26 05:40:29 +00:00
|
|
|
|
|
|
|
# In-line command with arguments
|
2019-08-10 06:45:36 +00:00
|
|
|
UPLOAD_TOOL="stm32flash"
|
|
|
|
platform = env.PioPlatform()
|
|
|
|
if platform.get_package_dir("tool-stm32duino") != None:
|
2019-08-13 00:50:34 +00:00
|
|
|
UPLOAD_TOOL=expandvars("\"" + join(platform.get_package_dir("tool-stm32duino"),"stm32flash","stm32flash") + "\"")
|
2019-08-10 06:45:36 +00:00
|
|
|
|
2019-07-18 10:54:50 +00:00
|
|
|
env.Replace(
|
2019-08-10 06:45:36 +00:00
|
|
|
UPLOADER=UPLOAD_TOOL,
|
2020-03-31 18:59:08 +00:00
|
|
|
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr -R -b 115200 -g 0x8000000 -w \"" + join("$BUILD_DIR","${PROGNAME}.hex")+"\"" + " $UPLOAD_PORT")
|
2019-07-18 10:54:50 +00:00
|
|
|
)
|