|
|
@ -1,8 +1,7 @@
|
|
|
|
from os.path import join
|
|
|
|
from os.path import join
|
|
|
|
|
|
|
|
from os.path import expandvars
|
|
|
|
Import("env", "projenv")
|
|
|
|
Import("env", "projenv")
|
|
|
|
|
|
|
|
|
|
|
|
platform = env.PioPlatform()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Relocate firmware from 0x08000000 to 0x08002000
|
|
|
|
# Relocate firmware from 0x08000000 to 0x08002000
|
|
|
|
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
|
|
|
|
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
|
|
|
|
#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
|
|
|
|
#env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
|
|
|
@ -10,14 +9,11 @@ platform = env.PioPlatform()
|
|
|
|
|
|
|
|
|
|
|
|
# Custom HEX from ELF
|
|
|
|
# Custom HEX from ELF
|
|
|
|
env.AddPostAction(
|
|
|
|
env.AddPostAction(
|
|
|
|
"$BUILD_DIR/${PROGNAME}.elf",
|
|
|
|
join("$BUILD_DIR","${PROGNAME}.elf"),
|
|
|
|
env.VerboseAction(" ".join([
|
|
|
|
env.VerboseAction(" ".join([
|
|
|
|
"$OBJCOPY",
|
|
|
|
"$OBJCOPY", "-O ihex", "$TARGET", # TARGET=.pio/build/fysetc_STM32F1/firmware.elf
|
|
|
|
"-O",
|
|
|
|
"'" + join("$BUILD_DIR","${PROGNAME}.hex") + "'", # Note: $BUILD_DIR is a full path
|
|
|
|
"ihex",
|
|
|
|
]), "Building $TARGET"))
|
|
|
|
'"$BUILD_DIR/${PROGNAME}.elf"',
|
|
|
|
|
|
|
|
'"$BUILD_DIR/${PROGNAME}.hex"'
|
|
|
|
|
|
|
|
]), "Building $TARGET"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# please keep $SOURCE variable, it will be replaced with a path to firmware
|
|
|
|
# please keep $SOURCE variable, it will be replaced with a path to firmware
|
|
|
|
|
|
|
|
|
|
|
@ -28,12 +24,16 @@ env.AddPostAction(
|
|
|
|
#)
|
|
|
|
#)
|
|
|
|
|
|
|
|
|
|
|
|
# In-line command with arguments
|
|
|
|
# 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(
|
|
|
|
env.Replace(
|
|
|
|
UPLOADER=platform.get_package_dir("tool-stm32duino") + '/stm32flash/stm32flash',
|
|
|
|
UPLOADER=UPLOAD_TOOL,
|
|
|
|
UPLOADCMD='"${UPLOADER}" -v -i rts,-dtr,dtr,-rts -R -b 115200 -g 0x8000000 -w "${BUILD_DIR}/${PROGNAME}.hex" ${UPLOAD_PORT}'
|
|
|
|
UPLOADCMD=expandvars(UPLOAD_TOOL + " -v -i rts,-dtr,dtr $UPLOAD_PORT -R -w '" + join("$BUILD_DIR","${PROGNAME}.hex") + "'")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Python callback
|
|
|
|
# Python callback
|
|
|
|
#def on_upload(source, target, env):
|
|
|
|
#def on_upload(source, target, env):
|
|
|
|
# print source, target
|
|
|
|
# print source, target
|
|
|
|