2021-02-27 22:38:57 -06:00
|
|
|
#
|
|
|
|
# STM32F103RET6_creality.py
|
|
|
|
#
|
2020-06-16 01:45:27 -05: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-25 22:57:00 -05:00
|
|
|
|
2020-06-16 01:45:27 -05:00
|
|
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
|
|
|
|
|
|
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.ld")
|
2020-07-25 22:57:00 -05:00
|
|
|
|
|
|
|
for i, flag in enumerate(env['LINKFLAGS']):
|
2020-06-16 01:45:27 -05:00
|
|
|
if "-Wl,-T" in flag:
|
2020-07-25 22:57:00 -05:00
|
|
|
env['LINKFLAGS'][i] = "-Wl,-T" + custom_ld_script
|
2020-06-16 01:45:27 -05:00
|
|
|
elif flag == "-T":
|
2020-07-25 22:57:00 -05:00
|
|
|
env['LINKFLAGS'][i + 1] = custom_ld_script
|