This repository has been archived on 2022-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
Marlin-Artillery-M600/buildroot/share/PlatformIO/scripts/creality.py

18 lines
535 B
Python
Raw Permalink Normal View History

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