diff --git a/platform/src/CLIParser.cpp b/platform/src/CLIParser.cpp index ed72201..d7e9e1b 100644 --- a/platform/src/CLIParser.cpp +++ b/platform/src/CLIParser.cpp @@ -68,6 +68,7 @@ CLIParser::CLIParser(int argc, char *argv[]) // --help option if (vm_.count("help")) { std::cout << "DBT-RISE-RiscV simulator for RISC-V" << std::endl << desc << std::endl; + exit(0); } po::notify(vm_); // throws on error, so do after help in case there are any problems valid = true; @@ -76,7 +77,7 @@ CLIParser::CLIParser(int argc, char *argv[]) std::cerr << desc << std::endl; } - auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as() : vm_["verbose"].as(); + auto verbosity = !vm_["Verbose"].defaulted() ? vm_["Verbose"].as() : vm_.count("verbose") ? vm_["verbose"].as() : 3; auto colored_output = vm_["Verbose"].defaulted(); auto dbg_level = vm_.count("debug-level") ? vm_["debug-level"].as() @@ -109,7 +110,7 @@ void CLIParser::build() { // clang-format off desc.add_options() ("help,h", "Print help message") - ("verbose,v", po::value()->implicit_value(3), "Sets logging verbosity") + ("verbose,v", po::value()->implicit_value(4), "Sets logging verbosity") ("Verbose,V", po::value()->default_value(logging::INFO), "Debug output level as with --verbose but print non-colored") ("debug-level,D", po::value(), "Debug output level (textual) as with --verbose") ("log-file", po::value(), "Sets default log file.") diff --git a/platform/src/sc_main.cpp b/platform/src/sc_main.cpp index 6e63a7e..39ae349 100644 --- a/platform/src/sc_main.cpp +++ b/platform/src/sc_main.cpp @@ -69,9 +69,9 @@ int sc_main(int argc, char *argv[]) { /////////////////////////////////////////////////////////////////////////// // CLI argument parsing & logging setup /////////////////////////////////////////////////////////////////////////// + CLIParser parser(argc, argv); scc::stream_redirection cout_redir(std::cout, scc::log::INFO); scc::stream_redirection cerr_redir(std::cerr, scc::log::ERROR); - CLIParser parser(argc, argv); if (!parser.is_valid()) return ERROR_IN_COMMAND_LINE; /////////////////////////////////////////////////////////////////////////// // set up infrastructure @@ -116,7 +116,7 @@ int sc_main(int argc, char *argv[]) { cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.dump_ir", parser.is_set("dump-ir")); if (parser.is_set("elf")) cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", parser.get("elf")); - else { + else if (parser.is_set("argv")){ auto args = parser.get>("argv"); if(args.size()) cfg.set_value("i_system.i_hifive1.i_fe310.i_core_complex.elf_file", args[0]);