mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Revert "Merge branch 'libl4thread' of git://www.b-labs.co.uk/bora/git/codezero into bora"
This reverts commit 3f870b540f.
This commit is contained in:
@@ -19,11 +19,11 @@ from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from config.lib import *
|
||||
|
||||
class ExamplesContGenerator:
|
||||
class BareContGenerator:
|
||||
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.BARE_SRC_BASEDIR = join(PROJROOT, 'conts')
|
||||
self.EXAMPLE_PROJ_SRC_DIR = join(PROJROOT, 'conts/bare_src')
|
||||
|
||||
self.main_builder_name = 'build.py'
|
||||
self.main_configurator_name = 'configure.py'
|
||||
@@ -47,12 +47,11 @@ class ExamplesContGenerator:
|
||||
self.build_desc_out = None
|
||||
self.src_main_out = None
|
||||
|
||||
def create_examples_srctree(self, config, cont):
|
||||
def create_bare_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)
|
||||
shutil.copytree(self.EXAMPLE_PROJ_SRC_DIR, self.CONT_SRC_DIR)
|
||||
|
||||
def copy_examples_build_desc(self, config, cont):
|
||||
def copy_bare_build_desc(self, config, cont):
|
||||
id_header = '[Container ID]\n'
|
||||
type_header = '\n[Container Type]\n'
|
||||
name_header = '\n[Container Name]\n'
|
||||
@@ -79,7 +78,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_bare_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 +90,30 @@ class ExamplesContGenerator:
|
||||
self.main_configurator_name, \
|
||||
self.main_configurator_name))
|
||||
|
||||
def copy_examples_container_h(self, config, cont):
|
||||
def copy_bare_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_bare_sources(self, config, cont):
|
||||
self.create_bare_srctree(config, cont)
|
||||
self.copy_bare_build_readme(config, cont)
|
||||
self.copy_bare_build_desc(config, cont)
|
||||
self.generate_linker_script(config, cont)
|
||||
self.copy_examples_container_h(config, cont)
|
||||
self.copy_bare_container_h(config, cont)
|
||||
|
||||
def update_configuration(self, config, cont):
|
||||
self.copy_examples_build_desc(config, cont)
|
||||
self.copy_bare_build_desc(config, cont)
|
||||
self.generate_linker_script(config, cont)
|
||||
self.copy_examples_container_h(config, cont)
|
||||
self.copy_bare_container_h(config, cont)
|
||||
|
||||
def check_create_examples_sources(self, config):
|
||||
def check_create_bare_sources(self, config):
|
||||
for cont in config.containers:
|
||||
if cont.type == "examples":
|
||||
if cont.type == "bare":
|
||||
# Determine container directory name.
|
||||
self.CONT_SRC_DIR = join(self.EXAMPLES_SRC_BASEDIR, cont.dirname.lower())
|
||||
self.CONT_SRC_DIR = join(self.BARE_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 +121,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.BARE_SRC_BASEDIR, cont.dirname)):
|
||||
self.create_bare_sources(config, cont)
|
||||
else:
|
||||
# Don't create new sources but update configuration
|
||||
self.update_configuration(config, cont)
|
||||
@@ -135,12 +134,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 bare_container_generate(self, config):
|
||||
self.check_create_bare_sources(config)
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = configuration_retrieve()
|
||||
config.config_print()
|
||||
examples_cont = ExamplesContGenerator()
|
||||
examples_cont.examples_container_generate(config)
|
||||
bare_cont = BareContGenerator()
|
||||
bare_cont.bare_container_generate(config)
|
||||
|
||||
@@ -55,7 +55,7 @@ def source_to_builddir(srcdir, id):
|
||||
return join(BUILDDIR, cont_builddir)
|
||||
|
||||
# We simply use SCons to figure all this out from container.id
|
||||
# This is very similar to examples container builder:
|
||||
# This is very similar to default container builder:
|
||||
# In fact this notion may become a standard convention for
|
||||
# calling specific bare containers
|
||||
def build_posix_container(config, projpaths, container):
|
||||
@@ -110,7 +110,7 @@ def build_default_container(config, projpaths, container):
|
||||
os.path.walk(projdir, glob_by_walk, ['*.elf', images])
|
||||
|
||||
# Calculate and store size of pager
|
||||
pager_binary = "conts/" + container.name + "/main.elf"
|
||||
pager_binary = "conts/bare" + str(container.id) + "/main.elf"
|
||||
config.containers[container.id].pager_size = \
|
||||
conv_hex(elf_binary_size(join(PROJROOT, pager_binary)))
|
||||
|
||||
@@ -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 == 'bare':
|
||||
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