+2003-01-12 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/SDCCmain.c (main): port->finaliseOptions() moved for z80 linking
+ * src/SDCCutil.c (join): ugly bug: missing '\0'
+ * as/mcs51/lkmem.c (summary): sp on address 7 is save
+
2003-01-11 Bernhard Held <bernhard@bernhardheld.de>
* src/SDCCmain.c (assemble, linkEdit): preparations for -o
fprintf(of, "\nStack starts at: 0x%02lx", Stack.Start);
/*Check that the stack pointer is landing in a safe place:*/
- if( (dram[Stack.Start] & 0x8000) == 0x8000 )
+ // if (!flat24Mode) TODO: bypass stack check for ds390
{
- fprintf(of, ".\n");
- sprintf(buff, "Stack set to unavailable memory.\n");
- REPORT_ERROR(buff, 1);
- }
- else if(dram[Stack.Start])
- {
- fprintf(of, ".\n");
- sprintf(buff, "Stack overlaps area ");
- REPORT_ERROR(buff, 1);
- for(j=0; j<7; j++)
+ if( (dram[Stack.Start] & 0x8000) == 0x8000 )
{
- if(dram[Stack.Start]&Ram[j].flag)
- {
- sprintf(buff, "'%s'\n", Ram[j].Name);
- break;
- }
+ fprintf(of, ".\n");
+ sprintf(buff, "Stack set to unavailable memory.\n");
+ REPORT_ERROR(buff, 1);
}
- if(dram[Stack.Start]&IRam.flag)
+ else if(dram[Stack.Start+1])
{
- sprintf(buff, "'%s'\n", IRam.Name);
+ fprintf(of, ".\n");
+ sprintf(buff, "Stack overlaps area ");
+ REPORT_ERROR(buff, 1);
+ for(j=0; j<7; j++)
+ {
+ if(dram[Stack.Start+1]&Ram[j].flag)
+ {
+ sprintf(buff, "'%s'\n", Ram[j].Name);
+ break;
+ }
+ }
+ if(dram[Stack.Start]&IRam.flag)
+ {
+ sprintf(buff, "'%s'\n", IRam.Name);
+ }
+ REPORT_ERROR(buff, 0);
}
- REPORT_ERROR(buff, 0);
- }
- else
- {
- for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
- fprintf(of, " with %d bytes available\n", k);
- if (k<MIN_STACK)
+ else
{
- sprintf(buff, "Only %d byte%s available for stack.\n",
+ for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
+ fprintf(of, " with %d bytes available\n", k);
+ if (k<MIN_STACK)
+ {
+ sprintf(buff, "Only %d byte%s available for stack.\n",
k, (k==1)?"":"s");
- REPORT_WARNING(buff, 1);
+ REPORT_WARNING(buff, 1);
+ }
}
}
initValues ();
_discoverPaths (argv[0]);
+ /* initMem() is expensive, but
+ initMem() must called before port->finaliseOptions ().
+ And the z80 port needs port->finaliseOptions(),
+ even if we're only linking. */
+ initMem ();
+ port->finaliseOptions ();
+
if (fullSrcFileName)
{
-
- initMem ();
-
- port->finaliseOptions ();
preProcess (envp);
initSymt ();