mirror of https://github.com/ARMmbed/mbed-os.git
Move region adding to mbedToolchain
parent
c9add5c489
commit
a92d0df4ae
|
@ -284,25 +284,6 @@ def get_mbed_official_release(version):
|
||||||
|
|
||||||
return mbed_official_release
|
return mbed_official_release
|
||||||
|
|
||||||
def add_regions_to_toolchain(toolchain):
|
|
||||||
"""Add regions to the build profile, if there are any.
|
|
||||||
|
|
||||||
Positional Arguments:
|
|
||||||
toolchain - the toolchain to add the region defines to
|
|
||||||
"""
|
|
||||||
regions = list(toolchain.config.regions)
|
|
||||||
for region in regions:
|
|
||||||
for define in [(region.name.upper() + "_ADDR", region.start),
|
|
||||||
(region.name.upper() + "_SIZE", region.size)]:
|
|
||||||
toolchain.cc.append("-D%s=0x%x" % define)
|
|
||||||
toolchain.cppc.append("-D%s=0x%x" % define)
|
|
||||||
if region.active:
|
|
||||||
toolchain.ld.append(toolchain.make_ld_define(*define))
|
|
||||||
print("Using regions in this build:")
|
|
||||||
for region in regions:
|
|
||||||
print(" Region %s size 0x%x, offset 0x%x"
|
|
||||||
% (region.name, region.size, region.start))
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
def prepare_toolchain(src_paths, build_dir, target, toolchain_name,
|
||||||
macros=None, clean=False, jobs=1,
|
macros=None, clean=False, jobs=1,
|
||||||
|
@ -430,9 +411,6 @@ def scan_resources(src_paths, toolchain, dependencies_paths=None,
|
||||||
# Set the toolchain's configuration data
|
# Set the toolchain's configuration data
|
||||||
toolchain.set_config_data(toolchain.config.get_config_data())
|
toolchain.set_config_data(toolchain.config.get_config_data())
|
||||||
|
|
||||||
if toolchain.config.has_regions:
|
|
||||||
add_regions_to_toolchain(toolchain)
|
|
||||||
|
|
||||||
if (hasattr(toolchain.target, "release_versions") and
|
if (hasattr(toolchain.target, "release_versions") and
|
||||||
"5" not in toolchain.target.release_versions and
|
"5" not in toolchain.target.release_versions and
|
||||||
"rtos" in toolchain.config.lib_config_data):
|
"rtos" in toolchain.config.lib_config_data):
|
||||||
|
|
|
@ -1231,9 +1231,31 @@ class mbedToolchain:
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def add_regions(self):
|
||||||
|
"""Add regions to the build profile, if there are any.
|
||||||
|
"""
|
||||||
|
print("Using regions in this build:")
|
||||||
|
for region in self.config.regions:
|
||||||
|
for define in [(region.name.upper() + "_ADDR", region.start),
|
||||||
|
(region.name.upper() + "_SIZE", region.size)]:
|
||||||
|
define_string = "-D%s=0x%x" % define
|
||||||
|
self.cc.append(define_string)
|
||||||
|
self.cppc.append(define_string)
|
||||||
|
self.flags["common"].append(define_string)
|
||||||
|
if region.active:
|
||||||
|
for define in [("MBED_APP_START", region.start),
|
||||||
|
("MBED_APP_SIZE", region.size)]:
|
||||||
|
define_string = self.make_ld_define(*define)
|
||||||
|
self.ld.append(define_string)
|
||||||
|
self.flags["ld"].append(define_string)
|
||||||
|
print(" Region %s size 0x%x, offset 0x%x"
|
||||||
|
% (region.name, region.size, region.start))
|
||||||
|
|
||||||
# Set the configuration data
|
# Set the configuration data
|
||||||
def set_config_data(self, config_data):
|
def set_config_data(self, config_data):
|
||||||
self.config_data = config_data
|
self.config_data = config_data
|
||||||
|
if self.config.has_regions:
|
||||||
|
self.add_regions()
|
||||||
|
|
||||||
# Creates the configuration header if needed:
|
# Creates the configuration header if needed:
|
||||||
# - if there is no configuration data, "mbed_config.h" is not create (or deleted if it exists).
|
# - if there is no configuration data, "mbed_config.h" is not create (or deleted if it exists).
|
||||||
|
|
Loading…
Reference in New Issue