+2006-10-10 Raphael Neider <rneider AT web.de>
+
+ * 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 <borut.razem AT siol.net>
* debugger/mcs51/break.[ch], debugger/mcs51/cmd.c,
* 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 <rneider AT web.de>
{ 0, OPTION_STACK_LOC, NULL, "<nnnn> Stack pointer initial value" },
{ 0, OPTION_DATA_LOC, NULL, "<nnnn> 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
*-----------------------------------------------------------------*/
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;
}
}
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
// 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 */
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 }
};
_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.
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;
}
typedef struct {
unsigned int isLibrarySource:1;
int disable_df;
- int stackLocation;
- int stackSize;
} pic14_options_t;
extern pic14_options_t pic14_options;