ebngen 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/ebngen/adapter/_assert.rb +25 -0
 - data/lib/ebngen/adapter/_base.rb +25 -0
 - data/lib/ebngen/adapter/_path_modifier.rb +29 -0
 - data/lib/ebngen/adapter/_yml_helper.rb +51 -0
 - data/lib/ebngen/adapter/cmake/CMakeList.txt +570 -0
 - data/lib/ebngen/adapter/cmake/txt.rb +75 -0
 - data/lib/ebngen/adapter/cmake.rb +291 -0
 - data/lib/ebngen/adapter/iar/ewd.rb +6 -0
 - data/lib/ebngen/adapter/iar/ewp.rb +250 -0
 - data/lib/ebngen/adapter/iar/eww.rb +62 -0
 - data/lib/ebngen/adapter/iar.rb +390 -0
 - data/lib/ebngen/assembly.rb +22 -0
 - data/lib/ebngen/ebngen.rb +4 -0
 - data/lib/ebngen/generate.rb +42 -0
 - data/lib/ebngen/settings/target_types.rb +2 -0
 - data/lib/ebngen/settings/tool_chains.rb +5 -0
 - data/lib/ebngen/translate.rb +238 -0
 - data/lib/ebngen/unifmt.rb +290 -0
 - metadata +19 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d18964b0ad569c78be8e3864446b73fbcd50a217
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a6d43d8ccee3402fd0974b0d2e6ee56d1bd4c60c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8eea8b1eb2b741fb6bdd2e65b169ad089a51d4f530416ed8391e2cf0ef6f341b6cb13b76cb47f2873b32394db62a2e05d836f56905976d699a5cf535b073f023
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e0a7433011a34fc999ed1b4bdf180dfb45762573c9753c2ad780e0afbc11cb60f3c10b5688e8da947355df6690d1ce874a742cd2170cde57c64b6b58aba3b877
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            module Core
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                # perform simple assertion like c <assert.h>
         
     | 
| 
      
 5 
     | 
    
         
            +
                # implementation raise an exception instead go to abort
         
     | 
| 
      
 6 
     | 
    
         
            +
                # two ways how use assert:
         
     | 
| 
      
 7 
     | 
    
         
            +
                # 1) assert(condition, "message")
         
     | 
| 
      
 8 
     | 
    
         
            +
                # 2) assert(condition) do "message" end
         
     | 
| 
      
 9 
     | 
    
         
            +
                # I would prefer use 2.nd way because 1.st way always 
         
     | 
| 
      
 10 
     | 
    
         
            +
                # evaluate the message parameter ("like #{failed_var.some_info...}")
         
     | 
| 
      
 11 
     | 
    
         
            +
                # while 2.nd evaluate message only if condition fails
         
     | 
| 
      
 12 
     | 
    
         
            +
                def assert(condition, message=nil)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    unless (condition)
         
     | 
| 
      
 14 
     | 
    
         
            +
                        if block_given?
         
     | 
| 
      
 15 
     | 
    
         
            +
                            message = yield(condition)
         
     | 
| 
      
 16 
     | 
    
         
            +
                        end
         
     | 
| 
      
 17 
     | 
    
         
            +
                        raise message == nil ? "assertion error" : message
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                module_function :assert
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Base
         
     | 
| 
      
 2 
     | 
    
         
            +
              def process(project_data)
         
     | 
| 
      
 3 
     | 
    
         
            +
              	project_data.each_key do |key|
         
     | 
| 
      
 4 
     | 
    
         
            +
              		methods = instance_methods(false)
         
     | 
| 
      
 5 
     | 
    
         
            +
              		if methods.include(key.to_sym)
         
     | 
| 
      
 6 
     | 
    
         
            +
              			send(key.to_sym, project_data)
         
     | 
| 
      
 7 
     | 
    
         
            +
              		else
         
     | 
