X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Fmcs51%2Flkmem.c;h=6a2d8770c5563cea8cd604be87a9583eb3329ed4;hb=c23ad1a2833573f366363e6c4273bc4f20bf767c;hp=2588276e47cd768ee436cf5ec6952e3207912068;hpb=5dc5912c87c4a23e12c62a7a240aaed20cbca574;p=fw%2Fsdcc diff --git a/as/mcs51/lkmem.c b/as/mcs51/lkmem.c index 2588276e..6a2d8770 100644 --- a/as/mcs51/lkmem.c +++ b/as/mcs51/lkmem.c @@ -22,10 +22,11 @@ #include #include #include "aslink.h" +#include "strcmpi.h" int summary(struct area * areap) { - #define EQ(A,B) !strcmpi((A),(B)) + #define EQ(A,B) !as_strcmpi((A),(B)) #define MIN_STACK 16 #define REPORT_ERROR(A, H) \ {\ @@ -48,17 +49,17 @@ int summary(struct area * areap) FILE * of; /*Artifacts used for printing*/ - char start[8], end[8], size[8], max[8]; - char format[]=" %-16.16s %-7.7s %-7.7s %-7.7s %-7.7s\n"; + char start[15], end[15], size[15], max[15]; + char format[]=" %-16.16s %-8.8s %-8.8s %-8.8s %-8.8s\n"; char line[]="---------------------"; typedef struct { - unsigned int Start; - unsigned int Size; - unsigned int Max; + unsigned long Start; + unsigned long Size; + unsigned long Max; char Name[NCPS]; - unsigned int flag; + unsigned long flag; } _Mem; unsigned int dram[0x100]; @@ -77,6 +78,14 @@ int summary(struct area * areap) _Mem Stack={0xff, 0, 1, "STACK", 0x0000}; _Mem XRam= {0xffff, 0, 65536, "EXTERNAL RAM", 0x0100}; _Mem Rom= {0xffff, 0, 65536, "ROM/EPROM/FLASH", 0x0200}; + + if(rflag) /*For the DS390*/ + { + XRam.Max=0x1000000; /*24 bits*/ + XRam.Start=0xffffff; + Rom.Max=0x1000000; + Rom.Start=0xffffff; + } if((iram_size<=0)||(iram_size>0x100)) /*Default: 8052 like memory*/ { @@ -197,13 +206,13 @@ int summary(struct area * areap) if((j==0) || (j==7)) fprintf(of, format, line, line, line, line, line); if((j!=5) || (Ram[j].Size>0)) { - sprintf(start, "0x%02x", Ram[j].Start); + sprintf(start, "0x%02lx", Ram[j].Start); if(Ram[j].Size==0) end[0]=0;/*Empty string*/ else - sprintf(end, "0x%02x", j==7?Total_Last:Ram[j].Size+Ram[j].Start-1); - sprintf(size, "%5u", Ram[j].Size); - sprintf(max, "%5u", Ram[j].Max); + sprintf(end, "0x%02lx", j==7?Total_Last:Ram[j].Size+Ram[j].Start-1); + sprintf(size, "%5lu", Ram[j].Size); + sprintf(max, "%5lu", Ram[j].Max); fprintf(of, format, Ram[j].Name, start, end, size, max); } } @@ -228,8 +237,8 @@ int summary(struct area * areap) if(Ram[5].Size!=0) { - sprintf(buff, "%d bytes in DRAM wasted. " - "SDCC link could use: --data-loc 0x%02x\n", + sprintf(buff, "%ld bytes in DRAM wasted. " + "SDCC link could use: --data-loc 0x%02lx\n", Ram[5].Size, Ram[6].Start-Ram[5].Size); REPORT_WARNING(buff, 1); } @@ -243,7 +252,8 @@ int summary(struct area * areap) } /*Report the position of the begining of the stack*/ - fprintf(of, "\nStack starts at: 0x%02x", Stack.Start); + fprintf(of, "\n%stack starts at: 0x%02lx (sp set to 0x%02lx)", + rflag ? "16 bit mode initial s" : "S", Stack.Start, Stack.Start-1); /*Check that the stack pointer is landing in a safe place:*/ if( (dram[Stack.Start] & 0x8000) == 0x8000 ) @@ -259,7 +269,7 @@ int summary(struct area * areap) REPORT_ERROR(buff, 1); for(j=0; j<7; j++) { - if(dram[Stack.Start]&Ram[j].flag) + if(dram[Stack.Start]&Ram[j].flag) { sprintf(buff, "'%s'\n", Ram[j].Name); break; @@ -271,14 +281,14 @@ int summary(struct area * areap) } REPORT_ERROR(buff, 0); } - else + 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 (kXRam.Max) + if( ((XRam.Start+XRam.Size)>XRam.Max) || + (((int)XRam.Size>xram_size)&&(xram_size>=0)) ) { sprintf(buff, "Insufficient EXTERNAL RAM memory.\n"); REPORT_ERROR(buff, 1); } - if((Rom.Start+Rom.Size)>Rom.Max) + if( ((Rom.Start+Rom.Size)>Rom.Max) || + (((int)Rom.Size>code_size)&&(code_size>=0)) ) { sprintf(buff, "Insufficient ROM/EPROM/FLASH memory.\n"); REPORT_ERROR(buff, 1);