def __init__(self):
        """
        Make sure compiler is ready
        """
        if (scons_pre_check([]) == False):
            raise SconsBuildError("%s============== COULD NOT FIND COMPILER! =============%s"%
                (colors['red'], colors['end']))
        self.root = os.path.realpath(os.path.join(__file__, '..', '..', '..'))
        self.os_root = os.path.realpath(os.path.join(self.root, 'platform', 'os', 'Huawei_LiteOS'))
        self.tools_prefix = 'riscv32-unknown-elf-'

        #Set input/output folders
        tmp_dir = os.path.join('build', 'build_tmp')
        final_dir = 'output'
        self.log_path = os.path.join(tmp_dir, 'logs')
        self.obj_path = os.path.join(tmp_dir, 'objs')
        self.lib_path = os.path.join(tmp_dir, 'libs')
        self.cache_path = os.path.join(tmp_dir, 'cache')
        self.link_path = os.path.join(tmp_dir, 'scripts')
        self.nv_path = os.path.join(tmp_dir, 'nv')
        self.bin_path = os.path.join(final_dir, 'bin')

        #NV settings.
        self.nv_src_path = os.path.join('app', 'demo', 'nv')
        self.nv_factory_name = 'hi3861_demo_factory.hnv'
        self.nv_normal_name = 'hi3861_demo_normal.hnv'
        #mss_nvi_db_fcc.xml  FCC
        #mss_nvi_db.xml      CE
        #mss_nvi_db_max.xml  MAX_POWER
        if scons_usr_bool_option('CONFIG_CE_SUPPORT') == 'y':
            self.nv_cfg_name = 'mss_nvi_db.xml'

        if scons_usr_bool_option('CONFIG_FCC_SUPPORT') == 'y':
            self.nv_cfg_name = 'mss_nvi_db_fcc.xml'

        if scons_usr_bool_option('CONFIG_MAX_POWER_SUPPORT') == 'y':
            self.nv_cfg_name = 'mss_nvi_db_max.xml'

        #chip type
        if scons_usr_bool_option('CONFIG_TARGET_CHIP_HI3861') == 'y':
            self.chip_type = "Hi3861"
        else:
            self.chip_type = "Hi3861L"

        #Link settings
        self.base_sum = 'd11133fff0d435d699e27817e165cf1d10c1a951452bd07d40da5bcfc41ef773'
        self.link_file = os.path.join(self.link_path, 'link.lds')
        self.map_file = os.path.join(self.bin_path, '%s_demo.map'%(self.chip_type))
        self.gcc_ver_num = '7.3.0'
        self.app_name = None
        self.target_name = None
        self.app_builder = None
        self.clean_list = [tmp_dir, final_dir]
        self.clean_list.append(os.path.join('build', 'scripts', '__pycache__'))
 def get_libs(self):
     """
     Get library name to be inclouded. Linker option -l follows the lib name without
     prefix "lib" and surffix ".a", has to remove those parts from a library file name.
     """
     libs = [lib[3:-2] for lib in os.listdir(os.path.join(self.root, 'build', 'libs')) if lib.startswith('lib') and lib.endswith('.a')]
     libs.append('gcc')
     for module_lib in [self.get_module_libs(module, True) for module in self.get_build_modules()]:
         libs.extend(module_lib)
     if scons_usr_bool_option('CONFIG_I2S_SUPPORT') == 'n':
         libs.remove('i2s')
     if scons_usr_bool_option('CONFIG_HILINK') == 'y':
         libs.extend(['hilinkdevicesdk', 'hilinkota'])
     return libs
Exemple #3
0
           ],
           'opts',
           'common',
           depends=('LOSCFG_KASAN_EXAMPLES_DEMO', 'y'))
set_config('env_cfg',
           'LOSCFG_KASAN',
           'y', [
               '-fsanitize=kernel-address', '-fasan-shadow-offset=1835008',
               '--param asan-stack=1', '-fsanitize=bounds-strict'
           ],
           'opts',
           'common',
           depends=('LOSCFG_KASAN_LITEOS_NET_COAP', 'y'))

# -------------------------------hilink support-------------------------------
if scons_usr_bool_option('CONFIG_HILINK') == 'y':
    os_lib_path.append(os.path.join('components', 'hilink', 'lib'))
set_config('module', 'CONFIG_HILINK', 'y', 'hilink')
set_config('env_cfg', 'CONFIG_HILINK', 'y', ['CONFIG_HILINK'], 'defines',
           'common')


def get_fixed_config(type='all'):
    if type == 'all':
        return fixed_config
    elif type in ['module', 'lib_cfg', 'env_cfg']:
        return fixed_config[type]
    else:
        print('[ERROR] type err!')

Exemple #4
0
           ],
           'opts',
           'common',
           depends=('LOSCFG_KASAN_EXAMPLES_DEMO', 'y'))
set_config('env_cfg',
           'LOSCFG_KASAN',
           'y', [
               '-fsanitize=kernel-address', '-fasan-shadow-offset=1835008',
               '--param asan-stack=1', '-fsanitize=bounds-strict'
           ],
           'opts',
           'common',
           depends=('LOSCFG_KASAN_LITEOS_NET_COAP', 'y'))

# -------------------------------hilink support-------------------------------
if scons_usr_bool_option('CONFIG_HILINK') == 'y':
    os_lib_path.append(os.path.join('components', 'hilink', 'lib'))
set_config('module', 'CONFIG_HILINK', 'y', 'hilink')
set_config('env_cfg', 'CONFIG_HILINK', 'y', ['CONFIG_HILINK'], 'defines',
           'common')

# -------------------------------histreaming support-------------------------------
if scons_usr_bool_option('CONFIG_HISTREAMING_SUPPORT') == 'y':
    os_lib_path.append(os.path.join('components', 'histreaming', 'lib'))
set_config('module', 'CONFIG_HISTREAMING_SUPPORT', 'y', 'histreaming')
set_config('env_cfg', 'CONFIG_HISTREAMING_SUPPORT', 'y',
           ['CONFIG_HISTREAMING_SUPPORT'], 'defines', 'common')

# -------------------------------OHOS support-------------------------------
if scons_get_cfg_val('CONFIG_OHOS') == 'y':
    os_lib_path.append(os.path.join('components', 'OHOS', 'ndk', 'libs'))