"_xdata",
"_pdata",
"_idata",
+ "_naked",
NULL
};
}
+set *absSymSet;
+
static int
_process_pragma(const char *sz)
{
static const char *WHITE = " \t";
+
char *ptr = strtok((char *)sz, WHITE);
if (startsWith (ptr, "maxram")) {
// fprintf(stderr, "Initializing stack pointer to 0x%x\n", (int)floatFromVal(constVal(stackPos)));
stackPosVal = constVal( stackPosS );
stackPos = (unsigned int)floatFromVal( stackPosVal );
+
+ return 0;
}
+
+ if(startsWith(ptr, "code")) {
+ char *symname = strtok((char *)NULL, WHITE);
+ char *location = strtok((char *)NULL, WHITE);
+ absSym *absS;
+ value *addr;
- return 0;
+ absS = Safe_calloc(1, sizeof(absSym));
+ absS->name = Safe_strdup( symname );
+ addr = constVal( location );
+ absS->address = (unsigned int)floatFromVal( addr );
+
+ addSet(&absSymSet, absS);
+ fprintf(stderr, "%s:%d symbol %s will be placed in location 0x%06x in code memory\n",
+ __FILE__, __LINE__, symname, absS->address);
+
+ return 0;
+ }
+
+ return 1;
}
#define REP_UDATA "--preplace-udata-with="
extern int pic16_debug_verbose;
+extern int pic16_ralloc_debug;
+extern int pic16_pcode_verbose;
OPTION pic16_optionsTable[]= {
{ 0, "--pgen-banksel", &pic16_options.gen_banksel, "generate BANKSEL assembler directives"},
{ 0, STACK_MODEL, NULL, "use stack model 'small' (default) or 'large'"},
{ 0, "--debug-xtra", &pic16_debug_verbose, "show more debug info in assembly output"},
+ { 0, "--debug-ralloc", &pic16_ralloc_debug, "dump register allocator debug file *.d"},
+ { 0, "--pcode-verbose", &pic16_pcode_verbose, "dump pcode related info"},
+
{ 0, REP_UDATA, NULL, "Place udata variables at another section: udata_acs, udata_ovr, udata_shr"},
#if 0
port->mem.default_local_map = data;
port->mem.default_globl_map = data;
+ options.all_callee_saves = 1; // always callee saves
+
setMainValue("mcu", pic16_processor_base_name() );
addSet(&preArgvSet, Safe_strdup("-DMCU={mcu}"));
}
}
-#if 0
+#if 1
static char *_pic16_mangleFunctionName(char *sz)
{
- fprintf(stderr, "mangled function name: %s\n", sz);
+// fprintf(stderr, "mangled function name: %s\n", sz);
return sz;
}
fprintf (of, "\tlist\tp=%s\n",&name[1]);
if(!pic16_options.omit_configw) {
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300001, pic16_getConfigWord(0x300001));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300002, pic16_getConfigWord(0x300002));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300003, pic16_getConfigWord(0x300003));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300005, pic16_getConfigWord(0x300005));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300006, pic16_getConfigWord(0x300006));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300008, pic16_getConfigWord(0x300008));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x300009, pic16_getConfigWord(0x300009));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x30000a, pic16_getConfigWord(0x30000a));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x30000b, pic16_getConfigWord(0x30000b));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x30000c, pic16_getConfigWord(0x30000c));
- fprintf (of, "\t__config 0x%x,0x%x\n", 0x30000d, pic16_getConfigWord(0x30000d));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300001, pic16_getConfigWord(0x300001));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300002, pic16_getConfigWord(0x300002));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300003, pic16_getConfigWord(0x300003));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300005, pic16_getConfigWord(0x300005));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300006, pic16_getConfigWord(0x300006));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300008, pic16_getConfigWord(0x300008));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x300009, pic16_getConfigWord(0x300009));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000a, pic16_getConfigWord(0x30000a));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000b, pic16_getConfigWord(0x30000b));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000c, pic16_getConfigWord(0x30000c));
+ fprintf (of, "\t__config 0x%x,0x%hhx\n", 0x30000d, pic16_getConfigWord(0x30000d));
}
fprintf (of, "\tradix dec\n");
*/
static const char *_asmCmd[] =
{
- "gpasm", "-c -I/usr/local/share/gputils/header", "\"$1.asm\"", NULL
+ "gpasm", "$l", "-c", "\"$1.asm\"", NULL
};
_linkCmd, /* linker command and arguments */
NULL, /* alternate macro based form */
NULL, /* no do_link function */
- ".rel" /* extension for object files */
+ ".o", /* extension for object files */
+ 0 /* no need for linker file */
},
{
_defaultRules
2, /* int */
4, /* long */
2, /* ptr */
- 2, /* fptr, this should be changed to 3 for far pointers (see Microchip) */
+ 3, /* fptr, far pointers (see Microchip) */
2, /* gptr */
1, /* bit */
4, /* float */
_pic16_reset_regparm,
_pic16_regparm,
_process_pragma, /* process a pragma */
- NULL, //_pic16_mangleFunctionName, /* mangles function name */
+ _pic16_mangleFunctionName, /* mangles function name */
_hasNativeMulFor,
hasExtBitOp, /* hasExtBitOp */
oclsExpense, /* oclsExpense */