STM32 PIO: Override default LD Script using LINKFLAGS build scope (#15853)
This commit is contained in:
parent
9ca25118d0
commit
4ff708cb3a
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08007000
|
# Relocate firmware from 0x08000000 to 0x08007000
|
||||||
@ -5,4 +6,10 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103RC_SKR_MINI.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
@ -5,7 +5,6 @@ Import("env", "projenv")
|
|||||||
# 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"))
|
||||||
#env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/fysetc_aio_ii.ld")
|
|
||||||
|
|
||||||
# Custom HEX from ELF
|
# Custom HEX from ELF
|
||||||
env.AddPostAction(
|
env.AddPostAction(
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08010000
|
# Relocate firmware from 0x08000000 to 0x08010000
|
||||||
@ -5,7 +6,14 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08010000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/STM32F103VE_longer.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
|
|
||||||
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
|
# Rename ${PROGNAME}.bin and save it as 'project.bin' (No encryption on the Longer3D)
|
||||||
def encrypt(source, target, env):
|
def encrypt(source, target, env):
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
Import("env")
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08008800
|
# Relocate firmware from 0x08000000 to 0x08008800
|
||||||
for define in env['CPPDEFINES']:
|
for define in env['CPPDEFINES']:
|
||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x8008800"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x8008800"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/chitu_f103.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/chitu_f103.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
|
|
||||||
def calculate_crc(contents, seed):
|
def calculate_crc(contents, seed):
|
||||||
accumulating_xor_value = seed;
|
accumulating_xor_value = seed;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x0800A000
|
# Relocate firmware from 0x08000000 to 0x0800A000
|
||||||
@ -5,7 +6,13 @@ env['CPPDEFINES'].remove(("VECT_TAB_ADDR", "0x8000000"))
|
|||||||
#alternatively, for STSTM <=5.1.0 use line below
|
#alternatively, for STSTM <=5.1.0 use line below
|
||||||
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
|
#env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x0800A000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/jgaurora_a5s_a1.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/jgaurora_a5s_a1.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
#append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
|
#append ${PROGNAME}.bin firmware after bootloader and save it as 'jgaurora_firmware.bin'
|
||||||
def addboot(source,target,env):
|
def addboot(source,target,env):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08007000
|
# Relocate firmware from 0x08000000 to 0x08007000
|
||||||
@ -5,7 +6,13 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
|
# Encrypt ${PROGNAME}.bin and save it as 'Robin.bin'
|
||||||
def encrypt(source, target, env):
|
def encrypt(source, target, env):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08005000
|
# Relocate firmware from 0x08000000 to 0x08005000
|
||||||
@ -5,7 +6,14 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08005000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_lite.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
|
|
||||||
# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
|
# Encrypt ${PROGNAME}.bin and save it as 'mksLite.bin'
|
||||||
def encrypt(source, target, env):
|
def encrypt(source, target, env):
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08007000
|
# Relocate firmware from 0x08000000 to 0x08007000
|
||||||
@ -5,7 +7,14 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_mini.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
|
|
||||||
# Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
|
# Encrypt ${PROGNAME}.bin and save it as 'Robin_mini.bin'
|
||||||
def encrypt(source, target, env):
|
def encrypt(source, target, env):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import os
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
# Relocate firmware from 0x08000000 to 0x08007000
|
# Relocate firmware from 0x08000000 to 0x08007000
|
||||||
@ -5,7 +6,14 @@ for define in env['CPPDEFINES']:
|
|||||||
if define[0] == "VECT_TAB_ADDR":
|
if define[0] == "VECT_TAB_ADDR":
|
||||||
env['CPPDEFINES'].remove(define)
|
env['CPPDEFINES'].remove(define)
|
||||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||||
env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
|
|
||||||
|
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/mks_robin_nano.ld")
|
||||||
|
for i, flag in enumerate(env["LINKFLAGS"]):
|
||||||
|
if "-Wl,-T" in flag:
|
||||||
|
env["LINKFLAGS"][i] = "-Wl,-T" + custom_ld_script
|
||||||
|
elif flag == "-T":
|
||||||
|
env["LINKFLAGS"][i + 1] = custom_ld_script
|
||||||
|
|
||||||
|
|
||||||
# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
|
# Encrypt ${PROGNAME}.bin and save it as 'Robin_nano.bin'
|
||||||
def encrypt(source, target, env):
|
def encrypt(source, target, env):
|
||||||
|
Loading…
Reference in New Issue
Block a user