1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-05 02:19:14 +00:00
MarlinFirmware/buildroot/share/PlatformIO/scripts/STM32F103RET6_creality.py

21 lines
567 B
Python
Raw Normal View History

2021-02-28 04:38:57 +00:00
#
# STM32F103RET6_creality.py
#
2020-06-16 06:45:27 +00:00
import os
Import("env")
# Relocate firmware from 0x08000000 to 0x08007000
for define in env['CPPDEFINES']:
if define[0] == "VECT_TAB_ADDR":
env['CPPDEFINES'].remove(define)
2020-07-26 03:57:00 +00:00
2020-06-16 06:45:27 +00:00
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.ld")
2020-07-26 03:57:00 +00:00
for i, flag in enumerate(env['LINKFLAGS']):
2020-06-16 06:45:27 +00:00
if "-Wl,-T" in flag:
2020-07-26 03:57:00 +00:00
env['LINKFLAGS'][i] = "-Wl,-T" + custom_ld_script
2020-06-16 06:45:27 +00:00
elif flag == "-T":
2020-07-26 03:57:00 +00:00
env['LINKFLAGS'][i + 1] = custom_ld_script