set *sectNames=NULL; /* list of section listed in pragma directives */
set *sectSyms=NULL; /* list of symbols set in a specific section */
-
+set *wparamList=NULL;
static int
_process_pragma(const char *sz)
{
static const char *WHITE = " \t\n";
+ static const char *WHITECOMMA = " \t\n,";
char *ptr = strtok((char *)sz, WHITE);
return 0;
}
+ if(startsWith(ptr, "wparam")) {
+ char *fname = strtok((char *)NULL, WHITECOMMA);
+
+ while(fname) {
+ addSet(&wparamList, Safe_strdup(fname));
+
+// debugf("passing with WREG to %s\n", fname);
+ fname = strtok((char *)NULL, WHITECOMMA);
+ }
+
+ return 0;
+ }
+
return 1;
}
#define NL_OPT "--nl="
#define USE_CRT "--use-crt="
+#define OFMSG_LRSUPPORT "--flr-support"
+
+#define OPTIMIZE_GOTO "--optimize-goto"
+
char *alt_asm=NULL;
char *alt_link=NULL;
{ 0, NL_OPT, NULL, "new line, \"lf\" or \"crlf\""},
{ 0, USE_CRT, NULL, "use <crt-o> run-time initialization module"},
{ 0, "--no-crt", &pic16_options.no_crt, "do not link any default run-time initialization module"},
+ { 0, "--gstack", &pic16_options.gstack, "trace stack pointer push/pop to overflow"},
+// { 0, OFMSG_LRSUPPORT, NULL, "use support functions for local register store/restore"},
+ { 0, OPTIMIZE_GOTO, NULL, "try to use (conditional) BRA instead of GOTO"},
{ 0, NULL, NULL, NULL}
};
/* TODO: allow port-specific command line options to specify
* segment names here.
*/
- /* check for arguments that have associated an integer variable */
- while(pic16_optionsTable[j].pparameter) {
- if(ISOPT( pic16_optionsTable[j].longOpt )) {
- (*pic16_optionsTable[j].pparameter)++;
- return TRUE;
- }
- j++;
- }
-
+
+ /* check for arguments that have associated an integer variable */
+ while(pic16_optionsTable[j].pparameter) {
+ if(ISOPT( pic16_optionsTable[j].longOpt )) {
+ (*pic16_optionsTable[j].pparameter)++;
+ return TRUE;
+ }
+ j++;
+ }
- if(ISOPT(STACK_MODEL)) {
- stkmodel = getStringArg(STACK_MODEL, argv, i, *pargc);
- if(!STRCASECMP(stkmodel, "small"))pic16_options.stack_model = 0;
- else if(!STRCASECMP(stkmodel, "large"))pic16_options.stack_model = 1;
- else {
- fprintf(stderr, "Unknown stack model: %s", stkmodel);
- exit(-1);
- }
- return TRUE;
- }
+ if(ISOPT(STACK_MODEL)) {
+ stkmodel = getStringArg(STACK_MODEL, argv, i, *pargc);
+ if(!STRCASECMP(stkmodel, "small"))pic16_options.stack_model = 0;
+ else if(!STRCASECMP(stkmodel, "large"))pic16_options.stack_model = 1;
+ else {
+ fprintf(stderr, "Unknown stack model: %s", stkmodel);
+ exit(-1);
+ }
+ return TRUE;
+ }
- if(ISOPT(OPT_BANKSEL)) {
- pic16_options.opt_banksel = getIntArg(OPT_BANKSEL, argv, i, *pargc);
- return TRUE;
- }
+ if(ISOPT(OPT_BANKSEL)) {
+ pic16_options.opt_banksel = getIntArg(OPT_BANKSEL, argv, i, *pargc);
+ return TRUE;
+ }
- if(ISOPT(REP_UDATA)) {
- pic16_sectioninfo.at_udata = Safe_strdup(getStringArg(REP_UDATA, argv, i, *pargc));
- return TRUE;
- }
+ if(ISOPT(REP_UDATA)) {
+ pic16_sectioninfo.at_udata = Safe_strdup(getStringArg(REP_UDATA, argv, i, *pargc));
+ return TRUE;
+ }
- if(ISOPT(ALT_ASM)) {
- alt_asm = Safe_strdup(getStringArg(ALT_ASM, argv, i, *pargc));
- return TRUE;
- }
+ if(ISOPT(ALT_ASM)) {
+ alt_asm = Safe_strdup(getStringArg(ALT_ASM, argv, i, *pargc));
+ return TRUE;
+ }
- if(ISOPT(ALT_LINK)) {
- alt_link = Safe_strdup(getStringArg(ALT_LINK, argv, i, *pargc));
- return TRUE;
- }
+ if(ISOPT(ALT_LINK)) {
+ alt_link = Safe_strdup(getStringArg(ALT_LINK, argv, i, *pargc));
+ return TRUE;
+ }
- if(ISOPT(IVT_LOC)) {
- pic16_options.ivt_loc = getIntArg(IVT_LOC, argv, i, *pargc);
- return TRUE;
- }
+ if(ISOPT(IVT_LOC)) {
+ pic16_options.ivt_loc = getIntArg(IVT_LOC, argv, i, *pargc);
+ return TRUE;
+ }
- if(ISOPT(NL_OPT)) {
- char *tmp;
+ if(ISOPT(NL_OPT)) {
+ char *tmp;
- tmp = Safe_strdup( getStringArg(NL_OPT, argv, i, *pargc) );
- if(!STRCASECMP(tmp, "lf"))pic16_nl = 0;
- else if(!STRCASECMP(tmp, "crlf"))pic16_nl = 1;
- else {
- fprintf(stderr, "invalid termination character id\n");
- exit(-1);
- }
- return TRUE;
+ tmp = Safe_strdup( getStringArg(NL_OPT, argv, i, *pargc) );
+ if(!STRCASECMP(tmp, "lf"))pic16_nl = 0;
+ else if(!STRCASECMP(tmp, "crlf"))pic16_nl = 1;
+ else {
+ fprintf(stderr, "invalid termination character id\n");
+ exit(-1);
}
+ return TRUE;
+ }
- if(ISOPT(USE_CRT)) {
- pic16_options.no_crt = 0;
- pic16_options.crt_name = Safe_strdup( getStringArg(USE_CRT, argv, i, *pargc) );
+ if(ISOPT(USE_CRT)) {
+ pic16_options.no_crt = 0;
+ pic16_options.crt_name = Safe_strdup( getStringArg(USE_CRT, argv, i, *pargc) );
+
+ return TRUE;
+ }
+
+#if 0
+ if(ISOPT(OFMSG_LRSUPPORT)) {
+ pic16_options.opt_flags |= OF_LR_SUPPORT;
+ return TRUE;
+ }
+#endif
+
+#if 1
+ if (ISOPT(OPTIMIZE_GOTO)) {
+ pic16_options.opt_flags |= OF_OPTIMIZE_GOTO;
+ return TRUE;
+ }
+#endif
- return TRUE;
- }
-
return FALSE;
}
pic16_options.crt_name = "crt0i.o"; /* the default crt to link */
pic16_options.no_crt = 0; /* use crt by default */
pic16_options.ip_stack = 1; /* set to 1 to enable ipop/ipush for stack */
+ pic16_options.gstack = 0;
+ pic16_options.debgen = 0;
}
static const char *