📄 main.cc
字号:
/* $Id: Main.cc,v 1.8 2000/10/01 17:00:42 pure Exp $ */#include <unistd.h>#include <string.h>#include <iostream.h>#include <stdlib.h>#include "Monitor.h"#include "Server.h"int ramsize = (32*1024) - 0x60;int romsize = 128*1024;int model = 0;char* hostname = "localhost";int port = 4040;char* filename = NULL;void usage(char* progname){ cerr << "This is the AVR emulator. Usage:" << endl << endl << " " << progname << " [options]" << endl << endl << "Options:" << endl << endl << " -r SIZE Size of the emulated RAM in bytes" << endl << " -f SIZE Size of the emulated FLASH in bytes" << endl << " -m MODEL Emulate this AVR model" << endl << " 1 ATmega103" << endl << " 2 AT90S8515" << endl << " -n hostname Hostname where to listen for GDB (default: " << hostname << ")" << endl << " -p port Port on which to listen for GDB (default: " << port <<")" << endl << " -x binary Execute the binary instead of waiting for gdb" << endl << endl << "For more information consult the AVR emulator manual." << endl << "Report bugs to \"gal@cs.uni-magdeburg.de\"" << endl << endl; exit(-1);}int main(int argc, char** argv){ int option_char; while ((option_char = getopt(argc, argv, "r:f:n:p:x:m:")) != EOF) switch (option_char) { case 'r': ramsize = atoi(optarg); break; case 'f': romsize = atoi(optarg); break; case 'n': hostname = strdup(optarg); break; case 'p': port = atoi(optarg); break; case 'm': model = atoi(optarg); break; case 'x': filename = strdup(optarg); break; case '?': usage(argv[0]); } if (!filename) { cout << "Wait for GDB connect at " << hostname << ":" << port << endl; Server server(hostname, port); server.accept(); Monitor monitor(server, ramsize, romsize, model, 4000000); monitor.main(); } else { AVR_BDM emulator(ramsize, romsize, model, 4000000); emulator.load(filename); emulator.run(); emulator.join(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -