From add152ddb851575c885208c12b008887e68b9f48 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sun, 27 Oct 2013 22:46:52 -0400 Subject: [PATCH] Add option to specify maximum pgm memory size --- src/options.c | 9 ++++++++- src/options.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/options.c b/src/options.c index 3c292d4..138507e 100644 --- a/src/options.c +++ b/src/options.c @@ -46,6 +46,7 @@ static const char args_doc[] = "[FILENAME]"; static struct argp_option argp_options[] = { {"debug", 'd', "level", 0, "Produce debugging output" }, {"iram", 'i', "size", 0, "Set internal ram size" }, + {"pram", 'p', "size", 0, "Set program memory size" }, {"xram", 'x', "size", 0, "Set external ram size (default is 1024)" }, { 0 } }; @@ -85,7 +86,9 @@ decode_memory_size(char *arg, struct argp_state *state, int memid) char *endptr; int *dest; - if (memid == INT_MEM_ID) + if (memid == PGM_MEM_ID) + dest = &options.pram_size; + else if (memid == INT_MEM_ID) dest = &options.iram_size; else if (memid == EXT_MEM_ID) dest = &options.xram_size; @@ -115,6 +118,9 @@ parse_opt(int key, char *arg, struct argp_state *state) case 'i': decode_memory_size(arg, state, INT_MEM_ID); break; + case 'p': + decode_memory_size(arg, state, PGM_MEM_ID); + break; case 'x': decode_memory_size(arg, state, EXT_MEM_ID); break; @@ -151,6 +157,7 @@ parse_command_line_options(int argc, char *argv[]) /* Setting default values. */ options.filename = NULL; + options.pram_size = PGM_MEM_DEFAULT_SIZE; options.iram_size = INT_MEM_MAX_SIZE; options.xram_size = EXT_MEM_DEFAULT_SIZE; diff --git a/src/options.h b/src/options.h index b58b636..b75a827 100644 --- a/src/options.h +++ b/src/options.h @@ -28,6 +28,7 @@ " -version display version information and exit\n" struct options_t { + int pram_size; /* Maximum program memory size. */ int iram_size; /* Maximum internal ram size. */ int xram_size; /* Maximum external ram size. */ char *filename; -- 2.20.1