From 65e09ac437a9ec6e13bb2fb2b2ce597647732f5a Mon Sep 17 00:00:00 2001 From: tecodev Date: Tue, 10 Oct 2006 19:59:16 +0000 Subject: [PATCH] * src/SDCCmain.c (optionsTable): accept --stack-size for PICs, * src/pic/device.c (pic14_getSharebankSize,pic14_getSharebankAddress), * src/pic/main.c (_pic14_parseOptions), * src/pic/main.h: mostly reverted to previous state, now use results from SDCCmain.c's argument parsing git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4408 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 12 ++++++++++-- src/SDCCmain.c | 4 +++- src/pic/device.c | 8 ++++---- src/pic/main.c | 38 +++----------------------------------- src/pic/main.h | 2 -- 5 files changed, 20 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13ded01b..d5732d62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-10 Raphael Neider + + * src/SDCCmain.c (optionsTable): accept --stack-size for PICs, + * src/pic/device.c (pic14_getSharebankSize,pic14_getSharebankAddress), + * src/pic/main.c (_pic14_parseOptions), + * src/pic/main.h: mostly reverted to previous state, now use results + from SDCCmain.c's argument parsing + 2006-10-10 Borut Razem * debugger/mcs51/break.[ch], debugger/mcs51/cmd.c, @@ -13,8 +21,8 @@ * device/include/pic18fregs.h, * device/lib/pic16/pics.all, * device/lib/pic16/libdev/pic18f[24]{620,525}.c): added support for - 18f2620, 18f4620, 18f2525, and 18f4525 devices, thanks to - Gary Plumbridge and Anton Strobl + 18f2620, 18f4620, 18f2525, and 18f4525 devices, thanks to + Gary Plumbridge and Anton Strobl 2006-10-10 Raphael Neider diff --git a/src/SDCCmain.c b/src/SDCCmain.c index df97f511..bda46576 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -262,8 +262,10 @@ optionsTable[] = { { 0, OPTION_STACK_LOC, NULL, " Stack pointer initial value" }, { 0, OPTION_DATA_LOC, NULL, " Direct data start location" }, { 0, OPTION_IDATA_LOC, NULL, NULL }, +#if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51 || !OPT_DISABLE_PIC + { 0, OPTION_STACK_SIZE, NULL,"MCS51/DS390/PIC - Tells the linker to allocate this space for stack"}, +#endif #if !OPT_DISABLE_DS390 || !OPT_DISABLE_MCS51 - { 0, OPTION_STACK_SIZE, NULL,"MCS51/DS390 - Tells the linker to allocate this space for stack"}, { 0, OPTION_PACK_IRAM, NULL,"MCS51/DS390 - Tells the linker to pack variables in internal ram (default)"}, { 0, OPTION_NO_PACK_IRAM, &options.no_pack_iram,"MCS51/DS390 - Tells the linker not to pack variables in internal ram"}, #endif diff --git a/src/pic/device.c b/src/pic/device.c index 9cfdb553..5546e1f1 100644 --- a/src/pic/device.c +++ b/src/pic/device.c @@ -1026,11 +1026,11 @@ int pic14_getHasSecondConfigReg(void) *-----------------------------------------------------------------*/ int pic14_getSharebankSize(void) { - if (pic14_options.stackSize <= 0) { + if (options.stack_size <= 0) { // default size: 16 bytes return 16; } else { - return pic14_options.stackSize; + return options.stack_size; } } @@ -1044,7 +1044,7 @@ int pic14_getSharebankSize(void) int pic14_getSharebankAddress(void) { int sharebankAddress = 0x7f; - if (pic14_options.stackLocation != 0) { + if (options.stack_loc != 0) { // permanent (?) workaround for pic16f84a-like devices with hardly // any memory: // 0x00-0x0B SFR @@ -1052,7 +1052,7 @@ int pic14_getSharebankAddress(void) // 0x50-0x7F unimplemented (reads as 0), // 0x80-0x8B SFRs (partly mapped to 0x0?) // 0x8c-0xCF mapped to 0x0C-0x4F - sharebankAddress = pic14_options.stackLocation + pic14_getSharebankSize() - 1; + sharebankAddress = options.stack_loc + pic14_getSharebankSize() - 1; } else { /* If total RAM is less than 0x7f as with 16f84 then reduce * sharebankAddress to fit */ diff --git a/src/pic/main.c b/src/pic/main.c index 71d8ad89..37a2b40a 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -53,14 +53,14 @@ static char *_pic14_keywords[] = pic14_options_t pic14_options; #define ARG_STACKLOC "--stack-loc" -#define ARG_STACKSIZ "--stack-siz" +#define ARG_STACKSIZ "--stack-size" extern int debug_verbose; /* from pcode.c */ static OPTION _pic14_poptions[] = { { 0 , "--debug-xtra", &debug_verbose, "show more debug info in assembly output" }, { 0 , "--no-pcode-opt", &pic14_options.disable_df, "disable (slightly faulty) optimization on pCode" }, - { 0 , ARG_STACKLOC, &pic14_options.stackLocation, "sets the lowest address of the argument passing stack" }, - { 0 , ARG_STACKSIZ, &pic14_options.stackSize, "sets the size if the argument passing stack (default: 16, minimum: 4)" }, + { 0 , ARG_STACKLOC, NULL, "sets the lowest address of the argument passing stack" }, + { 0 , ARG_STACKSIZ, NULL, "sets the size if the argument passing stack (default: 16, minimum: 4)" }, { 0 , NULL, NULL, NULL } }; @@ -159,7 +159,6 @@ static bool _pic14_parseOptions (int *pargc, char **argv, int *i) { char buf[128]; - int len; /* TODO: allow port-specific command line options to specify * segment names here. @@ -180,37 +179,6 @@ _pic14_parseOptions (int *pargc, char **argv, int *i) return 1; } - len = strlen(ARG_STACKLOC); - if (!strncmp(ARG_STACKLOC, argv[ *i ], len)) { - if (argv[*i][len] != '=' || argv[*i][len+1] == 0) { - printf("ERROR: no number entered for %s=num\n", ARG_STACKLOC); - exit(EXIT_FAILURE); - } - // extract number from "--stack-loc=0x70" - pic14_options.stackLocation = strtol(argv[ *i ] + len + 1, NULL, 0); - - if (errno) { - printf("ERROR: Could not parse number after %s=num\n", ARG_STACKLOC); - exit(EXIT_FAILURE); - } - return 1; - } - - len = strlen(ARG_STACKLOC); - if (!strncmp(ARG_STACKSIZ, argv[*i], len)) { - if (argv[*i][len] != '=' || argv[*i][len+1] == 0) { - printf("ERROR: no number entered for %s=num\n", ARG_STACKSIZ); - exit(EXIT_FAILURE); - } - // extract number from "--stack-size=16" - pic14_options.stackSize = strtol(argv[ *i ] + len + 1, NULL, 0); - if (errno) { - printf("ERROR: Could not parse number after %s=num\n", ARG_STACKLOC); - exit(EXIT_FAILURE); - } - return 1; - } - return FALSE; } diff --git a/src/pic/main.h b/src/pic/main.h index b84b42a8..da5f40a1 100644 --- a/src/pic/main.h +++ b/src/pic/main.h @@ -4,8 +4,6 @@ typedef struct { unsigned int isLibrarySource:1; int disable_df; - int stackLocation; - int stackSize; } pic14_options_t; extern pic14_options_t pic14_options; -- 2.39.5