muele-marlin/buildroot/share/PlatformIO/scripts/creality.py

18 lines
535 B
Python
Raw Normal View History

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