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:
@@ -1,9 +1,9 @@
|
||||
symbols
|
||||
CONT%(cn)d_TYPE_LINUX 'Linux Container'
|
||||
CONT%(cn)d_TYPE_EXAMPLES 'Examples Container'
|
||||
CONT%(cn)d_TYPE_POSIX 'Codezero POSIX Services'
|
||||
CONT%(cn)d_TYPE_TEST 'Test Container'
|
||||
CONT%(cn)d_OPT_NAME 'Container Name'
|
||||
CONT%(cn)d_TYPE_LINUX 'Linux Container'
|
||||
CONT%(cn)d_TYPE_BAREMETAL 'Barebones Container'
|
||||
CONT%(cn)d_TYPE_POSIX 'POSIX Container'
|
||||
CONT%(cn)d_TYPE_TEST 'Test Container'
|
||||
CONT%(cn)d_OPT_NAME 'Container Name'
|
||||
|
||||
CONT%(cn)d_PHYSMEM_REGIONS 'Container %(cn)d Number of Physical Regions'
|
||||
CONT%(cn)d_PHYS0_START 'Container %(cn)d Physical Region 0 Start Address'
|
||||
@@ -139,12 +139,13 @@ default CONT%(cn)d_VIRT4_END from 0xe0000000
|
||||
default CONT%(cn)d_VIRT5_START from 0xe0000000
|
||||
default CONT%(cn)d_VIRT5_END from 0xf0000000
|
||||
|
||||
default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_EXAMPLES==y) ? "example%(cn)d" : ((CONT%(cn)d_TYPE_TEST==y) ? "test%(cn)d" : "posix%(cn)d"))
|
||||
default CONT%(cn)d_OPT_NAME from (CONT%(cn)d_TYPE_LINUX==y) ? "linux%(cn)d" : ((CONT%(cn)d_TYPE_BAREMETAL==y) ? "baremetal%(cn)d" : ((CONT%(cn)d_TYPE_TEST==y) ? "test%(cn)d" : "posix%(cn)d"))
|
||||
|
||||
when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params cont%(cn)d_examples_params
|
||||
when CONT%(cn)d_TYPE_EXAMPLES==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params
|
||||
when CONT%(cn)d_TYPE_TEST==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params cont%(cn)d_examples_params
|
||||
when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_examples_params
|
||||
when CONT%(cn)d_TYPE_LINUX==y suppress cont%(cn)d_default_pager_params cont%(cn)d_posix_pager_params
|
||||
when CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params
|
||||
when CONT%(cn)d_TYPE_TEST==y suppress cont%(cn)d_linux_pager_params cont%(cn)d_posix_pager_params
|
||||
when CONT%(cn)d_TYPE_POSIX==y suppress cont%(cn)d_linux_pager_params
|
||||
unless CONT%(cn)d_TYPE_BAREMETAL==y suppress cont%(cn)d_baremetal_params
|
||||
|
||||
symbols
|
||||
cont%(cn)d_menu 'Container %(cn)d Parameters'
|
||||
@@ -157,17 +158,17 @@ cont%(cn)d_linux_pager_params 'Container %(cn)d Linux Pager Parameters'
|
||||
cont%(cn)d_default_pager_params 'Container %(cn)d Default Pager Parameters'
|
||||
cont%(cn)d_posix_pager_params 'Container %(cn)d POSIX Pager Parameters'
|
||||
|
||||
cont%(cn)d_examples_params 'Example Applications List'
|
||||
CONT%(cn)d_EXAMPLE_APP0 'Empty Application'
|
||||
CONT%(cn)d_EXAMPLE_APP1 'Hello World'
|
||||
CONT%(cn)d_EXAMPLE_APP2 'Thread Library Demo'
|
||||
cont%(cn)d_baremetal_params 'Baremetal Applications List'
|
||||
CONT%(cn)d_BAREMETAL_APP0 'Empty Application'
|
||||
CONT%(cn)d_BAREMETAL_APP1 'Hello World'
|
||||
CONT%(cn)d_BAREMETAL_APP2 'Thread Library Demo'
|
||||
|
||||
|
||||
choices cont%(cn)d_examples_params
|
||||
CONT%(cn)d_EXAMPLE_APP0
|
||||
CONT%(cn)d_EXAMPLE_APP1
|
||||
CONT%(cn)d_EXAMPLE_APP2
|
||||
default CONT%(cn)d_EXAMPLE_APP0
|
||||
choices cont%(cn)d_baremetal_params
|
||||
CONT%(cn)d_BAREMETAL_APP0
|
||||
CONT%(cn)d_BAREMETAL_APP1
|
||||
CONT%(cn)d_BAREMETAL_APP2
|
||||
default CONT%(cn)d_BAREMETAL_APP0
|
||||
|
||||
menu cont%(cn)d_default_pager_params
|
||||
CONT%(cn)d_PAGER_LMA@
|
||||
@@ -637,7 +638,7 @@ menu cont%(cn)d_capability_list
|
||||
|
||||
menu container%(cn)d_options
|
||||
CONT%(cn)d_OPT_NAME$
|
||||
cont%(cn)d_examples_params
|
||||
cont%(cn)d_baremetal_params
|
||||
cont%(cn)d_linux_pager_params
|
||||
cont%(cn)d_default_pager_params
|
||||
cont%(cn)d_posix_pager_params
|
||||
@@ -646,11 +647,11 @@ menu container%(cn)d_options
|
||||
cont%(cn)d_capability_list
|
||||
|
||||
choices container%(cn)d_type
|
||||
CONT%(cn)d_TYPE_EXAMPLES
|
||||
CONT%(cn)d_TYPE_LINUX
|
||||
CONT%(cn)d_TYPE_BAREMETAL
|
||||
CONT%(cn)d_TYPE_POSIX
|
||||
CONT%(cn)d_TYPE_LINUX
|
||||
CONT%(cn)d_TYPE_TEST
|
||||
default CONT%(cn)d_TYPE_EXAMPLES
|
||||
default CONT%(cn)d_TYPE_BAREMETAL
|
||||
|
||||
menu cont%(cn)d_menu
|
||||
container%(cn)d_type
|
||||
|
||||
@@ -12,7 +12,7 @@ class Container:
|
||||
self.name = None
|
||||
self.type = None
|
||||
self.id = id
|
||||
self.example_id = 0
|
||||
self.baremetal_id = 0
|
||||
self.pager_lma = 0
|
||||
self.pager_vma = 0
|
||||
self.pager_size = 0
|
||||
@@ -173,9 +173,9 @@ class configuration:
|
||||
dirname = val[1:-1].lower()
|
||||
self.containers[id].dirname = dirname
|
||||
self.containers[id].name = dirname
|
||||
elif param[:len("EXAMPLE_APP")] == "EXAMPLE_APP":
|
||||
elif param[:len("BAREMETAL_APP")] == "BAREMETAL_APP":
|
||||
param1 = param.split("_", 1)
|
||||
self.containers[id].example_id = param1[1][-1:]
|
||||
self.containers[id].baremetal_id = param1[1][-1:]
|
||||
elif param[:len("CAP_")] == "CAP_":
|
||||
prefix, param_rest = param.split('_', 1)
|
||||
prepare_capability(self.containers[id], param_rest, val)
|
||||
@@ -186,8 +186,8 @@ class configuration:
|
||||
self.containers[id].type = "linux"
|
||||
elif param2 == "POSIX":
|
||||
self.containers[id].type = "posix"
|
||||
elif param2 == "EXAMPLES":
|
||||
self.containers[id].type = "examples"
|
||||
elif param2 == "BAREMETAL":
|
||||
self.containers[id].type = "baremetal"
|
||||
elif param2 == "TEST":
|
||||
self.containers[id].type = "test"
|
||||
# Extract parameters for containers
|
||||
|
||||
@@ -4,7 +4,7 @@ import os, sys, shelve, shutil
|
||||
from os.path import join
|
||||
from config.projpaths import *
|
||||
from config.configuration import *
|
||||
from scripts.examples.examples_generator import *
|
||||
from scripts.baremetal.baremetal_generator import *
|
||||
from scripts.kernel.generate_kernel_cinfo import *
|
||||
from scripts.cml.generate_container_cml import *
|
||||
from optparse import OptionParser
|
||||
@@ -184,9 +184,9 @@ def configure_system(options, args):
|
||||
|
||||
configuration_save(config)
|
||||
|
||||
# Generate example container files if new ones defined
|
||||
examples_cont_gen = ExamplesContGenerator()
|
||||
examples_cont_gen.examples_container_generate(config)
|
||||
# Generate baremetal container files if new ones defined
|
||||
baremetal_cont_gen = BaremetalContGenerator()
|
||||
baremetal_cont_gen.baremetal_container_generate(config)
|
||||
|
||||
# Print out the configuration if asked
|
||||
if options.print_config:
|
||||
|
||||
@@ -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