| 
      
 8 
     | 
    
         
            +
              			puts "#{key} is not processed"
         
     | 
| 
      
 9 
     | 
    
         
            +
              		end
         
     | 
| 
      
 10 
     | 
    
         
            +
              	end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def create_method(name)
         
     | 
| 
      
 14 
     | 
    
         
            +
                self.class.send(:define_method, name){|project_data|
         
     | 
| 
      
 15 
     | 
    
         
            +
                  project_data[name].each_key do |key|
         
     | 
| 
      
 16 
     | 
    
         
            +
                    methods = self.class.instance_methods(false)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    if methods.include?(key.to_sym)
         
     | 
| 
      
 18 
     | 
    
         
            +
                      send(key.to_sym)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    else
         
     | 
| 
      
 20 
     | 
    
         
            +
                      puts "#{key} is not processed"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                }
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'pathname'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative '_assert'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class PathModifier
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                attr_reader    :rootdir_table
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                def initialize(rootdir_table)
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @rootdir_table = rootdir_table
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def fullpath(rootdir_name, relpath)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    Core.assert(@rootdir_table.has_key?(rootdir_name)) do
         
     | 
| 
      
 15 
     | 
    
         
            +
                        "rootdir '#{rootdir_name}' is not present in table '@{rootdir_table}'"
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    if (@rootdir_table[ rootdir_name ] && !@rootdir_table[ rootdir_name ].empty?)
         
     | 
| 
      
 18 
     | 
    
         
            +
                        relpath = File.join(
         
     | 
| 
      
 19 
     | 
    
         
            +
                            @rootdir_table[ rootdir_name ].gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR), relpath.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
         
     | 
| 
      
 20 
     | 
    
         
            +
                        )
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return relpath.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                def relpath(project_full_path, root_dir_path)
         
     | 
| 
      
 26 
     | 
    
         
            +
                   return Pathname.new(root_dir_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)).relative_path_from(Pathname.new(project_full_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR))).to_s
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "yaml"
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module UNI_Project
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              def set_hash(options)
         
     | 
| 
      
 8 
     | 
    
         
            +
                 @projects_hash = options
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              def get_output_dir(toolchain,  path_hash, **args)
         
     | 
| 
      
 12 
     | 
    
         
            +
                if args.length == 0
         
     | 
| 
      
 13 
     | 
    
         
            +
                  return File.join(@projects_hash[toolchain]["outdir"], toolchain)
         
     | 
| 
      
 14 
     | 
    
         
            +
                elsif ! args[:dir].nil?
         
     | 
| 
      
 15 
     | 
    
         
            +
                  return Pathname.new(File.join(
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @projects_hash[toolchain]["outdir"], toolchain)).relative_path_from(Pathname.new(args[:dir])).to_s
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def get_src_list(toolchain)
         
     | 
| 
      
 21 
     | 
    
         
            +
                return @projects_hash[toolchain]["source"]
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              def get_libraries(toolchain)
         
     | 
| 
      
 25 
     | 
    
         
            +
                return @projects_hash[toolchain]["libraries"]
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              def get_target_list(toolchain)
         
     | 
| 
      
 29 
     | 
    
         
            +
               return @projects_hash[toolchain]["targets"].keys
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def get_type(toolchain)
         
     | 
| 
      
 33 
     | 
    
         
            +
                return @projects_hash[toolchain]["type"]
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              def get_targets(toolchain)
         
     | 
| 
      
 37 
     | 
    
         
            +
               return @projects_hash[toolchain]["targets"]
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
              def get_project_name()
         
     | 
| 
      
 41 
     | 
    
         
            +
                return @projects_hash['document']['project_name']
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              def get_board()
         
     | 
| 
      
 45 
     | 
    
         
            +
                return @projects_hash['document']['board']
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              def get_template(toolchain)
         
     | 
| 
      
 49 
     | 
    
         
            +
                return @projects_hash[toolchain]['templates']
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     |