mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Name of example container changed to Baremetal
This commit is contained in:
@@ -19,11 +19,11 @@ from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from config.lib import *
|
||||
|
||||
class ExamplesContGenerator:
|
||||
class BaremetalContGenerator:
|
||||
def __init__(self):
|
||||
self.CONT_SRC_DIR = '' # Set when container is selected
|
||||
self.EXAMPLES_SRC_BASEDIR = join(PROJROOT, 'conts')
|
||||
self.EXAMPLES_PROJ_SRC_DIR = join(PROJROOT, 'conts/examples')
|
||||
self.BAREMETAL_SRC_BASEDIR = join(PROJROOT, 'conts')
|
||||
self.BAREMETAL_PROJ_SRC_DIR = join(PROJROOT, 'conts/baremetal')
|
||||
|
||||
self.main_builder_name = 'build.py'
|
||||
self.main_configurator_name = 'configure.py'
|
||||
@@ -47,12 +47,12 @@ class ExamplesContGenerator:
|
||||
self.build_desc_out = None
|
||||
self.src_main_out = None
|
||||
|
||||
def create_examples_srctree(self, config, cont):
|
||||
def create_baremetal_srctree(self, config, cont):
|
||||
# First, create the base project directory and sources
|
||||
str = 'example' + cont.example_id
|
||||
shutil.copytree(join(self.EXAMPLES_PROJ_SRC_DIR, str), self.CONT_SRC_DIR)
|
||||
str = 'baremetal' + cont.baremetal_id
|
||||
shutil.copytree(join(self.BAREMETAL_PROJ_SRC_DIR, str), self.CONT_SRC_DIR)
|
||||
|
||||
def copy_examples_build_desc(self, config, cont):
|
||||
def copy_baremetal_build_desc(self, config, cont):
|
||||
id_header = '[Container ID]\n'
|
||||
type_header = '\n[Container Type]\n'
|
||||
name_header = '\n[Container Name]\n'
|
||||
@@ -79,7 +79,7 @@ class ExamplesContGenerator:
|
||||
fout.write(pager_physmem_header % ireg)
|
||||
fout.write('\t' + cont.physmem["START"][ireg] + ' - ' + cont.physmem["END"][ireg] + '\n')
|
||||
|
||||
def copy_examples_build_readme(self, config, cont):
|
||||
def copy_baremetal_build_readme(self, config, cont):
|
||||
with open(self.build_readme_in) as fin:
|
||||
str = fin.read()
|
||||
with open(self.build_readme_out, 'w+') as fout:
|
||||
@@ -91,30 +91,30 @@ class ExamplesContGenerator:
|
||||
self.main_configurator_name, \
|
||||
self.main_configurator_name))
|
||||
|
||||
def copy_examples_container_h(self, config, cont):
|
||||
def copy_baremetal_container_h(self, config, cont):
|
||||
with open(self.container_h_in) as fin:
|
||||
str = fin.read()
|
||||
with open(self.container_h_out, 'w+') as fout:
|
||||
# Make any manipulations here
|
||||
fout.write(str % (cont.name, cont.id, cont.id))
|
||||
|
||||
def create_examples_sources(self, config, cont):
|
||||
self.create_examples_srctree(config, cont)
|
||||
self.copy_examples_build_readme(config, cont)
|
||||
self.copy_examples_build_desc(config, cont)
|
||||
def create_baremetal_sources(self, config, cont):
|
||||
self.create_baremetal_srctree(config, cont)
|
||||
self.copy_baremetal_build_readme(config, cont)
|
||||
self.copy_baremetal_build_desc(config, cont)
|
||||
self.generate_linker_script(config, cont)
|
||||
self.copy_examples_container_h(config, cont)
|
||||
self.copy_baremetal_container_h(config, cont)
|
||||
|
||||
def update_configuration(self, config, cont):
|
||||
self.copy_examples_build_desc(config, cont)
|
||||
self.copy_baremetal_build_desc(config, cont)
|
||||
self.generate_linker_script(config, cont)
|
||||
self.copy_examples_container_h(config, cont)
|
||||
self.copy_baremetal_container_h(config, cont)
|
||||
|
||||
def check_create_examples_sources(self, config):
|
||||
def check_create_baremetal_sources(self, config):
|
||||
for cont in config.containers:
|
||||
if cont.type == "examples":
|
||||
if cont.type == "baremetal":
|
||||
# Determine container directory name.
|
||||
self.CONT_SRC_DIR = join(self.EXAMPLES_SRC_BASEDIR, cont.dirname.lower())
|
||||
self.CONT_SRC_DIR = join(self.BAREMETAL_SRC_BASEDIR, cont.dirname.lower())
|
||||
self.build_readme_out = join(self.CONT_SRC_DIR, self.build_readme_name)
|
||||
self.build_desc_out = join(self.CONT_SRC_DIR, self.build_desc_name)
|
||||
self.linker_lds_out = join(join(self.CONT_SRC_DIR, 'include'), \
|
||||
@@ -122,8 +122,8 @@ class ExamplesContGenerator:
|
||||
self.container_h_out = join(join(self.CONT_SRC_DIR, 'include'), \
|
||||
self.container_h_name)
|
||||
|
||||
if not os.path.exists(join(self.EXAMPLES_SRC_BASEDIR, cont.dirname)):
|
||||
self.create_examples_sources(config, cont)
|
||||
if not os.path.exists(join(self.BAREMETAL_SRC_BASEDIR, cont.dirname)):
|
||||
self.create_baremetal_sources(config, cont)
|
||||
else:
|
||||
# Don't create new sources but update configuration
|
||||
self.update_configuration(config, cont)
|
||||
@@ -135,12 +135,12 @@ class ExamplesContGenerator:
|
||||
fout.write(str % (conv_hex(cont.pager_vma), \
|
||||
conv_hex(cont.pager_lma)))
|
||||
|
||||
def examples_container_generate(self, config):
|
||||
self.check_create_examples_sources(config)
|
||||
def baremetal_container_generate(self, config):
|
||||
self.check_create_baremetal_sources(config)
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = configuration_retrieve()
|
||||
config.config_print()
|
||||
examples_cont = ExamplesContGenerator()
|
||||
examples_cont.examples_container_generate(config)
|
||||
baremetal_cont = BaremetalContGenerator()
|
||||
baremetal_cont.baremetal_container_generate(config)
|
||||
|
||||
@@ -124,7 +124,7 @@ def build_all_containers():
|
||||
if container.type == 'linux':
|
||||
pass
|
||||
cont_images.append(build_linux_container(config, projpaths, container))
|
||||
elif container.type == 'examples':
|
||||
elif container.type == 'baremetal':
|
||||
cont_images.append(build_default_container(config, projpaths, container))
|
||||
elif container.type == 'posix':
|
||||
cont_images.append(build_posix_container(config, projpaths, container))
|
||||
|
||||
Reference in New Issue
Block a user