Randomize firmware.bin, fix unflag
This commit is contained in:
parent
e02817b077
commit
d0222e5c76
@ -47,22 +47,25 @@ def get_all_known_libs():
|
||||
|
||||
def get_all_env_libs():
|
||||
env_libs = []
|
||||
lib_deps = env.GetProjectOption("lib_deps")
|
||||
lib_deps = env.GetProjectOption('lib_deps')
|
||||
for dep in lib_deps:
|
||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
||||
env_libs.append(name)
|
||||
return env_libs
|
||||
|
||||
def set_env_field(field, value):
|
||||
proj = env.GetProjectConfig()
|
||||
proj.set("env:" + env['PIOENV'], field, value)
|
||||
|
||||
# All unused libs should be ignored so that if a library
|
||||
# exists in .pio/lib_deps it will not break compilation.
|
||||
def force_ignore_unused_libs():
|
||||
env_libs = get_all_env_libs()
|
||||
known_libs = get_all_known_libs()
|
||||
diff = (list(set(known_libs) - set(env_libs)))
|
||||
lib_ignore = env.GetProjectOption("lib_ignore") + diff
|
||||
lib_ignore = env.GetProjectOption('lib_ignore') + diff
|
||||
print("Ignoring libs:", lib_ignore)
|
||||
proj = env.GetProjectConfig()
|
||||
proj.set("env:" + env["PIOENV"], "lib_ignore", lib_ignore)
|
||||
set_env_field('lib_ignore', lib_ignore)
|
||||
|
||||
def install_features_dependencies():
|
||||
load_config()
|
||||
@ -80,14 +83,14 @@ def install_features_dependencies():
|
||||
deps_to_add[name] = dep
|
||||
|
||||
# Does the env already have the dependency?
|
||||
deps = env.GetProjectOption("lib_deps")
|
||||
deps = env.GetProjectOption('lib_deps')
|
||||
for dep in deps:
|
||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
||||
if name in deps_to_add:
|
||||
del deps_to_add[name]
|
||||
|
||||
# Are there any libraries that should be ignored?
|
||||
lib_ignore = env.GetProjectOption("lib_ignore")
|
||||
lib_ignore = env.GetProjectOption('lib_ignore')
|
||||
for dep in deps:
|
||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
||||
if name in deps_to_add:
|
||||
@ -96,8 +99,7 @@ def install_features_dependencies():
|
||||
# Is there anything left?
|
||||
if len(deps_to_add) > 0:
|
||||
# Only add the missing dependencies
|
||||
proj = env.GetProjectConfig()
|
||||
proj.set("env:" + env["PIOENV"], "lib_deps", deps + list(deps_to_add.values()))
|
||||
set_env_field('lib_deps', deps + list(deps_to_add.values()))
|
||||
|
||||
if 'extra_scripts' in FEATURE_DEPENDENCIES[feature]:
|
||||
print("Executing extra_scripts for %s... " % feature)
|
||||
@ -105,8 +107,7 @@ def install_features_dependencies():
|
||||
|
||||
if 'src_filter' in FEATURE_DEPENDENCIES[feature]:
|
||||
print("Adding src_filter for %s... " % feature)
|
||||
proj = env.GetProjectConfig()
|
||||
src_filter = ' '.join(env.GetProjectOption("src_filter"))
|
||||
src_filter = ' '.join(env.GetProjectOption('src_filter'))
|
||||
# first we need to remove the references to the same folder
|
||||
my_srcs = re.findall( r'[+-](<.*?>)', FEATURE_DEPENDENCIES[feature]['src_filter'])
|
||||
cur_srcs = re.findall( r'[+-](<.*?>)', src_filter)
|
||||
@ -115,19 +116,18 @@ def install_features_dependencies():
|
||||
src_filter = re.sub(r'[+-]' + d, '', src_filter)
|
||||
|
||||
src_filter = FEATURE_DEPENDENCIES[feature]['src_filter'] + ' ' + src_filter
|
||||
proj.set("env:" + env["PIOENV"], "src_filter", [src_filter])
|
||||
set_env_field('src_filter', [src_filter])
|
||||
env.Replace(SRC_FILTER=src_filter)
|
||||
|
||||
if 'lib_ignore' in FEATURE_DEPENDENCIES[feature]:
|
||||
print("Ignoring libs for %s... " % feature)
|
||||
lib_ignore = env.GetProjectOption("lib_ignore") + [FEATURE_DEPENDENCIES[feature]['lib_ignore']]
|
||||
proj = env.GetProjectConfig()
|
||||
proj.set("env:" + env["PIOENV"], "lib_ignore", lib_ignore)
|
||||
lib_ignore = env.GetProjectOption('lib_ignore') + [FEATURE_DEPENDENCIES[feature]['lib_ignore']]
|
||||
set_env_field('lib_ignore', lib_ignore)
|
||||
|
||||
#
|
||||
# Find a compiler, considering the OS
|
||||
#
|
||||
ENV_BUILD_PATH = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env["PIOENV"])
|
||||
ENV_BUILD_PATH = os.path.join(env.Dictionary('PROJECT_BUILD_DIR'), env['PIOENV'])
|
||||
GCC_PATH_CACHE = os.path.join(ENV_BUILD_PATH, ".gcc_path")
|
||||
def search_compiler():
|
||||
if os.path.exists(GCC_PATH_CACHE):
|
||||
|
@ -5,12 +5,13 @@ Import("env")
|
||||
for define in env['CPPDEFINES']:
|
||||
if define[0] == "VECT_TAB_ADDR":
|
||||
env['CPPDEFINES'].remove(define)
|
||||
|
||||
env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
|
||||
|
||||
custom_ld_script = os.path.abspath("buildroot/share/PlatformIO/ldscripts/creality.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
|
||||
|
||||
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
buildroot/share/PlatformIO/scripts/random-bin.py
Normal file
5
buildroot/share/PlatformIO/scripts/random-bin.py
Normal file
@ -0,0 +1,5 @@
|
||||
Import("env")
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
env['PROGNAME'] = datetime.now().strftime("firmware-%Y%m%d-%H%M%S")
|
@ -380,7 +380,7 @@ src_filter = ${common.default_src_filter} +<src/HAL/STM32>
|
||||
platform = ${common_stm32.platform}
|
||||
build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py
|
||||
${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL
|
||||
build_unflags = -std=gnu++11
|
||||
build_unflags = -std=gnu11
|
||||
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
|
||||
lib_ignore = SPI
|
||||
lib_deps = ${common.lib_deps}
|
||||
@ -744,6 +744,7 @@ board = genericSTM32F103RC
|
||||
build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py
|
||||
${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY -DTEMP_TIMER_CHAN=4
|
||||
extra_scripts = ${common.extra_scripts}
|
||||
pre:buildroot/share/PlatformIO/scripts/random-bin.py
|
||||
buildroot/share/PlatformIO/scripts/creality.py
|
||||
lib_ignore = ${common_stm32f1.lib_ignore}
|
||||
debug_tool = jlink
|
||||
|
Loading…
Reference in New Issue
Block a user