class Unifmt

Attributes

as_defines[RW]

the asm defintions

as_flags[RW]

the asm defintions

as_include[RW]

the asm defintions

as_predefines[RW]

the asm defintions

as_preincludes[RW]

the asm defintions

binary_file[RW]
cc_defines[RW]

the c code definitons

cc_flags[RW]

the c code definitons

cc_include[RW]

the c code definitons

cc_predefines[RW]

the c code definitons

cc_preincludes[RW]

the c code definitons

cp_defines[RW]

the soc definitons

cxx_defines[RW]

the Cxx code difintios

cxx_flags[RW]

the Cxx code difintios

cxx_include[RW]

the Cxx code difintios

cxx_predefines[RW]

the Cxx code difintios

cxx_preincludes[RW]

the Cxx code difintios

ld_flags[RW]

link flags

libraries[RW]

dependant libraries information

linker_file[RW]

link files

meta_components[RW]

meta_components dependency

outdir[RW]
project_name[RW]
sources[RW]

source

templates[RW]

template

tool_chain_add_spec[RW]

tool_chain_add_apec

tool_chain_set_spec[RW]

Public Class Methods

new(options) click to toggle source
# File lib/ebngen/unifmt.rb, line 169
def initialize(options)
        @options_default = {
        :config => "debug",
        :tool_chain => "iar",
        :type => "application",
        :board => "dummy_board",
        :project_name => "dummy_project",
        :project_root_dir => nil,
        }

        if options.class.to_s != "Hash" and not options.nil?
                puts "#{options} shall be in hash format like { :targets => [\"release\", \"debug\"]}"
                return
        end
        options.each do |key, value|
                @options_default[key] = value
        end

        @projects_hash = Hash.new
        @projects_hash[@options_default[:project_name]] = Hash.new

        if not $TARGET_TYPES.include?(@options_default[:type])
                puts "Error type #{@options_default[:type]} is not in allowable list, should be #{$TARGET_TYPES}"
                return
        end

        if not $TOOL_CHAINS.include?(@options_default[:tool_chain])
                puts "Error tool_chain #{@options_default[:tool_chain]} is not supported"
                return
        end


self.attributes.each do |item|
        if @@CONFIG_SETTINGS.include?(item)
          instance_variable_set("@#{item}",Unifmt.get_validate(item).new)
          #@projects_hash[tc]["targets"][config][item.to_s] = instance_variable_get("@#{item}")
    end
end
end

Public Instance Methods

<<(other) click to toggle source
# File lib/ebngen/unifmt.rb, line 246
def <<(other)
    @projects_hash.deep_merge(other.output_info)
end
as_include_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 263
def as_include_unit
    return {"path" => "",  "rootdir" => ""}
end
as_preincludes_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 259
def as_preincludes_unit
    return {"path" => "",  "rootdir" => ""}
end
cc_include_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 271
def cc_include_unit
    return {"path" => "",  "rootdir" => ""}
end
cc_preincludes_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 267
def cc_preincludes_unit
    return {"path" => "",  "rootdir" => ""}
end
cxx_include_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 279
def cxx_include_unit
    return {"path" => "",  "rootdir" => ""}
end
cxx_preincludes_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 275
def cxx_preincludes_unit
    return {"path" => "",  "rootdir" => ""}
end
help() click to toggle source
# File lib/ebngen/unifmt.rb, line 254
def help
        puts @@UNIFY_KEYS
end
linker_file_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 283
def linker_file_unit
    return {"path" => "",  "rootdir" => ""}
end
load(project_data) click to toggle source
# File lib/ebngen/unifmt.rb, line 250
def load(project_data)
    @projects_hash = project_data
end
merge_target(project_data) click to toggle source
# File lib/ebngen/unifmt.rb, line 242
def merge_target(project_data)
        @projects_hash.deep_merge(project_data)
end
output_info() click to toggle source
# File lib/ebngen/unifmt.rb, line 238
def output_info
        @projects_hash
end
sources_unit() click to toggle source
# File lib/ebngen/unifmt.rb, line 287
def sources_unit
    return {"source" => "", "virtual_dir" => "" ,"rootdir" => "", "release_dir" => ""}
end
update() click to toggle source
# File lib/ebngen/unifmt.rb, line 209
def update
        #some mandatory sections
        @subhash = @projects_hash[@options_default[:project_name]]
        @subhash["document"] = Hash.new
        @subhash["document"]["board"] = @options_default[:board]
        @subhash["document"]["project_name"] = @options_default[:project_name]
        @subhash["document"]["project_root_dir"] = @options_default[:project_root_dir]
        tc = @options_default[:tool_chain]
        @subhash[tc] = Hash.new
        @subhash[tc]["targets"] = Hash.new
        @subhash[tc]["templates"] = instance_variable_get("@templates")
@subhash[tc]["type"] = @options_default[:type]
    config = @options_default[:config]
if not $CONFIG_TYPES.include?(config)
        puts "the config type #{config} is not supported"
        return
end
        @subhash[tc]["targets"][config] = Hash.new
        self.attributes.each do |item|
        if @@CONFIG_SETTINGS.include?(item)
          @subhash[tc]["targets"][config][item.to_s] = instance_variable_get("@#{item}")
    end
end
#other need special process features
@subhash[tc]["source"] = instance_variable_get("@sources")
@subhash[tc]["outdir"] = instance_variable_get("@outdir")
@subhash[tc]["libraries"] = instance_variable_get("@libraries")
end