twister: move size report into size calc class
Move from main script into size_calc class. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
806722cdbf
commit
f539f1dc48
2 changed files with 20 additions and 19 deletions
|
@ -133,6 +133,19 @@ class SizeCalculator:
|
||||||
|
|
||||||
self._calculate_sizes()
|
self._calculate_sizes()
|
||||||
|
|
||||||
|
|
||||||
|
def size_report(self):
|
||||||
|
print(self.filename)
|
||||||
|
print("SECTION NAME VMA LMA SIZE HEX SZ TYPE")
|
||||||
|
for v in self.sections:
|
||||||
|
print("%-17s 0x%08x 0x%08x %8d 0x%05x %-7s" %
|
||||||
|
(v["name"], v["virt_addr"], v["load_addr"], v["size"], v["size"],
|
||||||
|
v["type"]))
|
||||||
|
|
||||||
|
print("Totals: %d bytes (ROM), %d bytes (RAM)" %
|
||||||
|
(self.rom_size, self.ram_size))
|
||||||
|
print("")
|
||||||
|
|
||||||
def get_ram_size(self):
|
def get_ram_size(self):
|
||||||
"""Get the amount of RAM the application will use up on the device
|
"""Get the amount of RAM the application will use up on the device
|
||||||
|
|
||||||
|
|
|
@ -209,18 +209,6 @@ from twister.runner import TwisterRunner
|
||||||
logger = logging.getLogger('twister')
|
logger = logging.getLogger('twister')
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
def size_report(sc):
|
|
||||||
logger.info(sc.filename)
|
|
||||||
logger.info("SECTION NAME VMA LMA SIZE HEX SZ TYPE")
|
|
||||||
for v in sc.sections:
|
|
||||||
logger.info("%-17s 0x%08x 0x%08x %8d 0x%05x %-7s" %
|
|
||||||
(v["name"], v["virt_addr"], v["load_addr"], v["size"], v["size"],
|
|
||||||
v["type"]))
|
|
||||||
|
|
||||||
logger.info("Totals: %d bytes (ROM), %d bytes (RAM)" %
|
|
||||||
(sc.rom_size, sc.ram_size))
|
|
||||||
logger.info("")
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description=__doc__,
|
description=__doc__,
|
||||||
|
@ -809,6 +797,13 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
|
||||||
only one platform is allowed""")
|
only one platform is allowed""")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.size:
|
||||||
|
from twister.size_calc import SizeCalculator
|
||||||
|
for fn in options.size:
|
||||||
|
sc = SizeCalculator(fn, [])
|
||||||
|
sc.size_report()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
def setup_logging(outdir, log_file, verbose, timestamps):
|
def setup_logging(outdir, log_file, verbose, timestamps):
|
||||||
|
@ -891,13 +886,6 @@ def main():
|
||||||
VERBOSE = options.verbose
|
VERBOSE = options.verbose
|
||||||
setup_logging(options.outdir, options.log_file, VERBOSE, options.timestamps)
|
setup_logging(options.outdir, options.log_file, VERBOSE, options.timestamps)
|
||||||
|
|
||||||
if options.size:
|
|
||||||
from twister.size_calc import SizeCalculator
|
|
||||||
for fn in options.size:
|
|
||||||
size_report(SizeCalculator(fn, []))
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
env = TwisterEnv(options)
|
env = TwisterEnv(options)
|
||||||
env.discover()
|
env.discover()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue