Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/cfg/cfg.rb

    r331 r429  
    1 #!/usr/bin/env ruby
     1#!/usr/bin/env ruby -Eutf-8 -w
    22# -*- coding: utf-8 -*-
    33#
     
    55#
    66#  Copyright (C) 2015 by FUJI SOFT INCORPORATED, JAPAN
    7 #  Copyright (C) 2015,2016 by Embedded and Real-Time Systems Laboratory
     7#  Copyright (C) 2015-2019 by Embedded and Real-Time Systems Laboratory
    88#              Graduate School of Information Science, Nagoya Univ., JAPAN
    99#
     
    3737#  の責任を負わない.
    3838#
    39 #  $Id$
     39#  $Id: cfg.rb 175 2019-06-19 01:51:58Z ertl-hiro $
    4040#
    4141
     
    5656#
    5757# 共通
    58 VERSION = "1.2.2"
     58VERSION = "1.5.0"
    5959
    6060# cfg1_out関係
    61 CFG1_PREFIX        = "TOPPERS_cfg_"
    62 CFG1_MAGIC_NUM     = "TOPPERS_magic_number"
    63 CFG1_SIZEOF_SIGNED = "TOPPERS_sizeof_signed_t"
    64 CFG1_OUT_C         = "cfg1_out.c"
    65 CFG1_OUT_DB        = "cfg1_out.db"
    66 CFG1_OUT_SREC      = "cfg1_out.srec"
    67 CFG1_OUT_SYMS      = "cfg1_out.syms"
    68 CFG1_OUT_TIMESTAMP = "cfg1_out.timestamp"
    69 CFG1_OUT_TARGET_H  = "target_cfg1_out.h"
     61CFG1_PREFIX         = "TOPPERS_cfg_"
     62CFG1_MAGIC_NUM      = "TOPPERS_magic_number"
     63CFG1_SIZEOF_SIGNED  = "TOPPERS_sizeof_signed_t"
     64CFG1_SIZEOF_INTPTR  = "TOPPERS_sizeof_intptr_t"
     65CFG1_SIZEOF_CHARPTR = "TOPPERS_sizeof_char_ptr_t"
     66CFG1_OUT_C          = "cfg1_out.c"
     67CFG1_OUT_DB         = "cfg1_out.db"
     68CFG1_OUT_SREC       = "cfg1_out.srec"
     69CFG1_OUT_SYMS       = "cfg1_out.syms"
     70CFG1_OUT_TIMESTAMP  = "cfg1_out.timestamp"
     71CFG1_OUT_TARGET_H   = "target_cfg1_out.h"
    7072
    7173# cfg2_out関係
     
    105107$noParseError = 0
    106108def parse_error(cfgFile, message)
    107   error(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
     109  error(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
    108110  if ($noParseError += 1) >= 10
    109111    abort("too many errors emitted, stopping now")
     
    113115# システムコンフィギュレーションファイルの構文解析時の警告
    114116def parse_warning(cfgFile, message)
    115   warning(message, "#{cfgFile.getFileName()}:#{cfgFile.getLineNo}:")
     117  warning(message, "#{cfgFile.getFileName}:#{cfgFile.getLineNo}:")
    116118end
    117119
     
    155157def error_ercd(errorCode, params, message)
    156158  error_api(params, "#{errorCode}: #{message}")
    157 end
    158 
    159 # 静的API処理時の警告(エラーコード付き)
    160 def warning_ercd(errorCode, params, message)
    161   warning_api(params, "#{errorCode}: #{message}")
    162159end
    163160
     
    316313  # ハッシュのキーとして使う時の比較も数値情報で行う
    317314  def eql?(other)
    318     @val == other.val
     315    @val == other
    319316  end
    320317
     
    390387    if symbolData.has_key?(:VALUE)
    391388      eval("$#{symbolName} = #{symbolData[:VALUE]}")
     389      if symbolData.has_key?(:NUMSTRVAR)
     390        eval("$#{symbolData[:NUMSTRVAR]} = " \
     391                                        "NumStr.new(symbolData[:VALUE], symbolData[:EXPR])")
     392      end
    392393    end
    393394  end
     
    431432
    432433#
     434#  インクルードディレクティブ(#include)の生成
     435#
     436def GenerateIncludes(genFile)
     437  $cfgFileInfo.each do |cfgInfo|
     438    if cfgInfo.has_key?(:DIRECTIVE)
     439      genFile.add(cfgInfo[:DIRECTIVE])
     440    end
     441  end
     442end
     443
     444#
    433445#  パス3の処理
    434446#
     
    439451  db = PStore.new(CFG2_OUT_DB)
    440452  db.transaction(true) do
    441     $apiDefinition = db[:apiDefinition]
    442     $symbolValueTable = db[:symbolValueTable]
    443     $cfgFileInfo = db[:cfgFileInfo]
    444     $includeFiles = db[:includeFiles]
    445     $cfgData = db[:cfgData]
    446     $asmLabel = db[:asmLabel]
    447     $endianLittle = db[:endianLittle]
    448     $cfg2Data = db[:cfg2Data]
    449   end
    450   $cfg3Data = {}
     453    db.roots.each do |var|
     454      eval("$#{var} = db[:#{var}]")
     455    end
     456  end
    451457
    452458  #
     
    465471  #  パス4に引き渡す情報をファイルに生成
    466472  #
    467   if $omitOutputDb.nil?
     473  if !$omitOutputDb
    468474    db = PStore.new(CFG3_OUT_DB)
    469475    db.transaction do
    470       db[:apiDefinition] = $apiDefinition
    471       db[:symbolValueTable] = $symbolValueTable
    472       db[:cfgFileInfo] = $cfgFileInfo
    473       db[:includeFiles] = $includeFiles
    474       db[:cfgData] = $cfgData
    475       db[:asmLabel] = $asmLabel
    476       db[:endianLittle] = $endianLittle
    477       db[:cfg3Data] = $cfg3Data
     476      $globalVars.each do |var|
     477        eval("db[:#{var}] = $#{var}")
     478      end
    478479    end
    479480  end
     
    489490  db = PStore.new(CFG3_OUT_DB)
    490491  db.transaction(true) do
    491     $apiDefinition = db[:apiDefinition]
    492     $symbolValueTable = db[:symbolValueTable]
    493     $cfgFileInfo = db[:cfgFileInfo]
    494     $includeFiles = db[:includeFiles]
    495     $cfgData = db[:cfgData]
    496     $asmLabel = db[:asmLabel]
    497     $endianLittle = db[:endianLittle]
    498     $cfg3Data = db[:cfg3Data] || db[:cfg2Data]
     492    db.roots.each do |var|
     493      eval("$#{var} = db[:#{var}]")
     494    end
    499495  end
    500496
     
    557553$romImageFileName = nil
    558554$romSymbolFileName = nil
    559 $dependencyFileName = nil
    560555$idInputFileName = nil
    561556$idOutputFileName = nil
     557$dependencyFileName = nil
     558$omitOutputDb = false
     559$supportDomain = false
     560$supportClass = false
    562561
    563562#
    564563#  オプションの処理
    565564#
    566 OptionParser.new(banner="Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
     565OptionParser.new("Usage: cfg.rb [options] CONFIG-FILE", 40) do |opt|
    567566  opt.version = VERSION
     567  opt.release = nil
    568568  opt.on("-k KERNEL", "--kernel KERNEL", "kernel profile name") do |val|
    569569    $kernel = val
     
    605605    $omitOutputDb = true
    606606  end
     607  opt.on("--enable-domain", "enable DOMAIN support") do
     608        $supportDomain = true
     609  end
     610  opt.on("--enable-class", "enable CLASS support") do
     611        $supportClass = true
     612  end
    607613  opt.on("-v", "--version", "show version number") do
    608     abort(opt.ver)
     614    puts(opt.ver)
     615    exit(0)
    609616  end
    610617  opt.on("-h", "--help", "show help (this)") do
    611     abort(opt.help)
     618    puts(opt.help)
     619    exit(0)
    612620  end
    613621  opt.parse!(ARGV)
     
    642650        $supportDomain = true
    643651when /^fmp/
     652        $supportClass = true
     653when /^hrmp/
     654        $supportDomain = true
    644655        $supportClass = true
    645656end
Note: See TracChangeset for help on using the changeset viewer.