"A BSEG_BYTES size 0 flags 0", /*Size will be obtained from BSEG in lnkarea()*/
""
};
+
+ char * rel2[]={
+ "XH",
+ "H B areas 0 global symbols",
+ "A _CODE size 0 flags 0", /*Each .rel has one, so...*/
+ "A REG_BANK_0 size 0 flags 4", /*Register banks are overlayable*/
+ "A REG_BANK_1 size 0 flags 4",
+ "A REG_BANK_2 size 0 flags 4",
+ "A REG_BANK_3 size 0 flags 4",
+ "A BSEG size 0 flags 80", /*BSEG must be just before BITS*/
+ "A BSEG_BYTES size 0 flags 0", /*Size will be obtained from BSEG in lnkarea()*/
+ "A DSEG size 0 flags 0",
+ "A OSEG size 0 flags 4",
+ "A ISEG size 0 flags 0",
+ "A SSEG size 0 flags 4",
+ ""
+ };
int j;
- for (j=0; rel[j][0]!=0; j++)
- {
- ip=rel[j];
- link_main();
- }
+ if(packflag_and_stacksize)
+ {
+ for (j=0; rel2[j][0]!=0; j++)
+ {
+ ip=rel2[j];
+ link_main();
+ }
+ }
+ else
+ {
+ for (j=0; rel[j][0]!=0; j++)
+ {
+ ip=rel[j];
+ link_main();
+ }
+ }
/*Set the start address of the default areas:*/
for(ap=areap; ap; ap=ap->a_ap)
else if (!strcmp(ap->a_id, "REG_BANK_2")) { ap->a_addr=0x10; ap->a_type=1; }
else if (!strcmp(ap->a_id, "REG_BANK_3")) { ap->a_addr=0x18; ap->a_type=1; }
else if (!strcmp(ap->a_id, "BSEG_BYTES")) { ap->a_addr=0x20; ap->a_type=1; }
+ else if (!strcmp(ap->a_id, "SSEG"))
+ {
+ if(packflag_and_stacksize>1) ap->a_axp->a_size=packflag_and_stacksize;
+ }
}
}
/*
* Link all area addresses.
*/
- lnkarea();
+ if(!packflag_and_stacksize)
+ lnkarea();
+ else
+ lnkarea2();
/*
* Process global definitions.
*/
map();
if (sflag) /*JCF: memory usage summary output*/
- if(summary(areap))lkexit(1);
+ {
+ if(!packflag_and_stacksize)
+ {
+ if(summary(areap)) lkexit(1);
+ }
+ else
+ {
+ if(summary2(areap)) lkexit(1);
+ }
+ }
- if (iram_size)
+ if ((iram_size) && (!packflag_and_stacksize))
iramcheck();
/*
break;
case 'y': /*JCF: memory usage summary output*/
- case 'Y':
++sflag;
break;
+ case 'Y':
+ unget(getnb());
+ /*The stack segment default size is 16 bytes. Use -Yxx for xx bytes*/
+ packflag_and_stacksize=(ip && *ip)?expr(0):16;
+ break;
+
case 'j':
case 'J':
jflag = 1;
return(0);
case 'z':
- case 'Z':
+ case 'Z':
dflag = 1;
return(0);
default:
" -i Intel Hex as file[IHX]",
" -s Motorola S19 as file[S19]",
" -j Produce NoICE debug as file[NOI]",
- " -z Produce SDCdb debug as file[cdb]",
+ " -z Produce SDCdb debug as file[cdb]",
/* "List:", */
" -u Update listing file(s) with link data as file(s)[.RST]",
"Miscellaneous:\n"
" -a [iram-size] Check for internal RAM overflow",
" -v [xram-size] Check for external RAM overflow",
" -w [code-size] Check for code overflow",
+ " -y Generate memory usage summary file[mem]",
+ " -Y [stack-size] Pack internal ram and allocate space for stack",
"End:",
" -e or null line terminates input",
0